Don't skip last level when calculating compaction stats
Summary: We have a bug where we don't report the last level's files as being compacted. This fixes it. Test Plan: See the fix in action here: https://phabricator.fb.com/P19845738 Reviewers: MarkCallaghan, sdong Reviewed By: sdong Subscribers: yhchiang, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D38727
This commit is contained in:
parent
5c224d1b70
commit
ea6d3a8ac0
@ -541,8 +541,7 @@ void InternalStats::DumpCFStats(std::string* value) {
|
|||||||
const VersionStorageInfo* vstorage = cfd_->current()->storage_info();
|
const VersionStorageInfo* vstorage = cfd_->current()->storage_info();
|
||||||
|
|
||||||
int num_levels_to_check =
|
int num_levels_to_check =
|
||||||
(cfd_->ioptions()->compaction_style != kCompactionStyleUniversal &&
|
(cfd_->ioptions()->compaction_style != kCompactionStyleFIFO)
|
||||||
cfd_->ioptions()->compaction_style != kCompactionStyleFIFO)
|
|
||||||
? vstorage->num_levels() - 1
|
? vstorage->num_levels() - 1
|
||||||
: 1;
|
: 1;
|
||||||
|
|
||||||
@ -555,7 +554,7 @@ void InternalStats::DumpCFStats(std::string* value) {
|
|||||||
}
|
}
|
||||||
// Count # of files being compacted for each level
|
// Count # of files being compacted for each level
|
||||||
std::vector<int> files_being_compacted(number_levels_, 0);
|
std::vector<int> files_being_compacted(number_levels_, 0);
|
||||||
for (int level = 0; level < num_levels_to_check; ++level) {
|
for (int level = 0; level < number_levels_; ++level) {
|
||||||
for (auto* f : vstorage->LevelFiles(level)) {
|
for (auto* f : vstorage->LevelFiles(level)) {
|
||||||
if (f->being_compacted) {
|
if (f->being_compacted) {
|
||||||
++files_being_compacted[level];
|
++files_being_compacted[level];
|
||||||
|
Loading…
Reference in New Issue
Block a user