Fix underflow in FIFOCompactionPicker (#10386)

Summary:
Fix https://github.com/facebook/rocksdb/issues/10133

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10386

Reviewed By: riversand963

Differential Revision: D38067265

Pulled By: ajkr

fbshipit-source-id: 3a99a98ac5d7ac37581b5b636fbfa7901563d834
main
LIU HU 2 years ago committed by Facebook GitHub Bot
parent dd759537d0
commit 8885b0537b
  1. 1
      HISTORY.md
  2. 4
      db/compaction/compaction_picker_fifo.cc

@ -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

@ -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));

Loading…
Cancel
Save