From 966b32b57c673774ea677fe3a40d255e6c8916ba Mon Sep 17 00:00:00 2001 From: zhangjinpeng1987 Date: Tue, 17 Oct 2017 11:09:29 -0700 Subject: [PATCH] fix delete range bug Summary: Fix this [issue](https://github.com/facebook/rocksdb/issues/2989). ajkr PTAL Close #2989 Closes https://github.com/facebook/rocksdb/pull/3017 Differential Revision: D6078541 Pulled By: yiwu-arbug fbshipit-source-id: ef3db87b37b9156f83ca468aa39dea1f6dbde49d --- db/compaction_job.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index c986b9a80..4754b6be4 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -1041,6 +1041,7 @@ Status CompactionJob::FinishCompactionOutputFile( auto meta = &sub_compact->current_output()->meta; if (s.ok()) { Slice lower_bound_guard, upper_bound_guard; + std::string smallest_user_key; const Slice *lower_bound, *upper_bound; if (sub_compact->outputs.size() == 1) { // For the first output table, include range tombstones before the min key @@ -1050,7 +1051,8 @@ Status CompactionJob::FinishCompactionOutputFile( // For subsequent output tables, only include range tombstones from min // key onwards since the previous file was extended to contain range // tombstones falling before min key. - lower_bound_guard = meta->smallest.user_key(); + smallest_user_key = meta->smallest.user_key().ToString(false /*hex*/); + lower_bound_guard = Slice(smallest_user_key); lower_bound = &lower_bound_guard; } else { lower_bound = nullptr;