]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/db/snapshot_checker.h
import 14.2.4 nautilus point release
[ceph.git] / ceph / src / rocksdb / db / snapshot_checker.h
index 67d17bd6d12ec92e237b3703c611581274a633a1..4d29b83c4ff9d413e75479b40bdfef92724c633d 100644 (file)
@@ -8,22 +8,30 @@
 
 namespace rocksdb {
 
-// Callback class that control GC of duplicate keys in flush/compaction
+enum class SnapshotCheckerResult : int {
+  kInSnapshot = 0,
+  kNotInSnapshot = 1,
+  // In case snapshot is released and the checker has no clue whether
+  // the given sequence is visible to the snapshot.
+  kSnapshotReleased = 2,
+};
+
+// Callback class that control GC of duplicate keys in flush/compaction.
 class SnapshotChecker {
  public:
   virtual ~SnapshotChecker() {}
-  virtual bool IsInSnapshot(SequenceNumber sequence,
-                            SequenceNumber snapshot_sequence) const = 0;
+  virtual SnapshotCheckerResult CheckInSnapshot(
+      SequenceNumber sequence, SequenceNumber snapshot_sequence) const = 0;
 };
 
 class DisableGCSnapshotChecker : public SnapshotChecker {
  public:
   virtual ~DisableGCSnapshotChecker() {}
-  virtual bool IsInSnapshot(
+  virtual SnapshotCheckerResult CheckInSnapshot(
       SequenceNumber /*sequence*/,
       SequenceNumber /*snapshot_sequence*/) const override {
-    // By returning false, we prevent all the values from being GCed
-    return false;
+    // By returning kNotInSnapshot, we prevent all the values from being GCed
+    return SnapshotCheckerResult::kNotInSnapshot;
   }
   static DisableGCSnapshotChecker* Instance() { return &instance_; }
 
@@ -41,8 +49,8 @@ class WritePreparedSnapshotChecker : public SnapshotChecker {
   explicit WritePreparedSnapshotChecker(WritePreparedTxnDB* txn_db);
   virtual ~WritePreparedSnapshotChecker() {}
 
-  virtual bool IsInSnapshot(SequenceNumber sequence,
-                            SequenceNumber snapshot_sequence) const override;
+  virtual SnapshotCheckerResult CheckInSnapshot(
+      SequenceNumber sequence, SequenceNumber snapshot_sequence) const override;
 
  private:
 #ifndef ROCKSDB_LITE