Skip to content

allow_ingest_behind can drop tombstones #13571

@pdillinger

Description

@pdillinger

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(

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions