提交 6c579520 编写于 作者: A Andrew Kryczka 提交者: Facebook Github Bot

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
上级 425210cc
...@@ -125,9 +125,9 @@ TEST_F(FlushJobTest, NonEmpty) { ...@@ -125,9 +125,9 @@ TEST_F(FlushJobTest, NonEmpty) {
inserted_keys.insert({internal_key.Encode().ToString(), value}); 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); InternalKey internal_key("9995", SequenceNumber(10000), kTypeRangeDeletion);
inserted_keys.insert({internal_key.Encode().ToString(), "9999"}); inserted_keys.insert({internal_key.Encode().ToString(), "9999a"});
autovector<MemTable*> to_delete; autovector<MemTable*> to_delete;
cfd->imm()->Add(new_mem, &to_delete); cfd->imm()->Add(new_mem, &to_delete);
...@@ -147,7 +147,7 @@ TEST_F(FlushJobTest, NonEmpty) { ...@@ -147,7 +147,7 @@ TEST_F(FlushJobTest, NonEmpty) {
ASSERT_OK(flush_job.Run(&fd)); ASSERT_OK(flush_job.Run(&fd));
mutex_.Unlock(); mutex_.Unlock();
ASSERT_EQ(ToString(0), fd.smallest.user_key().ToString()); 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 fd.largest.user_key().ToString()); // range tombstone end key
ASSERT_EQ(1, fd.smallest_seqno); ASSERT_EQ(1, fd.smallest_seqno);
ASSERT_EQ(10000, fd.largest_seqno); // range tombstone seqnum 10000 ASSERT_EQ(10000, fd.largest_seqno); // range tombstone seqnum 10000
......
...@@ -41,7 +41,7 @@ bool RangeDelAggregator::ShouldDelete(const ParsedInternalKey& parsed) { ...@@ -41,7 +41,7 @@ bool RangeDelAggregator::ShouldDelete(const ParsedInternalKey& parsed) {
break; break;
} }
if (parsed.sequence < tombstone.seq_ && 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) { 0) {
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册