rocksdb icon indicating copy to clipboard operation
rocksdb copied to clipboard

allow_ingest_behind can drop tombstones

Open pdillinger opened this issue 8 months ago • 0 comments

If you use allow_ingest_behind with the intention of later stitching together a sequence of updates on top of some base data, that currently doesn't respect Delete updates because it might drop the tombstone before ingesting the base data. Example unit test modification:

diff --git a/db/external_sst_file_test.cc b/db/external_sst_file_test.cc
index 2e4cae427..084c139d1 100644
--- a/db/external_sst_file_test.cc
+++ b/db/external_sst_file_test.cc
@@ -2462,7 +2462,12 @@ TEST_P(ExternalSSTFileTest, IngestBehind) {
     ASSERT_OK(Put(Key(i), "memtable"));
     true_data[Key(i)] = "memtable";
   }
-  ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
+  {
+    // Tombstone is dropped by compaction (test still passes) if there's no
+    // snapshot to preserve it, e.g. ManagedSnapshot ms(db_);
+    ASSERT_OK(Delete(Key(7)));
+    ASSERT_OK(db_->CompactRange(CompactRangeOptions(), nullptr, nullptr));
+  }
   // Universal picker should go at second from the bottom level
   ASSERT_EQ("0,1", FilesPerLevel());
   ASSERT_OK(GenerateAndAddExternalFile(

pdillinger avatar Apr 23 '25 22:04 pdillinger