diff --git a/HISTORY.md b/HISTORY.md index 21ebb1046..3ae92d365 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -10,6 +10,7 @@ ### Bug Fixes * Fix a bug where `GenericRateLimiter` could revert the bandwidth set dynamically using `SetBytesPerSecond()` when a user configures a structure enclosing it, e.g., using `GetOptionsFromString()` to configure an `Options` that references an existing `RateLimiter` object. * Fix race conditions in `GenericRateLimiter`. +* Fix a bug in `FIFOCompactionPicker::PickTTLCompaction` where total_size calculating might cause underflow ## 7.5.0 (07/15/2022) ### New Features diff --git a/db/compaction/compaction_picker_fifo.cc b/db/compaction/compaction_picker_fifo.cc index 6034dd0ef..1816b95ed 100644 --- a/db/compaction/compaction_picker_fifo.cc +++ b/db/compaction/compaction_picker_fifo.cc @@ -83,7 +83,7 @@ Compaction* FIFOCompactionPicker::PickTTLCompaction( break; } } - total_size -= f->compensated_file_size; + total_size -= f->fd.file_size; inputs[0].files.push_back(f); } } @@ -191,7 +191,7 @@ Compaction* FIFOCompactionPicker::PickSizeCompaction( for (auto ritr = level_files.rbegin(); ritr != level_files.rend(); ++ritr) { auto f = *ritr; - total_size -= f->compensated_file_size; + total_size -= f->fd.file_size; inputs[0].files.push_back(f); char tmp_fsize[16]; AppendHumanBytes(f->fd.GetFileSize(), tmp_fsize, sizeof(tmp_fsize));