Fixed a bug in Compaction.cc where input_levels_ was not properly resized.

Summary:
Fixed a bug in Compaction.cc where input_levels_ was not properly resized.
Without this fix, there would be invalid access in input_levels_ when more
than two levels are involved in one compaction run.

This fix will go to master instead of compaction branch.

Test Plan: tested in compaction branch.

Reviewers: ljin, sdong, igor

Reviewed By: igor

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D20481
main
Yueh-Hsuan Chiang 10 years ago
parent f82d4a2498
commit 0e1b4787ed
  1. 1
      db/compaction.cc

@ -62,6 +62,7 @@ Compaction::Compaction(Version* input_version, int start_level, int out_level,
level_ptrs_[i] = 0;
}
int num_levels = output_level_ - start_level_ + 1;
input_levels_.resize(num_levels);
inputs_.resize(num_levels);
for (int i = 0; i < num_levels; ++i) {
inputs_[i].level = start_level_ + i;

Loading…
Cancel
Save