1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
6 #include "db/snapshot_checker.h"
10 #endif // ROCKSDB_LITE
12 #include "utilities/transactions/write_prepared_txn_db.h"
17 WritePreparedSnapshotChecker::WritePreparedSnapshotChecker(
18 WritePreparedTxnDB
* /*txn_db*/) {}
20 SnapshotCheckerResult
WritePreparedSnapshotChecker::CheckInSnapshot(
21 SequenceNumber
/*sequence*/, SequenceNumber
/*snapshot_sequence*/) const {
22 // Should never be called in LITE mode.
24 return SnapshotCheckerResult::kInSnapshot
;
29 WritePreparedSnapshotChecker::WritePreparedSnapshotChecker(
30 WritePreparedTxnDB
* txn_db
)
33 SnapshotCheckerResult
WritePreparedSnapshotChecker::CheckInSnapshot(
34 SequenceNumber sequence
, SequenceNumber snapshot_sequence
) const {
35 bool snapshot_released
= false;
36 // TODO(myabandeh): set min_uncommitted
37 bool in_snapshot
= txn_db_
->IsInSnapshot(
38 sequence
, snapshot_sequence
, kMinUnCommittedSeq
, &snapshot_released
);
39 if (snapshot_released
) {
40 return SnapshotCheckerResult::kSnapshotReleased
;
42 return in_snapshot
? SnapshotCheckerResult::kInSnapshot
43 : SnapshotCheckerResult::kNotInSnapshot
;
46 #endif // ROCKSDB_LITE
47 DisableGCSnapshotChecker
DisableGCSnapshotChecker::instance_
;
49 } // namespace rocksdb