From 88931716988431f261e7bef7f466062ec8ede3b7 Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 14 Apr 2015 19:58:52 -0700 Subject: [PATCH] Bug of trivial move of dynamic level Summary: D36669 introduces a bug that trivial moved data is not going to specific level but the next level, which will incorrectly be level 1 for level 0 compaciton if base level is not level 1. Fixing it by appreciating the output level Test Plan: Run all tests Reviewers: MarkCallaghan, rven, yhchiang, igor Reviewed By: igor Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D37119 Conflicts: db/db_test.cc --- db/db_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index f23e4de2b..ca462b693 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -2244,7 +2244,7 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress, JobContext* job_context, assert(c->num_input_files(0) == 1); FileMetaData* f = c->input(0, 0); c->edit()->DeleteFile(c->level(), f->fd.GetNumber()); - c->edit()->AddFile(c->level() + 1, f->fd.GetNumber(), f->fd.GetPathId(), + c->edit()->AddFile(c->output_level(), f->fd.GetNumber(), f->fd.GetPathId(), f->fd.GetFileSize(), f->smallest, f->largest, f->smallest_seqno, f->largest_seqno); status = versions_->LogAndApply(c->column_family_data(),