mirror of https://github.com/facebook/rocksdb.git
Fix reduce levels
ReduceNumberOfLevels had segmentation fault in WriteSnapshot() since we didn't change the number of levels in VersionSet (we consider them immutable from now on). This fixes the problem.
This commit is contained in:
parent
8477255da3
commit
04afa32134
|
@ -1779,8 +1779,11 @@ Status VersionSet::ReduceNumberOfLevels(const std::string& dbname,
|
|||
}
|
||||
|
||||
std::vector<FileMetaData*>* old_files_list = current_version->files_;
|
||||
// we need to allocate an array with the old number of levels size to
|
||||
// avoid SIGSEGV in WriteSnapshot()
|
||||
// however, all levels bigger or equal to new_levels will be empty
|
||||
std::vector<FileMetaData*>* new_files_list =
|
||||
new std::vector<FileMetaData*>[new_levels];
|
||||
new std::vector<FileMetaData*>[current_levels];
|
||||
for (int i = 0; i < new_levels - 1; i++) {
|
||||
new_files_list[i] = old_files_list[i];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue