VersionBuilder: Erase with iterators for better performance

Summary: Closes https://github.com/facebook/rocksdb/pull/3007

Differential Revision: D6077701

Pulled By: yiwu-arbug

fbshipit-source-id: a6fd5b8a23f4feb1660b9ce027f651a7e90352b3
main
Changli Gao 7 years ago committed by Facebook Github Bot
parent f7843f30a8
commit b8cea7cc27
  1. 7
      db/version_builder.cc

@ -274,11 +274,12 @@ class VersionBuilder::Rep {
auto exising = levels_[level].added_files.find(number);
if (exising != levels_[level].added_files.end()) {
UnrefFile(exising->second);
levels_[level].added_files.erase(number);
levels_[level].added_files.erase(exising);
}
} else {
if (invalid_levels_[level].count(number) > 0) {
invalid_levels_[level].erase(number);
auto exising = invalid_levels_[level].find(number);
if (exising != invalid_levels_[level].end()) {
invalid_levels_[level].erase(exising);
} else {
// Deleting an non-existing file on invalid level.
has_invalid_levels_ = true;

Loading…
Cancel
Save