From 6c5795200297e57259d2ec88dfeced2f09f575b8 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Mon, 14 Nov 2016 17:35:17 -0800 Subject: [PATCH] Make range deletion inclusive-exclusive Summary: This makes it easier to implement future optimizations like range collapsing. Closes https://github.com/facebook/rocksdb/pull/1504 Differential Revision: D4172214 Pulled By: ajkr fbshipit-source-id: ac4942f --- db/flush_job_test.cc | 6 +++--- db/range_del_aggregator.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/flush_job_test.cc b/db/flush_job_test.cc index 07f6b987b..fa079e75b 100644 --- a/db/flush_job_test.cc +++ b/db/flush_job_test.cc @@ -125,9 +125,9 @@ TEST_F(FlushJobTest, NonEmpty) { inserted_keys.insert({internal_key.Encode().ToString(), value}); } } - new_mem->Add(SequenceNumber(10000), kTypeRangeDeletion, "9995", "9999"); + new_mem->Add(SequenceNumber(10000), kTypeRangeDeletion, "9995", "9999a"); InternalKey internal_key("9995", SequenceNumber(10000), kTypeRangeDeletion); - inserted_keys.insert({internal_key.Encode().ToString(), "9999"}); + inserted_keys.insert({internal_key.Encode().ToString(), "9999a"}); autovector to_delete; cfd->imm()->Add(new_mem, &to_delete); @@ -147,7 +147,7 @@ TEST_F(FlushJobTest, NonEmpty) { ASSERT_OK(flush_job.Run(&fd)); mutex_.Unlock(); ASSERT_EQ(ToString(0), fd.smallest.user_key().ToString()); - ASSERT_EQ(ToString(9999), + ASSERT_EQ("9999a", fd.largest.user_key().ToString()); // range tombstone end key ASSERT_EQ(1, fd.smallest_seqno); ASSERT_EQ(10000, fd.largest_seqno); // range tombstone seqnum 10000 diff --git a/db/range_del_aggregator.cc b/db/range_del_aggregator.cc index a05894d8f..ad68eee09 100644 --- a/db/range_del_aggregator.cc +++ b/db/range_del_aggregator.cc @@ -41,7 +41,7 @@ bool RangeDelAggregator::ShouldDelete(const ParsedInternalKey& parsed) { break; } if (parsed.sequence < tombstone.seq_ && - icmp_.user_comparator()->Compare(parsed.user_key, tombstone.end_key_) <= + icmp_.user_comparator()->Compare(parsed.user_key, tombstone.end_key_) < 0) { return true; }