Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use L1 size as estimate for L0 size in LevelCompactionBuilder::GetPathID #2903

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions db/compaction_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,8 @@ uint32_t LevelCompactionBuilder::GetPathId(
uint64_t level_size;
int cur_level = 0;

// max_bytes_for_level_base denotes L1 size.
// We estimate L0 size to be the same as L1.
level_size = mutable_cf_options.max_bytes_for_level_base;

// Last path is the fallback
Expand All @@ -1289,8 +1291,10 @@ uint32_t LevelCompactionBuilder::GetPathId(
return p;
} else {
current_path_size -= level_size;
level_size = static_cast<uint64_t>(
level_size * mutable_cf_options.max_bytes_for_level_multiplier);
if (cur_level > 0) {
level_size = static_cast<uint64_t>(
level_size * mutable_cf_options.max_bytes_for_level_multiplier);
}
cur_level++;
continue;
}
Expand Down