Skip to content

Commit

Permalink
Delayed Writes: fix L0 calc bug (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuval-Ariel committed Dec 25, 2022
1 parent a2c3d50 commit 34aaeaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/column_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1013,15 +1013,15 @@ ColumnFamilyData::CalculateWriteDelayDividerAndMaybeUpdateWriteStallCause(

// L0 files
double l0_divider = 1;
const auto extra_l0_ssts = vstorage->NumLevelFiles(0) -
const auto extra_l0_ssts = vstorage->l0_delay_trigger_count() -
mutable_cf_options.level0_slowdown_writes_trigger;
if (extra_l0_ssts > 0) {
const auto num_L0_steps = mutable_cf_options.level0_stop_writes_trigger -
mutable_cf_options.level0_slowdown_writes_trigger;
assert(num_L0_steps > 0);
// since extra_l0_ssts == num_L0_steps then we're in a stop condition.
assert(extra_l0_ssts < num_L0_steps);
l0_divider = 1 / (1 - (extra_l0_ssts / num_L0_steps));
l0_divider = 1 / (1 - (static_cast<double>(extra_l0_ssts) / num_L0_steps));
}

if (l0_divider > biggest_divider) {
Expand Down

0 comments on commit 34aaeaa

Please sign in to comment.