]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fix CompactionIterator flag for penultimate level output (#10967)
authorAndrew Kryczka <andrewkr@fb.com>
Tue, 22 Nov 2022 00:14:03 +0000 (16:14 -0800)
committerAndrew Kryczka <andrewkr@fb.com>
Thu, 24 Nov 2022 21:44:34 +0000 (13:44 -0800)
Summary:
We were not resetting it in non-debug mode so it could be true once and then stay true for future keys where it should be false. This PR adds the reset logic.

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

Test Plan:
- built `db_bench` with DEBUG_LEVEL=0
- ran benchmark: `TEST_TMPDIR=/dev/shm/prefix ./db_bench -benchmarks=fillrandom -compaction_style=1 -preserve_internal_time_seconds=100 -preclude_last_level_data_seconds=10 -write_buffer_size=1048576 -target_file_size_base=1048576 -subcompactions=8 -duration=120`
- compared "output_to_penultimate_level: X bytes + last: Y bytes" lines in LOG output
  - Before this fix, Y was always zero
  - After this fix, Y gradually increased throughout the benchmark

Reviewed By: riversand963

Differential Revision: D41417726

Pulled By: ajkr

fbshipit-source-id: ace1e9a289e751a5b0c2fbaa8addd4eda5525329

HISTORY.md
db/compaction/compaction_iterator.cc

index 3b4f81909e2c9cfe49e74c08742922c34a434b6e..3b4a0aba2dfbc94578d53da3110d20e148ccef79 100644 (file)
@@ -2,6 +2,7 @@
 ## Unreleased
 ### Bug Fixes
 * Fix failed memtable flush retry bug that could cause wrongly ordered updates, which would surface to writers as `Status::Corruption` in case of `force_consistency_checks=true` (default). It affects use cases that enable both parallel flush (`max_background_flushes > 1` or `max_background_jobs >= 8`) and non-default memtable count (`max_write_buffer_number > 2`).
+* Tiered Storage: fixed excessive keys written to penultimate level in non-debug builds.
 
 ## 7.8.2 (11/23/2022)
 ### Behavior changes
index b7238d857dd25588789324153da9f816ee2c3790..c37e4f6ed503ca1f992579c4fd4192a863be69c1 100644 (file)
@@ -1100,7 +1100,9 @@ void CompactionIterator::DecideOutputLevel() {
   TEST_SYNC_POINT_CALLBACK("CompactionIterator::PrepareOutput.context",
                            &context);
   output_to_penultimate_level_ = context.output_to_penultimate_level;
-#endif /* !NDEBUG */
+#else
+  output_to_penultimate_level_ = false;
+#endif  // NDEBUG
 
   // if the key is newer than the cutoff sequence or within the earliest
   // snapshot, it should output to the penultimate level.