2017-10-06 19:26:38 +02:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
|
|
|
|
#include "db/snapshot_checker.h"
|
|
|
|
|
|
|
|
#ifdef ROCKSDB_LITE
|
|
|
|
#include <assert.h>
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
|
2017-11-02 19:05:55 +01:00
|
|
|
#include "utilities/transactions/write_prepared_txn_db.h"
|
2017-10-06 19:26:38 +02:00
|
|
|
|
|
|
|
namespace rocksdb {
|
|
|
|
|
|
|
|
#ifdef ROCKSDB_LITE
|
2017-10-18 18:09:31 +02:00
|
|
|
WritePreparedSnapshotChecker::WritePreparedSnapshotChecker(
|
2018-04-13 02:55:14 +02:00
|
|
|
WritePreparedTxnDB* /*txn_db*/) {}
|
2017-10-06 19:26:38 +02:00
|
|
|
|
2017-10-18 18:09:31 +02:00
|
|
|
bool WritePreparedSnapshotChecker::IsInSnapshot(
|
2018-04-13 02:55:14 +02:00
|
|
|
SequenceNumber /*sequence*/, SequenceNumber /*snapshot_sequence*/) const {
|
2017-10-06 19:26:38 +02:00
|
|
|
// Should never be called in LITE mode.
|
|
|
|
assert(false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2017-10-18 18:09:31 +02:00
|
|
|
WritePreparedSnapshotChecker::WritePreparedSnapshotChecker(
|
|
|
|
WritePreparedTxnDB* txn_db)
|
2017-10-06 19:26:38 +02:00
|
|
|
: txn_db_(txn_db){};
|
|
|
|
|
2017-10-18 18:09:31 +02:00
|
|
|
bool WritePreparedSnapshotChecker::IsInSnapshot(
|
|
|
|
SequenceNumber sequence, SequenceNumber snapshot_sequence) const {
|
2017-10-06 19:26:38 +02:00
|
|
|
return txn_db_->IsInSnapshot(sequence, snapshot_sequence);
|
|
|
|
}
|
2017-10-18 18:09:31 +02:00
|
|
|
|
2017-10-06 19:26:38 +02:00
|
|
|
#endif // ROCKSDB_LITE
|
2017-10-18 18:09:31 +02:00
|
|
|
DisableGCSnapshotChecker DisableGCSnapshotChecker::instance_;
|
2017-10-06 19:26:38 +02:00
|
|
|
|
|
|
|
} // namespace rocksdb
|