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
main
zhangjinpeng1987 7 years ago committed by Facebook Github Bot
parent c0208dffbe
commit 966b32b57c
  1. 4
      db/compaction_job.cc

@ -1041,6 +1041,7 @@ Status CompactionJob::FinishCompactionOutputFile(
auto meta = &sub_compact->current_output()->meta; auto meta = &sub_compact->current_output()->meta;
if (s.ok()) { if (s.ok()) {
Slice lower_bound_guard, upper_bound_guard; Slice lower_bound_guard, upper_bound_guard;
std::string smallest_user_key;
const Slice *lower_bound, *upper_bound; const Slice *lower_bound, *upper_bound;
if (sub_compact->outputs.size() == 1) { if (sub_compact->outputs.size() == 1) {
// For the first output table, include range tombstones before the min key // 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 // For subsequent output tables, only include range tombstones from min
// key onwards since the previous file was extended to contain range // key onwards since the previous file was extended to contain range
// tombstones falling before min key. // 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; lower_bound = &lower_bound_guard;
} else { } else {
lower_bound = nullptr; lower_bound = nullptr;

Loading…
Cancel
Save