From 9f3475eccf569fa39af48fdb9848d35ae61cc102 Mon Sep 17 00:00:00 2001 From: Denis Hananein Date: Mon, 31 Oct 2022 18:24:44 -0700 Subject: [PATCH] Fix compilation errors, clang++-15 (#10907) Summary: I've tried to compile the main branch, but there are two minor things which are make CE. I'm not sure about the second one (`num_empty_non_l0_level`), probably there is should be additional assert. ``` -c ../cache/clock_cache.cc [build] ../cache/clock_cache.cc:855:15: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable] [build] for (size_t i = 0; &array_[current] != h; i++) { [build] ^ ``` ``` [build] ../db/version_set.cc:3665:7: error: variable 'num_empty_non_l0_level' set but not used [-Werror,-Wunused-but-set-variable] [build] int num_empty_non_l0_level = 0; [build] ^ [build] 1 error generated. ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/10907 Reviewed By: jay-zhuang Differential Revision: D40866667 Pulled By: ajkr fbshipit-source-id: 963b7bd56859d0b3b2779cd36fad229425cb7b17 --- cache/clock_cache.cc | 2 +- db/version_set.cc | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cache/clock_cache.cc b/cache/clock_cache.cc index 27793de9c..bd6f4ec28 100644 --- a/cache/clock_cache.cc +++ b/cache/clock_cache.cc @@ -852,7 +852,7 @@ void ClockHandleTable::Rollback(const UniqueId64x2& hashed_key, const ClockHandle* h) { size_t current = ModTableSize(hashed_key[1]); size_t increment = static_cast(hashed_key[0]) | 1U; - for (size_t i = 0; &array_[current] != h; i++) { + while (&array_[current] != h) { array_[current].displacements.fetch_sub(1, std::memory_order_relaxed); current = ModTableSize(current + increment); } diff --git a/db/version_set.cc b/db/version_set.cc index 0c452e19f..8e5438d8c 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -3662,13 +3662,9 @@ void VersionStorageInfo::SetFinalized() { assert(MaxBytesForLevel(level) >= max_bytes_prev_level); max_bytes_prev_level = MaxBytesForLevel(level); } - int num_empty_non_l0_level = 0; for (int level = 0; level < num_levels(); level++) { assert(LevelFiles(level).size() == 0 || LevelFiles(level).size() == LevelFilesBrief(level).num_files); - if (level > 0 && NumLevelBytes(level) > 0) { - num_empty_non_l0_level++; - } if (LevelFiles(level).size() > 0) { assert(level < num_non_empty_levels()); }