Skip to content

Commit c72e79a

Browse files
pdillingerfacebook-github-bot
authored andcommitted
Standardize on clang-format version 18 (facebook#13233)
Summary: ... which is the default for CentOS 9 and Ubuntu 24, the latter of which is now available in GitHub Actions. Relevant CI job updated. Re-formatted all cc|c|h files except in third-party/, using ``` clang-format -i `git ls-files | grep -E '[.](cc|c|h)$' | grep -v third-party/` ``` Pull Request resolved: facebook#13233 Test Plan: CI Reviewed By: jaykorean, archang19 Differential Revision: D67461638 Pulled By: pdillinger fbshipit-source-id: 0c9ac21a3f5eea6f5ade68bb6af7b6ba16c8b301
1 parent 1d919ac commit c72e79a

File tree

236 files changed

+581
-860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+581
-860
lines changed

.github/workflows/pr-jobs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
# ======================== Fast Initial Checks ====================== #
3232
check-format-and-targets:
3333
if: ${{ github.repository_owner == 'facebook' }}
34-
runs-on: ubuntu-latest
34+
runs-on: ubuntu-24.04
3535
steps:
3636
- uses: actions/checkout@v4.1.0
3737
with:

cache/cache.cc

-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ Status SecondaryCache::CreateFromString(
118118
sec_cache = NewCompressedSecondaryCache(sec_cache_opts);
119119
}
120120

121-
122121
if (status.ok()) {
123122
result->swap(sec_cache);
124123
}

cache/cache_bench_tool.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ namespace {
191191
class SharedState {
192192
public:
193193
explicit SharedState(CacheBench* cache_bench)
194-
: cv_(&mu_),
195-
cache_bench_(cache_bench) {}
194+
: cv_(&mu_), cache_bench_(cache_bench) {}
196195

197196
~SharedState() = default;
198197

cache/compressed_secondary_cache_test.cc

-1
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ TEST_P(CompressedSecondaryCacheTestWithCompressionParam,
845845
BasicTestHelper(sec_cache, sec_cache_is_compressed_);
846846
}
847847

848-
849848
TEST_P(CompressedSecondaryCacheTestWithCompressionParam, FailsTest) {
850849
FailsTest(sec_cache_is_compressed_);
851850
}

cache/lru_cache.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ void LRUHandleTable::Resize() {
9393

9494
uint32_t old_length = uint32_t{1} << length_bits_;
9595
int new_length_bits = length_bits_ + 1;
96-
std::unique_ptr<LRUHandle* []> new_list {
97-
new LRUHandle* [size_t{1} << new_length_bits] {}
98-
};
96+
std::unique_ptr<LRUHandle*[]> new_list{
97+
new LRUHandle* [size_t{1} << new_length_bits] {}};
9998
[[maybe_unused]] uint32_t count = 0;
10099
for (uint32_t i = 0; i < old_length; i++) {
101100
LRUHandle* h = list_[i];

cache/lru_cache_test.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ TYPED_TEST(ClockCacheTest, Limits) {
546546
// verify usage tracking on detached entries.)
547547
{
548548
size_t n = kCapacity * 5 + 1;
549-
std::unique_ptr<HandleImpl* []> ha { new HandleImpl* [n] {} };
549+
std::unique_ptr<HandleImpl*[]> ha{new HandleImpl* [n] {}};
550550
Status s;
551551
for (size_t i = 0; i < n && s.ok(); ++i) {
552552
hkey[1] = i;
@@ -713,7 +713,7 @@ TYPED_TEST(ClockCacheTest, ClockEvictionEffortCapTest) {
713713
// evictable entries are present beyond the cache capacity, despite
714714
// being evictable.
715715
constexpr size_t kCount = kCapacity - 1;
716-
std::unique_ptr<HandleImpl* []> ha { new HandleImpl* [kCount] {} };
716+
std::unique_ptr<HandleImpl*[]> ha{new HandleImpl* [kCount] {}};
717717
for (size_t i = 0; i < 2 * kCount; ++i) {
718718
UniqueId64x2 hkey = this->CheapHash(i);
719719
ASSERT_OK(shard.Insert(

cache/secondary_cache.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77

88
#include "cache/cache_entry_roles.h"
99

10-
namespace ROCKSDB_NAMESPACE {
11-
12-
} // namespace ROCKSDB_NAMESPACE
10+
namespace ROCKSDB_NAMESPACE {} // namespace ROCKSDB_NAMESPACE

db/blob/blob_source.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Status BlobSource::PutBlobIntoCache(
8282
assert(cached_blob->IsEmpty());
8383

8484
TypedHandle* cache_handle = nullptr;
85-
const Status s = InsertEntryIntoCache(cache_key, blob->get(),
86-
&cache_handle, Cache::Priority::BOTTOM);
85+
const Status s = InsertEntryIntoCache(cache_key, blob->get(), &cache_handle,
86+
Cache::Priority::BOTTOM);
8787
if (s.ok()) {
8888
blob->release();
8989

db/c.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct rocksdb_livefiles_t {
231231
};
232232
struct rocksdb_column_family_handle_t {
233233
ColumnFamilyHandle* rep;
234-
bool immortal; /* only true for default cf */
234+
bool immortal; /* only true for default cf */
235235
};
236236
struct rocksdb_column_family_metadata_t {
237237
ColumnFamilyMetaData rep;

db/compact_files_test.cc

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// COPYING file in the root directory) and Apache 2.0 License
44
// (found in the LICENSE.Apache file in the root directory).
55

6-
76
#include <mutex>
87
#include <string>
98
#include <thread>

db/compaction/compaction.h

-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,6 @@ class Compaction {
460460
void MarkFilesBeingCompacted(bool being_compacted) const;
461461

462462
private:
463-
464463
Status InitInputTableProperties();
465464

466465
// get the smallest and largest key present in files to be compacted

db/compaction/compaction_job.cc

+2-6
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,7 @@ Status CompactionJob::Install(const MutableCFOptions& mutable_cf_options,
959959
UpdateCompactionJobStats(stats);
960960

961961
auto stream = event_logger_->LogToBuffer(log_buffer_, 8192);
962-
stream << "job" << job_id_ << "event"
963-
<< "compaction_finished"
962+
stream << "job" << job_id_ << "event" << "compaction_finished"
964963
<< "compaction_time_micros" << stats.micros
965964
<< "compaction_time_cpu_micros" << stats.cpu_micros << "output_level"
966965
<< compact_->compaction->output_level() << "num_output_files"
@@ -1050,12 +1049,10 @@ void CompactionJob::NotifyOnSubcompactionBegin(
10501049
listener->OnSubcompactionBegin(info);
10511050
}
10521051
info.status.PermitUncheckedError();
1053-
10541052
}
10551053

10561054
void CompactionJob::NotifyOnSubcompactionCompleted(
10571055
SubcompactionState* sub_compact) {
1058-
10591056
if (db_options_.listeners.empty()) {
10601057
return;
10611058
}
@@ -2135,8 +2132,7 @@ void CompactionJob::LogCompaction() {
21352132
cfd->GetName().c_str(), scratch);
21362133
// build event logger report
21372134
auto stream = event_logger_->Log();
2138-
stream << "job" << job_id_ << "event"
2139-
<< "compaction_started"
2135+
stream << "job" << job_id_ << "event" << "compaction_started"
21402136
<< "compaction_reason"
21412137
<< GetCompactionReasonString(compaction->compaction_reason());
21422138
for (size_t i = 0; i < compaction->num_input_levels(); ++i) {

db/compaction/compaction_job_stats_test.cc

-1
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,6 @@ int main(int argc, char** argv) {
959959
return RUN_ALL_TESTS();
960960
}
961961

962-
963962
#else
964963

965964
int main(int /*argc*/, char** /*argv*/) { return 0; }

db/compaction/compaction_job_test.cc

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// COPYING file in the root directory) and Apache 2.0 License
44
// (found in the LICENSE.Apache file in the root directory).
55

6-
76
#include "db/compaction/compaction_job.h"
87

98
#include <algorithm>
@@ -1900,8 +1899,8 @@ TEST_F(CompactionJobTest, CutToSkipGrandparentFile) {
19001899
const std::vector<int> input_levels = {0, 1};
19011900
auto lvl0_files = cfd_->current()->storage_info()->LevelFiles(0);
19021901
auto lvl1_files = cfd_->current()->storage_info()->LevelFiles(1);
1903-
RunCompaction({lvl0_files, lvl1_files}, input_levels,
1904-
{expected_file1, expected_file2});
1902+
RunCompaction({lvl0_files, lvl1_files}, input_levels,
1903+
{expected_file1, expected_file2});
19051904
}
19061905

19071906
TEST_F(CompactionJobTest, CutToAlignGrandparentBoundary) {
@@ -1975,8 +1974,8 @@ TEST_F(CompactionJobTest, CutToAlignGrandparentBoundary) {
19751974
const std::vector<int> input_levels = {0, 1};
19761975
auto lvl0_files = cfd_->current()->storage_info()->LevelFiles(0);
19771976
auto lvl1_files = cfd_->current()->storage_info()->LevelFiles(1);
1978-
RunCompaction({lvl0_files, lvl1_files}, input_levels,
1979-
{expected_file1, expected_file2});
1977+
RunCompaction({lvl0_files, lvl1_files}, input_levels,
1978+
{expected_file1, expected_file2});
19801979
}
19811980

19821981
TEST_F(CompactionJobTest, CutToAlignGrandparentBoundarySameKey) {
@@ -2037,8 +2036,8 @@ TEST_F(CompactionJobTest, CutToAlignGrandparentBoundarySameKey) {
20372036
for (int i = 80; i <= 100; i++) {
20382037
snapshots.emplace_back(i);
20392038
}
2040-
RunCompaction({lvl0_files, lvl1_files}, input_levels,
2041-
{expected_file1, expected_file2}, snapshots);
2039+
RunCompaction({lvl0_files, lvl1_files}, input_levels,
2040+
{expected_file1, expected_file2}, snapshots);
20422041
}
20432042

20442043
TEST_F(CompactionJobTest, CutForMaxCompactionBytesSameKey) {

db/convenience.cc

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// (found in the LICENSE.Apache file in the root directory).
55
//
66

7-
87
#include "rocksdb/convenience.h"
98

109
#include "db/convenience_impl.h"

db/corruption_test.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
// Use of this source code is governed by a BSD-style license that can be
88
// found in the LICENSE file. See the AUTHORS file for names of contributors.
99

10-
#include "rocksdb/options.h"
11-
1210
#include <fcntl.h>
1311
#include <sys/stat.h>
1412
#include <sys/types.h>
@@ -25,6 +23,7 @@
2523
#include "rocksdb/convenience.h"
2624
#include "rocksdb/db.h"
2725
#include "rocksdb/env.h"
26+
#include "rocksdb/options.h"
2827
#include "rocksdb/table.h"
2928
#include "rocksdb/utilities/transaction_db.h"
3029
#include "rocksdb/write_batch.h"

db/cuckoo_table_db_test.cc

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// COPYING file in the root directory) and Apache 2.0 License
44
// (found in the LICENSE.Apache file in the root directory).
55

6-
76
#include "db/db_impl/db_impl.h"
87
#include "db/db_test_util.h"
98
#include "rocksdb/db.h"
@@ -349,4 +348,3 @@ int main(int argc, char** argv) {
349348
return 0;
350349
}
351350
}
352-

db/db_basic_test.cc

+1-3
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,6 @@ TEST_F(DBBasicTest, Snapshot) {
878878
} while (ChangeOptions());
879879
}
880880

881-
882881
class DBBasicMultiConfigs : public DBBasicTest,
883882
public ::testing::WithParamInterface<int> {
884883
public:
@@ -2604,8 +2603,7 @@ class DBMultiGetAsyncIOTest : public DBBasicTest,
26042603
// Warm up the block cache so we don't need to use the IO uring
26052604
Iterator* iter = dbfull()->NewIterator(ReadOptions());
26062605
for (iter->SeekToFirst(); iter->Valid() && iter->status().ok();
2607-
iter->Next())
2608-
;
2606+
iter->Next());
26092607
EXPECT_OK(iter->status());
26102608
delete iter;
26112609
#endif // ROCKSDB_IOURING_PRESENT

db/db_block_cache_test.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ class ReadOnlyCacheWrapper : public CacheWrapper {
305305
} // anonymous namespace
306306
#endif // SNAPPY
307307

308-
309308
// Make sure that when options.block_cache is set, after a new table is
310309
// created its index/filter blocks are added to block cache.
311310
TEST_F(DBBlockCacheTest, IndexAndFilterBlocksOfNewTableAddedToCache) {
@@ -1758,8 +1757,8 @@ class CacheKeyTest : public testing::Test {
17581757
tp_.db_id = std::to_string(db_id_);
17591758
tp_.orig_file_number = file_number;
17601759
bool is_stable;
1761-
std::string cur_session_id; // ignored
1762-
uint64_t cur_file_number = 42; // ignored
1760+
std::string cur_session_id; // ignored
1761+
uint64_t cur_file_number = 42; // ignored
17631762
OffsetableCacheKey rv;
17641763
BlockBasedTable::SetupBaseCacheKey(&tp_, cur_session_id, cur_file_number,
17651764
&rv, &is_stable);

db/db_dynamic_level_test.cc

-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,6 @@ TEST_F(DBTestDynamicLevel, DISABLED_MigrateToDynamicLevelMaxBytesBase) {
491491
}
492492
} // namespace ROCKSDB_NAMESPACE
493493

494-
495494
int main(int argc, char** argv) {
496495
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
497496
::testing::InitGoogleTest(&argc, argv);

db/db_encryption_test.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
// COPYING file in the root directory) and Apache 2.0 License
44
// (found in the LICENSE.Apache file in the root directory).
55
//
6+
#include <iostream>
7+
#include <string>
8+
69
#include "db/db_test_util.h"
710
#include "port/stack_trace.h"
811
#include "rocksdb/perf_context.h"
912
#include "test_util/sync_point.h"
10-
#include <iostream>
11-
#include <string>
1213

1314
namespace ROCKSDB_NAMESPACE {
1415

@@ -25,7 +26,6 @@ class DBEncryptionTest : public DBTestBase {
2526
}
2627
};
2728

28-
2929
TEST_F(DBEncryptionTest, CheckEncrypted) {
3030
ASSERT_OK(Put("foo567", "v1.fetdq"));
3131
ASSERT_OK(Put("bar123", "v2.dfgkjdfghsd"));
@@ -116,7 +116,6 @@ TEST_F(DBEncryptionTest, ReadEmptyFile) {
116116
ASSERT_TRUE(data.empty());
117117
}
118118

119-
120119
} // namespace ROCKSDB_NAMESPACE
121120

122121
int main(int argc, char** argv) {

db/db_filesnapshot.cc

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// (found in the LICENSE.Apache file in the root directory).
55
//
66

7-
87
#include <algorithm>
98
#include <cstdint>
109
#include <memory>

db/db_impl/db_impl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,8 @@ class DBImpl : public DB {
19211921
const InternalKey* begin = nullptr; // nullptr means beginning of key range
19221922
const InternalKey* end = nullptr; // nullptr means end of key range
19231923
InternalKey* manual_end = nullptr; // how far we are compacting
1924-
InternalKey tmp_storage; // Used to keep track of compaction progress
1925-
InternalKey tmp_storage1; // Used to keep track of compaction progress
1924+
InternalKey tmp_storage; // Used to keep track of compaction progress
1925+
InternalKey tmp_storage1; // Used to keep track of compaction progress
19261926

19271927
// When the user provides a canceled pointer in CompactRangeOptions, the
19281928
// above varaibe is the reference of the user-provided

db/db_impl/db_impl_compaction_flush.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -3866,8 +3866,7 @@ Status DBImpl::BackgroundCompaction(bool* made_progress,
38663866
moved_bytes);
38673867
{
38683868
event_logger_.LogToBuffer(log_buffer)
3869-
<< "job" << job_context->job_id << "event"
3870-
<< "trivial_move"
3869+
<< "job" << job_context->job_id << "event" << "trivial_move"
38713870
<< "destination_level" << c->output_level() << "files" << moved_files
38723871
<< "total_files_size" << moved_bytes;
38733872
}

db/db_impl/db_impl_open.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,7 @@ void DBImpl::SetupLogFilesRecovery(
11581158
{
11591159
auto stream = event_logger_.Log();
11601160
stream << "job" << *job_id;
1161-
stream << "event"
1162-
<< "recovery_started";
1161+
stream << "event" << "recovery_started";
11631162
stream << "wal_files";
11641163
stream.StartArray();
11651164
for (auto wal_number : wal_numbers) {

db/db_impl/db_impl_readonly.cc

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
namespace ROCKSDB_NAMESPACE {
1818

19-
2019
DBImplReadOnly::DBImplReadOnly(const DBOptions& db_options,
2120
const std::string& dbname)
2221
: DBImpl(db_options, dbname, /*seq_per_batch*/ false,
@@ -372,5 +371,4 @@ Status DBImplReadOnly::OpenForReadOnlyWithoutCheck(
372371
return s;
373372
}
374373

375-
376374
} // namespace ROCKSDB_NAMESPACE

db/db_impl/db_impl_readonly.h

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#pragma once
77

8-
98
#include <string>
109
#include <vector>
1110

db/db_impl/db_impl_secondary.cc

-1
Original file line numberDiff line numberDiff line change
@@ -1057,5 +1057,4 @@ Status DB::OpenAndCompact(
10571057
output, override_options);
10581058
}
10591059

1060-
10611060
} // namespace ROCKSDB_NAMESPACE

db/db_impl/db_impl_secondary.h

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#pragma once
77

8-
98
#include <string>
109
#include <vector>
1110

db/db_log_iter_test.cc

-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ TEST_F(DBTestXactLogIterator, TransactionLogIteratorBlobs) {
332332
}
333333
} // namespace ROCKSDB_NAMESPACE
334334

335-
336335
int main(int argc, char** argv) {
337336
ROCKSDB_NAMESPACE::port::InstallStackTraceHandler();
338337
::testing::InitGoogleTest(&argc, argv);

0 commit comments

Comments
 (0)