Apply formatter to recent 200+ commits. (#5830)

Summary:
Further apply formatter to more recent commits.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5830

Test Plan: Run all existing tests.

Differential Revision: D17488031

fbshipit-source-id: 137458fd94d56dd271b8b40c522b03036943a2ab
main
sdong 5 years ago committed by Facebook Github Bot
parent a5fa8735e9
commit e8263dbdaa
  1. 4
      cache/cache_bench.cc
  2. 6
      db/column_family.cc
  3. 2
      db/compaction/compaction_job.cc
  4. 2
      db/compaction/compaction_job_stats_test.cc
  5. 2
      db/compaction/compaction_job_test.cc
  6. 53
      db/db_basic_test.cc
  7. 3
      db/db_filesnapshot.cc
  8. 9
      db/db_impl/db_impl.cc
  9. 3
      db/db_impl/db_impl_compaction_flush.cc
  10. 7
      db/db_impl/db_impl_open.cc
  11. 3
      db/db_impl/db_impl_secondary.cc
  12. 7
      db/db_impl/db_secondary_test.cc
  13. 4
      db/db_info_dumper.cc
  14. 3
      db/db_test.cc
  15. 4
      db/db_test_util.cc
  16. 6
      db/db_universal_compaction_test.cc
  17. 2
      db/dbformat.cc
  18. 27
      db/external_sst_file_ingestion_job.cc
  19. 12
      db/import_column_family_job.cc
  20. 6
      db/import_column_family_job.h
  21. 4
      db/import_column_family_test.cc
  22. 2
      db/internal_stats.cc
  23. 5
      db/plain_table_db_test.cc
  24. 2
      db/range_tombstone_fragmenter.cc
  25. 38
      db/table_cache.cc
  26. 3
      db/table_cache.h
  27. 11
      db/version_builder.cc
  28. 3
      db/version_set.cc
  29. 12
      db/wal_manager.cc
  30. 4
      db/write_batch.cc
  31. 6
      env/env_test.cc
  32. 2
      examples/multi_processes_example.cc
  33. 2
      file/delete_scheduler_test.cc
  34. 3
      include/rocksdb/db.h
  35. 3
      include/rocksdb/utilities/stackable_db.h
  36. 5
      java/src/main/java/org/rocksdb/AdvancedColumnFamilyOptionsInterface.java
  37. 5
      java/src/main/java/org/rocksdb/AdvancedMutableColumnFamilyOptionsInterface.java
  38. 4
      java/src/main/java/org/rocksdb/ColumnFamilyOptionsInterface.java
  39. 1
      java/src/main/java/org/rocksdb/DBOptionsInterface.java
  40. 5
      java/src/main/java/org/rocksdb/MutableColumnFamilyOptionsInterface.java
  41. 1
      java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java
  42. 16
      java/src/test/java/org/rocksdb/util/EnvironmentTest.java
  43. 2
      logging/env_logger.h
  44. 6
      logging/env_logger_test.cc
  45. 2
      logging/event_logger.cc
  46. 4
      monitoring/histogram.cc
  47. 3
      monitoring/perf_context_imp.h
  48. 6
      monitoring/statistics.cc
  49. 4
      options/cf_options.cc
  50. 2
      options/options_test.cc
  51. 4
      port/jemalloc_helper.h
  52. 3
      port/win/env_win.cc
  53. 2
      table/block_based/block_based_table_factory.cc
  54. 54
      table/block_based/block_based_table_reader.cc
  55. 11
      table/block_based/full_filter_block.cc
  56. 3
      table/cuckoo/cuckoo_table_reader.h
  57. 4
      table/cuckoo/cuckoo_table_reader_test.cc
  58. 3
      table/mock_table.cc
  59. 12
      table/plain/plain_table_bloom.cc
  60. 2
      table/plain/plain_table_bloom.h
  61. 3
      table/plain/plain_table_reader.h
  62. 11
      table/table_reader.h
  63. 2
      test_util/transaction_test_util.cc
  64. 2
      tools/db_bench_tool.cc
  65. 2
      tools/db_stress.cc
  66. 39
      tools/trace_analyzer_tool.cc
  67. 2
      tools/write_stress.cc
  68. 14
      util/bloom_test.cc
  69. 9
      util/crc32c_arm64.cc
  70. 5
      util/dynamic_bloom.cc
  71. 14
      util/dynamic_bloom.h
  72. 14
      util/dynamic_bloom_test.cc
  73. 12
      util/hash_test.cc
  74. 2
      util/rate_limiter_test.cc
  75. 1
      util/threadpool_imp.cc
  76. 2
      utilities/backupable/backupable_db.cc
  77. 2
      utilities/blob_db/blob_file.cc
  78. 2
      utilities/checkpoint/checkpoint_impl.cc
  79. 3
      utilities/checkpoint/checkpoint_test.cc
  80. 2
      utilities/merge_operators/sortlist.cc
  81. 2
      utilities/persistent_cache/persistent_cache_tier.cc
  82. 4
      utilities/simulator_cache/sim_cache.cc
  83. 1
      utilities/transactions/optimistic_transaction_test.cc
  84. 3
      utilities/transactions/transaction_base.cc
  85. 2
      utilities/transactions/transaction_test.h
  86. 4
      utilities/transactions/write_prepared_transaction_test.cc
  87. 3
      utilities/transactions/write_unprepared_txn.cc
  88. 9
      utilities/ttl/ttl_test.cc
  89. 4
      utilities/write_batch_with_index/write_batch_with_index.cc
  90. 1
      utilities/write_batch_with_index/write_batch_with_index_test.cc

@ -11,9 +11,9 @@ int main() {
}
#else
#include <cinttypes>
#include <sys/types.h>
#include <stdio.h>
#include <sys/types.h>
#include <cinttypes>
#include "port/port.h"
#include "rocksdb/cache.h"

@ -9,11 +9,11 @@
#include "db/column_family.h"
#include <cinttypes>
#include <vector>
#include <string>
#include <algorithm>
#include <cinttypes>
#include <limits>
#include <string>
#include <vector>
#include "db/compaction/compaction_picker.h"
#include "db/compaction/compaction_picker_fifo.h"

@ -7,8 +7,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <functional>
#include <list>
#include <memory>

@ -7,8 +7,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <iostream>
#include <mutex>
#include <queue>

@ -5,9 +5,9 @@
#ifndef ROCKSDB_LITE
#include <cinttypes>
#include <algorithm>
#include <array>
#include <cinttypes>
#include <map>
#include <string>
#include <tuple>

@ -1356,9 +1356,9 @@ TEST_F(DBBasicTest, MultiGetBatchedMultiLevel) {
// Test class for batched MultiGet with prefix extractor
// Param bool - If true, use partitioned filters
// If false, use full filter block
class MultiGetPrefixExtractorTest
: public DBBasicTest,
public ::testing::WithParamInterface<bool> {};
class MultiGetPrefixExtractorTest : public DBBasicTest,
public ::testing::WithParamInterface<bool> {
};
TEST_P(MultiGetPrefixExtractorTest, Batched) {
Options options = CurrentOptions();
@ -1396,13 +1396,11 @@ TEST_P(MultiGetPrefixExtractorTest, Batched) {
ASSERT_EQ(get_perf_context()->bloom_sst_hit_count, 4);
}
INSTANTIATE_TEST_CASE_P(
MultiGetPrefix, MultiGetPrefixExtractorTest,
INSTANTIATE_TEST_CASE_P(MultiGetPrefix, MultiGetPrefixExtractorTest,
::testing::Bool());
#ifndef ROCKSDB_LITE
class DBMultiGetRowCacheTest
: public DBBasicTest,
class DBMultiGetRowCacheTest : public DBBasicTest,
public ::testing::WithParamInterface<bool> {};
TEST_P(DBMultiGetRowCacheTest, MultiGetBatched) {
@ -1545,8 +1543,7 @@ class DBBasicTestWithParallelIO
: public DBTestBase,
public testing::WithParamInterface<std::tuple<bool, bool, bool, bool>> {
public:
DBBasicTestWithParallelIO()
: DBTestBase("/db_basic_test_with_parallel_io") {
DBBasicTestWithParallelIO() : DBTestBase("/db_basic_test_with_parallel_io") {
bool compressed_cache = std::get<0>(GetParam());
bool uncompressed_cache = std::get<1>(GetParam());
compression_enabled_ = std::get<2>(GetParam());
@ -1598,15 +1595,9 @@ class DBBasicTestWithParallelIO
int num_found() { return uncompressed_cache_->num_found(); }
int num_inserts() { return uncompressed_cache_->num_inserts(); }
int num_lookups_compressed() {
return compressed_cache_->num_lookups();
}
int num_found_compressed() {
return compressed_cache_->num_found();
}
int num_inserts_compressed() {
return compressed_cache_->num_inserts();
}
int num_lookups_compressed() { return compressed_cache_->num_lookups(); }
int num_found_compressed() { return compressed_cache_->num_found(); }
int num_inserts_compressed() { return compressed_cache_->num_inserts(); }
bool fill_cache() { return fill_cache_; }
@ -1614,8 +1605,7 @@ class DBBasicTestWithParallelIO
static void TearDownTestCase() {}
private:
class MyFlushBlockPolicyFactory
: public FlushBlockPolicyFactory {
class MyFlushBlockPolicyFactory : public FlushBlockPolicyFactory {
public:
MyFlushBlockPolicyFactory() {}
@ -1630,8 +1620,7 @@ class DBBasicTestWithParallelIO
}
};
class MyFlushBlockPolicy
: public FlushBlockPolicy {
class MyFlushBlockPolicy : public FlushBlockPolicy {
public:
explicit MyFlushBlockPolicy(const BlockBuilder& data_block_builder)
: num_keys_(0), data_block_builder_(data_block_builder) {}
@ -1656,8 +1645,7 @@ class DBBasicTestWithParallelIO
const BlockBuilder& data_block_builder_;
};
class MyBlockCache
: public Cache {
class MyBlockCache : public Cache {
public:
explicit MyBlockCache(std::shared_ptr<Cache>& target)
: target_(target), num_lookups_(0), num_found_(0), num_inserts_(0) {}
@ -1682,9 +1670,7 @@ class DBBasicTestWithParallelIO
return handle;
}
virtual bool Ref(Handle* handle) override {
return target_->Ref(handle);
}
virtual bool Ref(Handle* handle) override { return target_->Ref(handle); }
virtual bool Release(Handle* handle, bool force_erase = false) override {
return target_->Release(handle, force_erase);
@ -1694,12 +1680,8 @@ class DBBasicTestWithParallelIO
return target_->Value(handle);
}
virtual void Erase(const Slice& key) override {
target_->Erase(key);
}
virtual uint64_t NewId() override {
return target_->NewId();
}
virtual void Erase(const Slice& key) override { target_->Erase(key); }
virtual uint64_t NewId() override { return target_->NewId(); }
virtual void SetCapacity(size_t capacity) override {
target_->SetCapacity(capacity);
@ -1717,9 +1699,7 @@ class DBBasicTestWithParallelIO
return target_->GetCapacity();
}
virtual size_t GetUsage() const override {
return target_->GetUsage();
}
virtual size_t GetUsage() const override { return target_->GetUsage(); }
virtual size_t GetUsage(Handle* handle) const override {
return target_->GetUsage(handle);
@ -1745,6 +1725,7 @@ class DBBasicTestWithParallelIO
int num_found() { return num_found_; }
int num_inserts() { return num_inserts_; }
private:
std::shared_ptr<Cache> target_;
int num_lookups_;

@ -6,9 +6,9 @@
#ifndef ROCKSDB_LITE
#include <cinttypes>
#include <stdint.h>
#include <algorithm>
#include <cinttypes>
#include <string>
#include "db/db_impl/db_impl.h"
#include "db/job_context.h"
@ -172,7 +172,6 @@ Status DBImpl::GetCurrentWalFile(std::unique_ptr<LogFile>* current_log_file) {
return wal_manager_.GetLiveWalFile(current_logfile_number, current_log_file);
}
}
#endif // ROCKSDB_LITE

@ -3286,8 +3286,7 @@ Status DestroyDB(const std::string& dbname, const Options& options,
if (type == kMetaDatabase) {
del = DestroyDB(path_to_delete, options);
} else if (type == kTableFile || type == kLogFile) {
del =
DeleteDBFile(&soptions, path_to_delete, dbname,
del = DeleteDBFile(&soptions, path_to_delete, dbname,
/*force_bg=*/false, /*force_fg=*/!wal_in_db_path);
} else {
del = env->DeleteFile(path_to_delete);
@ -4003,8 +4002,7 @@ Status DBImpl::IngestExternalFiles(
Status DBImpl::CreateColumnFamilyWithImport(
const ColumnFamilyOptions& options, const std::string& column_family_name,
const ImportColumnFamilyOptions& import_options,
const ExportImportFilesMetaData& metadata,
ColumnFamilyHandle** handle) {
const ExportImportFilesMetaData& metadata, ColumnFamilyHandle** handle) {
assert(handle != nullptr);
assert(*handle == nullptr);
std::string cf_comparator_name = options.comparator->Name();
@ -4045,8 +4043,7 @@ Status DBImpl::CreateColumnFamilyWithImport(
// reuse the file number that has already assigned to the internal file,
// and this will overwrite the external file. To protect the external
// file, we have to make sure the file number will never being reused.
next_file_number =
versions_->FetchAddFileNumber(metadata.files.size());
next_file_number = versions_->FetchAddFileNumber(metadata.files.size());
auto cf_options = cfd->GetLatestMutableCFOptions();
status = versions_->LogAndApply(cfd, *cf_options, &dummy_edit, &mutex_,
directories_.GetDbDir());

@ -1565,7 +1565,8 @@ Status DBImpl::FlushMemTable(ColumnFamilyData* cfd,
if (stats_cf_flush_needed) {
ROCKS_LOG_INFO(immutable_db_options_.info_log,
"Force flushing stats CF with manual flush of %s "
"to avoid holding old logs", cfd->GetName().c_str());
"to avoid holding old logs",
cfd->GetName().c_str());
s = SwitchMemtable(cfd_stats, &context);
flush_memtable_id = cfd_stats->imm()->GetLatestMemTableID();
flush_req.emplace_back(cfd_stats, flush_memtable_id);

@ -135,8 +135,8 @@ DBOptions SanitizeOptions(const std::string& dbname, const DBOptions& src) {
std::vector<std::string> filenames;
result.env->GetChildren(result.wal_dir, &filenames);
for (std::string& filename : filenames) {
if (filename.find(".log.trash",
filename.length() - std::string(".log.trash").length()) !=
if (filename.find(".log.trash", filename.length() -
std::string(".log.trash").length()) !=
std::string::npos) {
std::string trash_file = result.wal_dir + "/" + filename;
result.env->DeleteFile(trash_file);
@ -1352,8 +1352,7 @@ Status DBImpl::Open(const DBOptions& db_options, const std::string& dbname,
return s;
}
impl->wal_in_db_path_ =
IsWalDirSameAsDBPath(&impl->immutable_db_options_);
impl->wal_in_db_path_ = IsWalDirSameAsDBPath(&impl->immutable_db_options_);
impl->mutex_.Lock();
// Handles create_if_missing, error_if_exists

@ -588,8 +588,7 @@ Status DB::OpenAsSecondary(
&impl->write_controller_));
impl->column_family_memtables_.reset(
new ColumnFamilyMemTablesImpl(impl->versions_->GetColumnFamilySet()));
impl->wal_in_db_path_ =
IsWalDirSameAsDBPath(&impl->immutable_db_options_);
impl->wal_in_db_path_ = IsWalDirSameAsDBPath(&impl->immutable_db_options_);
impl->mutex_.Lock();
s = impl->Recover(column_families, true, false, false);

@ -605,8 +605,8 @@ TEST_F(DBSecondaryTest, SwitchWAL) {
TEST_F(DBSecondaryTest, SwitchWALMultiColumnFamilies) {
const int kNumKeysPerMemtable = 1;
SyncPoint::GetInstance()->DisableProcessing();
SyncPoint::GetInstance()->LoadDependency({
{"DBImpl::BackgroundCallFlush:ContextCleanedUp",
SyncPoint::GetInstance()->LoadDependency(
{{"DBImpl::BackgroundCallFlush:ContextCleanedUp",
"DBSecondaryTest::SwitchWALMultipleColumnFamilies:BeforeCatchUp"}});
SyncPoint::GetInstance()->EnableProcessing();
const std::string kCFName1 = "pikachu";
@ -662,7 +662,8 @@ TEST_F(DBSecondaryTest, SwitchWALMultiColumnFamilies) {
Put(0 /*cf*/, "key" + std::to_string(k), "value" + std::to_string(k)));
ASSERT_OK(
Put(1 /*cf*/, "key" + std::to_string(k), "value" + std::to_string(k)));
TEST_SYNC_POINT("DBSecondaryTest::SwitchWALMultipleColumnFamilies:BeforeCatchUp");
TEST_SYNC_POINT(
"DBSecondaryTest::SwitchWALMultipleColumnFamilies:BeforeCatchUp");
ASSERT_OK(db_secondary_->TryCatchUpWithPrimary());
verify_db(dbfull(), handles_, db_secondary_, handles_secondary_);
SyncPoint::GetInstance()->ClearTrace();

@ -5,10 +5,10 @@
#include "db/db_info_dumper.h"
#include <cinttypes>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cinttypes>
#include <string>
#include <vector>
#include "file/filename.h"

@ -2793,7 +2793,8 @@ class ModelDB : public DB {
return Status::OK();
}
Status GetCurrentWalFile(std::unique_ptr<LogFile>* /*current_log_file*/) override {
Status GetCurrentWalFile(
std::unique_ptr<LogFile>* /*current_log_file*/) override {
return Status::OK();
}

@ -48,9 +48,7 @@ ROT13BlockCipher rot13Cipher_(16);
#endif // ROCKSDB_LITE
DBTestBase::DBTestBase(const std::string path)
: mem_env_(nullptr),
encrypted_env_(nullptr),
option_config_(kDefault) {
: mem_env_(nullptr), encrypted_env_(nullptr), option_config_(kDefault) {
Env* base_env = Env::Default();
#ifndef ROCKSDB_LITE
const char* test_env_uri = getenv("TEST_ENV_URI");

@ -534,8 +534,10 @@ TEST_P(DBTestUniversalCompaction, DynamicUniversalCompactionReadAmplification) {
ASSERT_OK(dbfull()->TEST_GetLatestMutableCFOptions(handles_[1],
&mutable_cf_options));
ASSERT_EQ(mutable_cf_options.compaction_options_universal.size_ratio, 100u);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.min_merge_width, 2u);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.max_merge_width, 2u);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.min_merge_width,
2u);
ASSERT_EQ(mutable_cf_options.compaction_options_universal.max_merge_width,
2u);
dbfull()->TEST_WaitForCompact();

@ -8,8 +8,8 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include "db/dbformat.h"
#include <cinttypes>
#include <stdio.h>
#include <cinttypes>
#include "monitoring/perf_context_imp.h"
#include "port/port.h"
#include "util/coding.h"

@ -86,8 +86,7 @@ Status ExternalSstFileIngestionJob::Prepare(
return Status::InvalidArgument("File contain no entries");
}
if (!f.smallest_internal_key.Valid() ||
!f.largest_internal_key.Valid()) {
if (!f.smallest_internal_key.Valid() || !f.largest_internal_key.Valid()) {
return Status::Corruption("Generated table have corrupted keys");
}
}
@ -448,8 +447,10 @@ Status ExternalSstFileIngestionJob::GetIngestedFileInfo(
table_reader->NewRangeTombstoneIterator(ro));
// Get first (smallest) and last (largest) key from file.
file_to_ingest->smallest_internal_key = InternalKey("", 0, ValueType::kTypeValue);
file_to_ingest->largest_internal_key = InternalKey("", 0, ValueType::kTypeValue);
file_to_ingest->smallest_internal_key =
InternalKey("", 0, ValueType::kTypeValue);
file_to_ingest->largest_internal_key =
InternalKey("", 0, ValueType::kTypeValue);
bool bounds_set = false;
iter->SeekToFirst();
if (iter->Valid()) {
@ -485,11 +486,15 @@ Status ExternalSstFileIngestionJob::GetIngestedFileInfo(
RangeTombstone tombstone(key, range_del_iter->value());
InternalKey start_key = tombstone.SerializeKey();
if (!bounds_set || sstableKeyCompare(ucmp, start_key, file_to_ingest->smallest_internal_key) < 0) {
if (!bounds_set ||
sstableKeyCompare(ucmp, start_key,
file_to_ingest->smallest_internal_key) < 0) {
file_to_ingest->smallest_internal_key = start_key;
}
InternalKey end_key = tombstone.SerializeEndKey();
if (!bounds_set || sstableKeyCompare(ucmp, end_key, file_to_ingest->largest_internal_key) > 0) {
if (!bounds_set ||
sstableKeyCompare(ucmp, end_key,
file_to_ingest->largest_internal_key) > 0) {
file_to_ingest->largest_internal_key = end_key;
}
bounds_set = true;
@ -531,9 +536,10 @@ Status ExternalSstFileIngestionJob::AssignLevelAndSeqnoForIngestedFile(
if (vstorage->NumLevelFiles(lvl) > 0) {
bool overlap_with_level = false;
status = sv->current->OverlapWithLevelIterator(ro, env_options_,
file_to_ingest->smallest_internal_key.user_key(), file_to_ingest->largest_internal_key.user_key(),
lvl, &overlap_with_level);
status = sv->current->OverlapWithLevelIterator(
ro, env_options_, file_to_ingest->smallest_internal_key.user_key(),
file_to_ingest->largest_internal_key.user_key(), lvl,
&overlap_with_level);
if (!status.ok()) {
return status;
}
@ -672,7 +678,8 @@ bool ExternalSstFileIngestionJob::IngestedFileFitInLevel(
}
auto* vstorage = cfd_->current()->storage_info();
Slice file_smallest_user_key(file_to_ingest->smallest_internal_key.user_key());
Slice file_smallest_user_key(
file_to_ingest->smallest_internal_key.user_key());
Slice file_largest_user_key(file_to_ingest->largest_internal_key.user_key());
if (vstorage->OverlapInLevel(level, &file_smallest_user_key,

@ -2,8 +2,8 @@
#include "db/import_column_family_job.h"
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <string>
#include <vector>
@ -64,7 +64,8 @@ Status ImportColumnFamilyJob::Prepare(uint64_t next_file_number,
for (size_t i = 0; i < sorted_files.size() - 1; i++) {
if (sstableKeyCompare(ucmp, sorted_files[i]->largest_internal_key,
sorted_files[i + 1]->smallest_internal_key) >= 0) {
sorted_files[i + 1]->smallest_internal_key) >=
0) {
return Status::InvalidArgument("Files have overlapping ranges");
}
}
@ -76,8 +77,7 @@ Status ImportColumnFamilyJob::Prepare(uint64_t next_file_number,
return Status::InvalidArgument("File contain no entries");
}
if (!f.smallest_internal_key.Valid() ||
!f.largest_internal_key.Valid()) {
if (!f.smallest_internal_key.Valid() || !f.largest_internal_key.Valid()) {
return Status::Corruption("File has corrupted keys");
}
}
@ -198,8 +198,8 @@ Status ImportColumnFamilyJob::GetIngestedFileInfo(
if (!status.ok()) {
return status;
}
sst_file_reader.reset(new RandomAccessFileReader(std::move(sst_file),
external_file));
sst_file_reader.reset(
new RandomAccessFileReader(std::move(sst_file), external_file));
status = cfd_->ioptions()->table_factory->NewTableReader(
TableReaderOptions(*cfd_->ioptions(),

@ -20,9 +20,9 @@ namespace rocksdb {
// to ExternalSstFileIngestionJob.
class ImportColumnFamilyJob {
public:
ImportColumnFamilyJob(
Env* env, VersionSet* versions, ColumnFamilyData* cfd,
const ImmutableDBOptions& db_options, const EnvOptions& env_options,
ImportColumnFamilyJob(Env* env, VersionSet* versions, ColumnFamilyData* cfd,
const ImmutableDBOptions& db_options,
const EnvOptions& env_options,
const ImportColumnFamilyOptions& import_options,
const std::vector<LiveFileMetaData>& metadata)
: env_(env),

@ -45,8 +45,7 @@ class ImportColumnFamilyTest : public DBTestBase {
test::DestroyDir(env_, export_files_dir_);
}
LiveFileMetaData LiveFileMetaDataInit(std::string name,
std::string path,
LiveFileMetaData LiveFileMetaDataInit(std::string name, std::string path,
int level,
SequenceNumber smallest_seqno,
SequenceNumber largest_seqno) {
@ -545,7 +544,6 @@ TEST_F(ImportColumnFamilyTest, ImportColumnFamilyNegativeTest) {
metadata, &import_cfh_));
ASSERT_NE(import_cfh_, nullptr);
}
}
} // namespace rocksdb

@ -10,8 +10,8 @@
#include "db/internal_stats.h"
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <limits>
#include <string>
#include <utility>

@ -754,11 +754,10 @@ TEST_P(PlainTableDBTest, BloomSchema) {
plain_table_options.huge_page_tlb_size = 0;
plain_table_options.encoding_type = kPlain;
bool expect_bloom_not_match = false;
options.table_factory.reset(new TestPlainTableFactory(
&expect_bloom_not_match, plain_table_options,
0 /* column_family_id */, kDefaultColumnFamilyName));
&expect_bloom_not_match, plain_table_options, 0 /* column_family_id */,
kDefaultColumnFamilyName));
DestroyAndReopen(&options);
for (unsigned i = 0; i < 2345; ++i) {

@ -9,8 +9,8 @@
#include <functional>
#include <set>
#include <cinttypes>
#include <stdio.h>
#include <cinttypes>
#include "util/autovector.h"
#include "util/kv_map.h"

@ -277,10 +277,11 @@ Status TableCache::GetRangeTombstoneIterator(
}
#ifndef ROCKSDB_LITE
void TableCache::CreateRowCacheKeyPrefix(
const ReadOptions& options,
const FileDescriptor& fd, const Slice& internal_key,
GetContext* get_context, IterKey& row_cache_key) {
void TableCache::CreateRowCacheKeyPrefix(const ReadOptions& options,
const FileDescriptor& fd,
const Slice& internal_key,
GetContext* get_context,
IterKey& row_cache_key) {
uint64_t fd_number = fd.GetNumber();
// We use the user key as cache key instead of the internal key,
// otherwise the whole cache would be invalidated every time the
@ -312,13 +313,11 @@ void TableCache::CreateRowCacheKeyPrefix(
AppendVarint64(&row_cache_key, seq_no);
}
bool TableCache::GetFromRowCache(
const Slice& user_key, IterKey& row_cache_key,
bool TableCache::GetFromRowCache(const Slice& user_key, IterKey& row_cache_key,
size_t prefix_size, GetContext* get_context) {
bool found = false;
row_cache_key.TrimAppend(prefix_size, user_key.data(),
user_key.size());
row_cache_key.TrimAppend(prefix_size, user_key.data(), user_key.size());
if (auto row_handle =
ioptions_.row_cache->Lookup(row_cache_key.GetUserKey())) {
// Cleanable routine to release the cache entry
@ -327,8 +326,8 @@ bool TableCache::GetFromRowCache(
void* cache_handle) {
((Cache*)cache_to_clean)->Release((Cache::Handle*)cache_handle);
};
auto found_row_cache_entry = static_cast<const std::string*>(
ioptions_.row_cache->Value(row_handle));
auto found_row_cache_entry =
static_cast<const std::string*>(ioptions_.row_cache->Value(row_handle));
// If it comes here value is located on the cache.
// found_row_cache_entry points to the value on cache,
// and value_pinner has cleanup procedure for the cached entry.
@ -442,14 +441,15 @@ Status TableCache::MultiGet(const ReadOptions& options,
Status s;
TableReader* t = fd.table_reader;
Cache::Handle* handle = nullptr;
MultiGetRange table_range(*mget_range, mget_range->begin(), mget_range->end());
MultiGetRange table_range(*mget_range, mget_range->begin(),
mget_range->end());
#ifndef ROCKSDB_LITE
autovector<std::string, MultiGetContext::MAX_BATCH_SIZE> row_cache_entries;
IterKey row_cache_key;
size_t row_cache_key_prefix_size = 0;
KeyContext& first_key = *table_range.begin();
bool lookup_row_cache = ioptions_.row_cache &&
!first_key.get_context->NeedToReadSequence();
bool lookup_row_cache =
ioptions_.row_cache && !first_key.get_context->NeedToReadSequence();
// Check row cache if enabled. Since row cache does not currently store
// sequence numbers, we cannot use it if we need to fetch the sequence.
@ -459,8 +459,10 @@ Status TableCache::MultiGet(const ReadOptions& options,
row_cache_key);
row_cache_key_prefix_size = row_cache_key.Size();
for (auto miter = table_range.begin(); miter != table_range.end(); ++miter) {
const Slice& user_key = miter->ukey;;
for (auto miter = table_range.begin(); miter != table_range.end();
++miter) {
const Slice& user_key = miter->ukey;
;
GetContext* get_context = miter->get_context;
if (GetFromRowCache(user_key, row_cache_key, row_cache_key_prefix_size,
@ -519,9 +521,11 @@ Status TableCache::MultiGet(const ReadOptions& options,
if (lookup_row_cache) {
size_t row_idx = 0;
for (auto miter = table_range.begin(); miter != table_range.end(); ++miter) {
for (auto miter = table_range.begin(); miter != table_range.end();
++miter) {
std::string& row_cache_entry = row_cache_entries[row_idx++];
const Slice& user_key = miter->ukey;;
const Slice& user_key = miter->ukey;
;
GetContext* get_context = miter->get_context;
get_context->SetReplayLog(nullptr);

@ -208,8 +208,7 @@ class TableCache {
void CreateRowCacheKeyPrefix(const ReadOptions& options,
const FileDescriptor& fd,
const Slice& internal_key,
GetContext* get_context,
IterKey& row_cache_key);
GetContext* get_context, IterKey& row_cache_key);
// Helper function to lookup the row cache for a key. It appends the
// user key to row_cache_key at offset prefix_size

@ -9,9 +9,9 @@
#include "db/version_builder.h"
#include <cinttypes>
#include <algorithm>
#include <atomic>
#include <cinttypes>
#include <functional>
#include <map>
#include <set>
@ -173,13 +173,12 @@ class VersionBuilder::Rep {
" vs. file with global_seqno %" PRIu64 "\n",
f1->fd.smallest_seqno, f1->fd.largest_seqno,
external_file_seqno);
return Status::Corruption("L0 file with seqno " +
NumberToString(f1->fd.smallest_seqno) +
" " +
return Status::Corruption(
"L0 file with seqno " +
NumberToString(f1->fd.smallest_seqno) + " " +
NumberToString(f1->fd.largest_seqno) +
" vs. file with global_seqno" +
NumberToString(external_file_seqno) +
" with fileNumber " +
NumberToString(external_file_seqno) + " with fileNumber " +
NumberToString(f1->fd.GetNumber()));
}
} else if (f1->fd.smallest_seqno <= f2->fd.smallest_seqno) {

@ -5727,7 +5727,8 @@ Status ReactiveVersionSet::ApplyOneVersionEditToBuilder(
return Status::OK();
}
if (active_version_builders_.find(edit.column_family_) ==
active_version_builders_.end() && !cfd->IsDropped()) {
active_version_builders_.end() &&
!cfd->IsDropped()) {
std::unique_ptr<BaseReferencedVersionBuilder> builder_guard(
new BaseReferencedVersionBuilder(cfd));
active_version_builders_.insert(

@ -9,10 +9,10 @@
#include "db/wal_manager.h"
#include <cinttypes>
#include <algorithm>
#include <vector>
#include <cinttypes>
#include <memory>
#include <vector>
#include "db/log_reader.h"
#include "db/log_writer.h"
@ -415,7 +415,8 @@ Status WalManager::ReadFirstRecord(const WalFileType type,
return s;
}
Status WalManager::GetLiveWalFile(uint64_t number, std::unique_ptr<LogFile>* log_file) {
Status WalManager::GetLiveWalFile(uint64_t number,
std::unique_ptr<LogFile>* log_file) {
if (!log_file) {
return Status::InvalidArgument("log_file not preallocated.");
}
@ -433,16 +434,13 @@ Status WalManager::GetLiveWalFile(uint64_t number, std::unique_ptr<LogFile>* log
return s;
}
log_file->reset(new LogFileImpl(
number,
kAliveLogFile,
log_file->reset(new LogFileImpl(number, kAliveLogFile,
0, // SequenceNumber
size_bytes));
return Status::OK();
}
// the function returns status.ok() and sequence == 0 if the file exists, but is
// empty
Status WalManager::ReadFirstLine(const std::string& fname,

@ -334,9 +334,7 @@ void WriteBatch::Clear() {
wal_term_point_.clear();
}
uint32_t WriteBatch::Count() const {
return WriteBatchInternal::Count(this);
}
uint32_t WriteBatch::Count() const { return WriteBatchInternal::Count(this); }
uint32_t WriteBatch::ComputeContentFlags() const {
auto rv = content_flags_.load(std::memory_order_relaxed);

6
env/env_test.cc vendored

@ -1110,7 +1110,8 @@ TEST_P(EnvPosixTestWithParam, MultiRead) {
// Create file.
{
std::unique_ptr<WritableFile> wfile;
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX)
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
!defined(OS_AIX)
if (soptions.use_direct_writes) {
soptions.use_direct_writes = false;
}
@ -1137,7 +1138,8 @@ TEST_P(EnvPosixTestWithParam, MultiRead) {
data.emplace_back(NewAligned(kSectorSize, 0));
reqs[i].scratch = data.back().get();
}
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && !defined(OS_AIX)
#if !defined(OS_MACOSX) && !defined(OS_WIN) && !defined(OS_SOLARIS) && \
!defined(OS_AIX)
if (soptions.use_direct_reads) {
soptions.use_direct_reads = false;
}

@ -14,8 +14,8 @@
// run for a while, tailing the logs of the primary. After process with primary
// instance exits, this process will keep running until you hit 'CTRL+C'.
#include <cinttypes>
#include <chrono>
#include <cinttypes>
#include <cstdio>
#include <cstdlib>
#include <ctime>

@ -3,8 +3,8 @@
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#include <cinttypes>
#include <atomic>
#include <cinttypes>
#include <thread>
#include <vector>

@ -1137,7 +1137,8 @@ class DB {
//
// Additionally, for the sake of optimization current_log_file->StartSequence
// would always be set to 0
virtual Status GetCurrentWalFile(std::unique_ptr<LogFile>* current_log_file) = 0;
virtual Status GetCurrentWalFile(
std::unique_ptr<LogFile>* current_log_file) = 0;
// Note: this API is not yet consistent with WritePrepared transactions.
// Sets iter to an iterator that is positioned at a write-batch containing

@ -378,7 +378,8 @@ class StackableDB : public DB {
return db_->GetSortedWalFiles(files);
}
virtual Status GetCurrentWalFile(std::unique_ptr<LogFile>* current_log_file) override {
virtual Status GetCurrentWalFile(
std::unique_ptr<LogFile>* current_log_file) override {
return db_->GetCurrentWalFile(current_log_file);
}

@ -13,9 +13,8 @@ import java.util.List;
*
* Taken from include/rocksdb/advanced_options.h
*/
public interface AdvancedColumnFamilyOptionsInterface
<T extends AdvancedColumnFamilyOptionsInterface<T>> {
public interface AdvancedColumnFamilyOptionsInterface<
T extends AdvancedColumnFamilyOptionsInterface<T>> {
/**
* The minimum number of write buffers that will be merged together
* before writing to storage. If set to 1, then

@ -11,9 +11,8 @@ package org.rocksdb;
* Taken from include/rocksdb/advanced_options.h
* and MutableCFOptions in util/cf_options.h
*/
public interface AdvancedMutableColumnFamilyOptionsInterface
<T extends AdvancedMutableColumnFamilyOptionsInterface<T>> {
public interface AdvancedMutableColumnFamilyOptionsInterface<
T extends AdvancedMutableColumnFamilyOptionsInterface<T>> {
/**
* The maximum number of write buffers that are built up in memory.
* The default is 2, so that when 1 write buffer is being flushed to

@ -5,10 +5,8 @@
package org.rocksdb;
public interface ColumnFamilyOptionsInterface
<T extends ColumnFamilyOptionsInterface<T>>
public interface ColumnFamilyOptionsInterface<T extends ColumnFamilyOptionsInterface<T>>
extends AdvancedColumnFamilyOptionsInterface<T> {
/**
* Use this if your DB is very small (like under 1GB) and you don't want to
* spend lots of memory for memtables.

@ -9,7 +9,6 @@ import java.util.Collection;
import java.util.List;
public interface DBOptionsInterface<T extends DBOptionsInterface<T>> {
/**
* Use this if your DB is very small (like under 1GB) and you don't want to
* spend lots of memory for memtables.

@ -5,10 +5,9 @@
package org.rocksdb;
public interface MutableColumnFamilyOptionsInterface
<T extends MutableColumnFamilyOptionsInterface<T>>
public interface MutableColumnFamilyOptionsInterface<
T extends MutableColumnFamilyOptionsInterface<T>>
extends AdvancedMutableColumnFamilyOptionsInterface<T> {
/**
* Amount of data to build up in memory (backed by an unsorted log
* on disk) before converting to a sorted on-disk file.

@ -2,7 +2,6 @@
package org.rocksdb;
public interface MutableDBOptionsInterface<T extends MutableDBOptionsInterface<T>> {
/**
* Specifies the maximum number of concurrent background jobs (both flushes
* and compactions combined).

@ -136,16 +136,12 @@ public class EnvironmentTest {
assertThat(Environment.isUnix()).isTrue();
assertThat(Environment.isAarch64()).isTrue();
assertThat(Environment.is64Bit()).isTrue();
assertThat(Environment.getJniLibraryExtension()).
isEqualTo(".so");
assertThat(Environment.getSharedLibraryName("rocksdb")).
isEqualTo("rocksdbjni");
assertThat(Environment.getJniLibraryName("rocksdb")).
isEqualTo("rocksdbjni-linux-aarch64");
assertThat(Environment.getJniLibraryFileName("rocksdb")).
isEqualTo("librocksdbjni-linux-aarch64.so");
assertThat(Environment.getSharedLibraryFileName("rocksdb")).
isEqualTo("librocksdbjni.so");
assertThat(Environment.getJniLibraryExtension()).isEqualTo(".so");
assertThat(Environment.getSharedLibraryName("rocksdb")).isEqualTo("rocksdbjni");
assertThat(Environment.getJniLibraryName("rocksdb")).isEqualTo("rocksdbjni-linux-aarch64");
assertThat(Environment.getJniLibraryFileName("rocksdb"))
.isEqualTo("librocksdbjni-linux-aarch64.so");
assertThat(Environment.getSharedLibraryFileName("rocksdb")).isEqualTo("librocksdbjni.so");
}
private void setEnvironmentClassFields(String osName,

@ -11,10 +11,10 @@
#pragma once
#include <time.h>
#include <atomic>
#include <memory>
#include "port/sys_time.h"
#include <time.h>
#include "file/writable_file_writer.h"
#include "monitoring/iostats_context_imp.h"

@ -4,8 +4,8 @@
// (found in the LICENSE.Apache file in the root directory).
//
#include "env/mock_env.h"
#include "logging/env_logger.h"
#include "env/mock_env.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
@ -44,9 +44,7 @@ class EnvLoggerTest : public testing::Test {
return result;
}
void DeleteLogFile() {
ASSERT_OK(env_->DeleteFile(kLogFile));
}
void DeleteLogFile() { ASSERT_OK(env_->DeleteFile(kLogFile)); }
static const std::string kSampleMessage;
static const std::string kTestDir;

@ -5,8 +5,8 @@
#include "logging/event_logger.h"
#include <cinttypes>
#include <cassert>
#include <cinttypes>
#include <sstream>
#include <string>

@ -9,10 +9,10 @@
#include "monitoring/histogram.h"
#include <cinttypes>
#include <cassert>
#include <math.h>
#include <stdio.h>
#include <cassert>
#include <cinttypes>
#include "port/port.h"
#include "util/cast_util.h"

@ -27,7 +27,8 @@ extern thread_local PerfContext perf_context;
#define PERF_TIMER_GUARD(metric)
#define PERF_TIMER_GUARD_WITH_ENV(metric, env)
#define PERF_CPU_TIMER_GUARD(metric, env)
#define PERF_CONDITIONAL_TIMER_FOR_MUTEX_GUARD(metric, condition, stats, ticker_type)
#define PERF_CONDITIONAL_TIMER_FOR_MUTEX_GUARD(metric, condition, stats, \
ticker_type)
#define PERF_TIMER_MEASURE(metric)
#define PERF_COUNTER_ADD(metric, value)
#define PERF_COUNTER_BY_LEVEL_ADD(metric, value, level)

@ -5,11 +5,11 @@
//
#include "monitoring/statistics.h"
#include <cinttypes>
#include "rocksdb/statistics.h"
#include "port/likely.h"
#include <algorithm>
#include <cinttypes>
#include <cstdio>
#include "port/likely.h"
#include "rocksdb/statistics.h"
namespace rocksdb {

@ -5,15 +5,15 @@
#include "options/cf_options.h"
#include <cinttypes>
#include <cassert>
#include <cinttypes>
#include <limits>
#include <string>
#include "options/db_options.h"
#include "port/port.h"
#include "rocksdb/concurrent_task_limiter.h"
#include "rocksdb/env.h"
#include "rocksdb/options.h"
#include "rocksdb/concurrent_task_limiter.h"
namespace rocksdb {

@ -8,9 +8,9 @@
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <cctype>
#include <cinttypes>
#include <cstring>
#include <unordered_map>
#include <cinttypes>
#include "cache/lru_cache.h"
#include "cache/sharded_cache.h"

@ -32,8 +32,8 @@
#if defined(OS_WIN) && defined(_MSC_VER)
// MSVC does not have weak symbol support. As long as ROCKSDB_JEMALLOC is defined,
// Jemalloc memory allocator is used.
// MSVC does not have weak symbol support. As long as ROCKSDB_JEMALLOC is
// defined, Jemalloc memory allocator is used.
static inline bool HasJemalloc() { return true; }
#else

@ -979,7 +979,8 @@ uint64_t WinEnvIO::NowMicros() {
return li.QuadPart;
}
using namespace std::chrono;
return duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
return duration_cast<microseconds>(system_clock::now().time_since_epoch())
.count();
}
uint64_t WinEnvIO::NowNanos() {

@ -7,8 +7,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include <cinttypes>
#include <stdint.h>
#include <cinttypes>
#include <memory>
#include <string>

@ -2019,8 +2019,9 @@ IndexBlockIter* BlockBasedTable::InitBlockIterator<IndexBlockIter>(
// If input_iter is null, new a iterator
// If input_iter is not null, update this iter and return it
template <typename TBlockIter>
TBlockIter* BlockBasedTable::NewDataBlockIterator(
const ReadOptions& ro, CachableEntry<Block>& block, TBlockIter* input_iter,
TBlockIter* BlockBasedTable::NewDataBlockIterator(const ReadOptions& ro,
CachableEntry<Block>& block,
TBlockIter* input_iter,
Status s) const {
PERF_TIMER_GUARD(new_table_block_iter_nanos);
@ -2167,11 +2168,10 @@ Status BlockBasedTable::MaybeReadBlockAndLoadToCache(
SequenceNumber seq_no = rep_->get_global_seqno(block_type);
// If filling cache is allowed and a cache is configured, try to put the
// block to the cache.
s = PutDataBlockToCache(key, ckey, block_cache, block_cache_compressed,
block_entry, contents,
raw_block_comp_type, uncompression_dict, seq_no,
GetMemoryAllocator(rep_->table_options),
block_type, get_context);
s = PutDataBlockToCache(
key, ckey, block_cache, block_cache_compressed, block_entry,
contents, raw_block_comp_type, uncompression_dict, seq_no,
GetMemoryAllocator(rep_->table_options), block_type, get_context);
}
}
}
@ -2344,12 +2344,10 @@ void BlockBasedTable::RetrieveMultipleBlocks(
// BlockContents so it can free the memory
assert(req.result.data() == req.scratch);
std::unique_ptr<char[]> raw_block(req.scratch);
raw_block_contents = BlockContents(std::move(raw_block),
handle.size());
raw_block_contents = BlockContents(std::move(raw_block), handle.size());
} else {
// We used the scratch buffer, so no need to free anything
raw_block_contents = BlockContents(Slice(req.scratch,
handle.size()));
raw_block_contents = BlockContents(Slice(req.scratch, handle.size()));
}
#ifndef NDEBUG
raw_block_contents.is_raw_block = true;
@ -2370,10 +2368,10 @@ void BlockBasedTable::RetrieveMultipleBlocks(
// MaybeReadBlockAndLoadToCache will insert into the block caches if
// necessary. Since we're passing the raw block contents, it will
// avoid looking up the block cache
s = MaybeReadBlockAndLoadToCache(nullptr, options, handle,
uncompression_dict, block_entry, BlockType::kData,
mget_iter->get_context, &lookup_data_block_context,
&raw_block_contents);
s = MaybeReadBlockAndLoadToCache(
nullptr, options, handle, uncompression_dict, block_entry,
BlockType::kData, mget_iter->get_context,
&lookup_data_block_context, &raw_block_contents);
} else {
CompressionType compression_type =
raw_block_contents.get_compression_type();
@ -2382,23 +2380,24 @@ void BlockBasedTable::RetrieveMultipleBlocks(
UncompressionContext context(compression_type);
UncompressionInfo info(context, uncompression_dict, compression_type);
s = UncompressBlockContents(info, req.result.data(), handle.size(),
&contents, footer.version(), rep_->ioptions,
memory_allocator);
&contents, footer.version(),
rep_->ioptions, memory_allocator);
} else {
if (scratch != nullptr) {
// If we used the scratch buffer, then the contents need to be
// copied to heap
Slice raw = Slice(req.result.data(), handle.size());
contents = BlockContents(CopyBufferToHeap(
GetMemoryAllocator(rep_->table_options), raw),
contents = BlockContents(
CopyBufferToHeap(GetMemoryAllocator(rep_->table_options), raw),
handle.size());
} else {
contents = std::move(raw_block_contents);
}
}
if (s.ok()) {
(*results)[idx_in_batch].SetOwnedValue(new Block(std::move(contents),
global_seqno, read_amp_bytes_per_bit, ioptions.statistics));
(*results)[idx_in_batch].SetOwnedValue(
new Block(std::move(contents), global_seqno,
read_amp_bytes_per_bit, ioptions.statistics));
}
}
}
@ -3036,7 +3035,8 @@ void BlockBasedTableIterator<TBlockIter, TValue>::CheckOutOfBound() {
}
template <class TBlockIter, typename TValue>
void BlockBasedTableIterator<TBlockIter, TValue>::CheckDataBlockWithinUpperBound() {
void BlockBasedTableIterator<TBlockIter,
TValue>::CheckDataBlockWithinUpperBound() {
if (read_options_.iterate_upper_bound != nullptr &&
block_iter_points_to_real_block_) {
data_block_within_upper_bound_ =
@ -3047,7 +3047,8 @@ void BlockBasedTableIterator<TBlockIter, TValue>::CheckDataBlockWithinUpperBound
InternalIterator* BlockBasedTable::NewIterator(
const ReadOptions& read_options, const SliceTransform* prefix_extractor,
Arena* arena, bool skip_filters, TableReaderCaller caller, size_t compaction_readahead_size) {
Arena* arena, bool skip_filters, TableReaderCaller caller,
size_t compaction_readahead_size) {
BlockCacheLookupContext lookup_context{caller};
bool need_upper_bound_check =
PrefixExtractorChanged(rep_->table_properties.get(), prefix_extractor);
@ -3068,10 +3069,11 @@ InternalIterator* BlockBasedTable::NewIterator(
arena->AllocateAligned(sizeof(BlockBasedTableIterator<DataBlockIter>));
return new (mem) BlockBasedTableIterator<DataBlockIter>(
this, read_options, rep_->internal_comparator,
NewIndexIterator(read_options, need_upper_bound_check &&
NewIndexIterator(
read_options,
need_upper_bound_check &&
rep_->index_type == BlockBasedTableOptions::kHashSearch,
/*input_iter=*/nullptr, /*get_context=*/nullptr,
&lookup_context),
/*input_iter=*/nullptr, /*get_context=*/nullptr, &lookup_context),
!skip_filters && !read_options.total_order_seek &&
prefix_extractor != nullptr,
need_upper_bound_check, prefix_extractor, BlockType::kData, caller,

@ -3,8 +3,8 @@
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#include <array>
#include "table/block_based/full_filter_block.h"
#include <array>
#include "monitoring/perf_context_imp.h"
#include "port/malloc.h"
@ -218,8 +218,7 @@ void FullFilterBlockReader::PrefixesMayMatch(
}
void FullFilterBlockReader::MayMatch(
MultiGetRange* range, bool no_io,
const SliceTransform* prefix_extractor,
MultiGetRange* range, bool no_io, const SliceTransform* prefix_extractor,
BlockCacheLookupContext* lookup_context) const {
CachableEntry<BlockContents> filter_block;
@ -252,8 +251,7 @@ void FullFilterBlockReader::MayMatch(
autovector<Slice, MultiGetContext::MAX_BATCH_SIZE> prefixes;
int num_keys = 0;
MultiGetRange filter_range(*range, range->begin(), range->end());
for (auto iter = filter_range.begin();
iter != filter_range.end(); ++iter) {
for (auto iter = filter_range.begin(); iter != filter_range.end(); ++iter) {
if (!prefix_extractor) {
keys[num_keys++] = &iter->ukey;
} else if (prefix_extractor->InDomain(iter->ukey)) {
@ -266,8 +264,7 @@ void FullFilterBlockReader::MayMatch(
filter_bits_reader->MayMatch(num_keys, &keys[0], &may_match[0]);
int i = 0;
for (auto iter = filter_range.begin();
iter != filter_range.end(); ++iter) {
for (auto iter = filter_range.begin(); iter != filter_range.end(); ++iter) {
if (!may_match[i]) {
// Update original MultiGet range to skip this key. The filter_range
// was temporarily used just to skip keys not in prefix_extractor domain

@ -51,7 +51,8 @@ class CuckooTableReader: public TableReader {
InternalIterator* NewIterator(const ReadOptions&,
const SliceTransform* prefix_extractor,
Arena* arena, bool skip_filters,
TableReaderCaller caller, size_t compaction_readahead_size = 0) override;
TableReaderCaller caller,
size_t compaction_readahead_size = 0) override;
void Prepare(const Slice& target) override;
// Report an approximation of how much memory has been used.

@ -14,9 +14,9 @@ int main() {
#else
#include <cinttypes>
#include <vector>
#include <string>
#include <map>
#include <string>
#include <vector>
#include "memory/arena.h"
#include "table/cuckoo/cuckoo_table_builder.h"

@ -28,7 +28,8 @@ stl_wrappers::KVMap MakeMockFile(
InternalIterator* MockTableReader::NewIterator(
const ReadOptions&, const SliceTransform* /* prefix_extractor */,
Arena* /*arena*/, bool /*skip_filters*/, TableReaderCaller /*caller*/, size_t /*compaction_readahead_size*/) {
Arena* /*arena*/, bool /*skip_filters*/, TableReaderCaller /*caller*/,
size_t /*compaction_readahead_size*/) {
return new MockTableIterator(table_);
}

@ -5,13 +5,12 @@
#include "table/plain/plain_table_bloom.h"
#include <string>
#include <algorithm>
#include <string>
#include "util/dynamic_bloom.h"
#include "memory/allocator.h"
namespace rocksdb {
namespace {
@ -28,7 +27,7 @@ uint32_t GetTotalBitsForLocality(uint32_t total_bits) {
return num_blocks * (CACHE_LINE_SIZE * 8);
}
}
} // namespace
PlainTableBloomV1::PlainTableBloomV1(uint32_t num_probes)
: kTotalBits(0), kNumBlocks(0), kNumProbes(num_probes), data_(nullptr) {}
@ -40,8 +39,8 @@ void PlainTableBloomV1::SetRawData(char* raw_data, uint32_t total_bits,
kNumBlocks = num_blocks;
}
void PlainTableBloomV1::SetTotalBits(Allocator* allocator,
uint32_t total_bits, uint32_t locality,
void PlainTableBloomV1::SetTotalBits(Allocator* allocator, uint32_t total_bits,
uint32_t locality,
size_t huge_page_tlb_size,
Logger* logger) {
kTotalBits = (locality > 0) ? GetTotalBitsForLocality(total_bits)
@ -66,7 +65,8 @@ void PlainTableBloomV1::SetTotalBits(Allocator* allocator,
data_ = raw;
}
void BloomBlockBuilder::AddKeysHashes(const std::vector<uint32_t>& keys_hashes) {
void BloomBlockBuilder::AddKeysHashes(
const std::vector<uint32_t>& keys_hashes) {
for (auto hash : keys_hashes) {
bloom_.AddHash(hash);
}

@ -4,8 +4,8 @@
// (found in the LICENSE.Apache file in the root directory).
#pragma once
#include <vector>
#include <string>
#include <vector>
#include "rocksdb/slice.h"

@ -83,7 +83,8 @@ class PlainTableReader: public TableReader {
InternalIterator* NewIterator(const ReadOptions&,
const SliceTransform* prefix_extractor,
Arena* arena, bool skip_filters,
TableReaderCaller caller, size_t compaction_readahead_size = 0) override;
TableReaderCaller caller,
size_t compaction_readahead_size = 0) override;
void Prepare(const Slice& target) override;

@ -45,11 +45,12 @@ class TableReader {
// all the states but those allocated in arena.
// skip_filters: disables checking the bloom filters even if they exist. This
// option is effective only for block-based table format.
// compaction_readahead_size: its value will only be used if caller = kCompaction
virtual InternalIterator* NewIterator(const ReadOptions&,
const SliceTransform* prefix_extractor,
Arena* arena, bool skip_filters,
TableReaderCaller caller, size_t compaction_readahead_size = 0) = 0;
// compaction_readahead_size: its value will only be used if caller =
// kCompaction
virtual InternalIterator* NewIterator(
const ReadOptions&, const SliceTransform* prefix_extractor, Arena* arena,
bool skip_filters, TableReaderCaller caller,
size_t compaction_readahead_size = 0) = 0;
virtual FragmentedRangeTombstoneIterator* NewRangeTombstoneIterator(
const ReadOptions& /*read_options*/) {

@ -6,8 +6,8 @@
#include "test_util/transaction_test_util.h"
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <numeric>
#include <random>
#include <string>

@ -16,12 +16,12 @@
#include <unistd.h>
#endif
#include <fcntl.h>
#include <cinttypes>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <atomic>
#include <cinttypes>
#include <condition_variable>
#include <cstddef>
#include <memory>

@ -29,13 +29,13 @@ int main() {
#else
#include <fcntl.h>
#include <cinttypes>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cinttypes>
#include <exception>
#include <queue>
#include <thread>

@ -573,7 +573,8 @@ Status TraceAnalyzer::MakeStatistics() {
// output the access count distribution
if (FLAGS_output_access_count_stats && stat.second.a_count_dist_f) {
for (auto& record : stat.second.a_count_stats) {
ret = snprintf(buffer_, sizeof(buffer_), "access_count: %" PRIu64 " num: %" PRIu64 "\n",
ret = snprintf(buffer_, sizeof(buffer_),
"access_count: %" PRIu64 " num: %" PRIu64 "\n",
record.first, record.second);
if (ret < 0) {
return Status::IOError("Format the output failed");
@ -597,8 +598,8 @@ Status TraceAnalyzer::MakeStatistics() {
get_mid = true;
}
if (FLAGS_output_key_distribution && stat.second.a_key_size_f) {
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %" PRIu64 "\n", record.first,
record.second);
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %" PRIu64 "\n",
record.first, record.second);
if (ret < 0) {
return Status::IOError("Format output failed");
}
@ -676,9 +677,10 @@ Status TraceAnalyzer::MakeStatisticKeyStatsOrPrefix(TraceStats& stats) {
succ_ratio = (static_cast<double>(record.second.succ_count)) /
record.second.access_count;
}
ret = snprintf(buffer_, sizeof(buffer_), "%u %zu %" PRIu64 " %" PRIu64 " %f\n",
record.second.cf_id, record.second.value_size,
record.second.key_id, record.second.access_count, succ_ratio);
ret = snprintf(buffer_, sizeof(buffer_),
"%u %zu %" PRIu64 " %" PRIu64 " %f\n", record.second.cf_id,
record.second.value_size, record.second.key_id,
record.second.access_count, succ_ratio);
if (ret < 0) {
return Status::IOError("Format output failed");
}
@ -704,7 +706,9 @@ Status TraceAnalyzer::MakeStatisticKeyStatsOrPrefix(TraceStats& stats) {
prefix_succ_ratio =
(static_cast<double>(prefix_succ_access)) / prefix_access;
}
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %" PRIu64 " %" PRIu64 " %f %f %s\n",
ret =
snprintf(buffer_, sizeof(buffer_),
"%" PRIu64 " %" PRIu64 " %" PRIu64 " %f %f %s\n",
record.second.key_id, prefix_access, prefix_count,
prefix_ave_access, prefix_succ_ratio, prefix_out.c_str());
if (ret < 0) {
@ -871,7 +875,8 @@ Status TraceAnalyzer::MakeStatisticQPS() {
cur_ratio = (static_cast<double>(find_time->second)) / cur_uni_key;
cur_num = find_time->second;
}
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %.12f\n", cur_num, cur_ratio);
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %.12f\n",
cur_num, cur_ratio);
if (ret < 0) {
return Status::IOError("Format the output failed");
}
@ -907,7 +912,8 @@ Status TraceAnalyzer::MakeStatisticQPS() {
for (auto& qps_prefix : stat.second.a_qps_prefix_stats[qps_time]) {
std::string qps_prefix_out =
rocksdb::LDBCommand::StringToHex(qps_prefix.first);
ret = snprintf(buffer_, sizeof(buffer_), "The prefix: %s Access count: %u\n",
ret = snprintf(buffer_, sizeof(buffer_),
"The prefix: %s Access count: %u\n",
qps_prefix_out.c_str(), qps_prefix.second);
if (ret < 0) {
return Status::IOError("Format the output failed");
@ -1017,7 +1023,8 @@ Status TraceAnalyzer::ReProcessing() {
if (found != stat.a_key_stats.end()) {
key_id = found->second.key_id;
}
ret = snprintf(buffer_, sizeof(buffer_), "%u %" PRIu64 " %" PRIu64 "\n",
ret =
snprintf(buffer_, sizeof(buffer_), "%u %" PRIu64 " %" PRIu64 "\n",
stat.time_series.front().type,
stat.time_series.front().ts, key_id);
if (ret < 0) {
@ -1065,8 +1072,8 @@ Status TraceAnalyzer::ReProcessing() {
TraceStats& stat = ta_[type].stats[cf_id];
if (stat.w_key_f) {
if (stat.a_key_stats.find(input_key) != stat.a_key_stats.end()) {
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %" PRIu64 "\n",
cfs_[cf_id].w_count,
ret = snprintf(buffer_, sizeof(buffer_),
"%" PRIu64 " %" PRIu64 "\n", cfs_[cf_id].w_count,
stat.a_key_stats[input_key].access_count);
if (ret < 0) {
return Status::IOError("Format the output failed");
@ -1087,8 +1094,8 @@ Status TraceAnalyzer::ReProcessing() {
prefix[type] = input_key.substr(0, FLAGS_output_prefix_cut);
std::string prefix_out =
rocksdb::LDBCommand::StringToHex(prefix[type]);
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %s\n", cfs_[cf_id].w_count,
prefix_out.c_str());
ret = snprintf(buffer_, sizeof(buffer_), "%" PRIu64 " %s\n",
cfs_[cf_id].w_count, prefix_out.c_str());
if (ret < 0) {
return Status::IOError("Format the output failed");
}
@ -1904,8 +1911,8 @@ Status TraceAnalyzer::WriteTraceSequence(const uint32_t& type,
const uint64_t ts) {
std::string hex_key = rocksdb::LDBCommand::StringToHex(key);
int ret;
ret =
snprintf(buffer_, sizeof(buffer_), "%u %u %zu %" PRIu64 "\n", type, cf_id, value_size, ts);
ret = snprintf(buffer_, sizeof(buffer_), "%u %u %zu %" PRIu64 "\n", type,
cf_id, value_size, ts);
if (ret < 0) {
return Status::IOError("failed to format the output");
}

@ -56,8 +56,8 @@ int main() {
}
#else
#include <cinttypes>
#include <atomic>
#include <cinttypes>
#include <random>
#include <set>
#include <string>

@ -23,8 +23,8 @@ int main() {
#include "table/full_filter_bits_builder.h"
#include "test_util/testharness.h"
#include "test_util/testutil.h"
#include "util/hash.h"
#include "util/gflags_compat.h"
#include "util/hash.h"
using GFLAGS_NAMESPACE::ParseCommandLineFlags;
@ -98,9 +98,7 @@ class BloomTest : public testing::Test {
return filter_.size();
}
Slice FilterData() const {
return Slice(filter_);
}
Slice FilterData() const { return Slice(filter_); }
void DumpFilter() {
fprintf(stderr, "F(");
@ -235,7 +233,6 @@ TEST_F(BloomTest, Schema) {
ResetPolicy();
}
// Different bits-per-byte
class FullBloomTest : public testing::Test {
@ -287,9 +284,7 @@ class FullBloomTest : public testing::Test {
return filter_size_;
}
Slice FilterData() {
return Slice(buf_.get(), filter_size_);
}
Slice FilterData() { return Slice(buf_.get(), filter_size_); }
bool Matches(const Slice& s) {
if (bits_reader_ == nullptr) {
@ -381,8 +376,7 @@ TEST_F(FullBloomTest, FullVaryingLengths) {
}
namespace {
inline uint32_t SelectByCacheLineSize(uint32_t for64,
uint32_t for128,
inline uint32_t SelectByCacheLineSize(uint32_t for64, uint32_t for128,
uint32_t for256) {
(void)for64;
(void)for128;

@ -21,7 +21,8 @@
crc0 = crc32c_u64(crc0, *(buf64 + (ITR)));
/* unfolding to compute 24 * 7 = 168 bytes parallelly */
#define CRC32C7X24BYTES(ITR) do {\
#define CRC32C7X24BYTES(ITR) \
do { \
CRC32C24BYTES((ITR)*7 + 0) \
CRC32C24BYTES((ITR)*7 + 1) \
CRC32C24BYTES((ITR)*7 + 2) \
@ -97,8 +98,7 @@ uint32_t crc32c_arm64(uint32_t crc, unsigned char const *data,
length -= 1024;
}
if (length == 0)
return crc ^ (0xffffffffU);
if (length == 0) return crc ^ (0xffffffffU);
#endif
buf8 = (const uint8_t *)buf64;
while (length >= 8) {
@ -120,8 +120,7 @@ uint32_t crc32c_arm64(uint32_t crc, unsigned char const *data,
length -= 2;
}
if (length >= 1)
crc = crc32c_u8(crc, *buf8);
if (length >= 1) crc = crc32c_u8(crc, *buf8);
crc ^= 0xffffffff;
return crc;

@ -23,12 +23,11 @@ uint32_t roundUpToPow2(uint32_t x) {
}
return rv;
}
}
DynamicBloom::DynamicBloom(Allocator* allocator, uint32_t total_bits,
uint32_t num_probes,
size_t huge_page_tlb_size, Logger* logger)
uint32_t num_probes, size_t huge_page_tlb_size,
Logger* logger)
// Round down, except round up with 1
: kNumDoubleProbes((num_probes + (num_probes == 1)) / 2) {
assert(num_probes % 2 == 0); // limitation of current implementation

@ -44,10 +44,8 @@ class DynamicBloom {
// it to be allocated, like:
// sysctl -w vm.nr_hugepages=20
// See linux doc Documentation/vm/hugetlbpage.txt
explicit DynamicBloom(Allocator* allocator,
uint32_t total_bits,
uint32_t num_probes = 6,
size_t huge_page_tlb_size = 0,
explicit DynamicBloom(Allocator* allocator, uint32_t total_bits,
uint32_t num_probes = 6, size_t huge_page_tlb_size = 0,
Logger* logger = nullptr);
~DynamicBloom() {}
@ -159,8 +157,8 @@ inline bool DynamicBloom::MayContainHash(uint32_t h32) const {
uint64_t h = 0x9e3779b97f4a7c13ULL * h32;
for (unsigned i = 0;; ++i) {
// Two bit probes per uint64_t probe
uint64_t mask = ((uint64_t)1 << (h & 63))
| ((uint64_t)1 << ((h >> 6) & 63));
uint64_t mask =
((uint64_t)1 << (h & 63)) | ((uint64_t)1 << ((h >> 6) & 63));
uint64_t val = data_[a ^ i].load(std::memory_order_relaxed);
if (i + 1 >= kNumDoubleProbes) {
return (val & mask) == mask;
@ -179,8 +177,8 @@ inline void DynamicBloom::AddHash(uint32_t h32, const OrFunc& or_func) {
uint64_t h = 0x9e3779b97f4a7c13ULL * h32;
for (unsigned i = 0;; ++i) {
// Two bit probes per uint64_t probe
uint64_t mask = ((uint64_t)1 << (h & 63))
| ((uint64_t)1 << ((h >> 6) & 63));
uint64_t mask =
((uint64_t)1 << (h & 63)) | ((uint64_t)1 << ((h >> 6) & 63));
or_func(&data_[a ^ i], mask);
if (i + 1 >= kNumDoubleProbes) {
return;

@ -11,9 +11,9 @@ int main() {
}
#else
#include <cinttypes>
#include <algorithm>
#include <atomic>
#include <cinttypes>
#include <functional>
#include <memory>
#include <thread>
@ -253,7 +253,8 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
threads.pop_back();
}
fprintf(stderr, "dynamic bloom, avg parallel add latency %3g"
fprintf(stderr,
"dynamic bloom, avg parallel add latency %3g"
" nanos/key\n",
static_cast<double>(elapsed) / num_threads / num_keys);
@ -276,7 +277,8 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
threads.pop_back();
}
fprintf(stderr, "dynamic bloom, avg parallel hit latency %3g"
fprintf(stderr,
"dynamic bloom, avg parallel hit latency %3g"
" nanos/key\n",
static_cast<double>(elapsed) / num_threads / num_keys);
@ -286,8 +288,7 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
KeyMaker km;
StopWatchNano timer(Env::Default());
timer.Start();
for (uint64_t i = num_keys + 1 + t; i <= 2 * num_keys;
i += num_threads) {
for (uint64_t i = num_keys + 1 + t; i <= 2 * num_keys; i += num_threads) {
bool f = std_bloom.MayContain(km.Seq(i));
if (f) {
++false_positives;
@ -303,7 +304,8 @@ TEST_F(DynamicBloomTest, concurrent_with_perf) {
threads.pop_back();
}
fprintf(stderr, "dynamic bloom, avg parallel miss latency %3g"
fprintf(stderr,
"dynamic bloom, avg parallel miss latency %3g"
" nanos/key, %f%% false positive rate\n",
static_cast<double>(elapsed) / num_threads / num_keys,
false_positives.load() * 100.0 / num_keys);

@ -52,10 +52,14 @@ TEST(HashTest, Values) {
EXPECT_EQ(Hash("\x38\xd6\xf7\x28\x20\xb4\x8a\xe9", 8, kSeed), 3530274698u);
EXPECT_EQ(Hash("\xbb\x18\x5d\xf4\x12\x03\xf7\x99", 8, kSeed), 1974545809u);
EXPECT_EQ(Hash("\x80\xd4\x3b\x3b\xae\x22\xa2\x78", 8, kSeed), 3563570120u);
EXPECT_EQ(Hash("\x1a\xb5\xd0\xfe\xab\xc3\x61\xb2\x99", 9, kSeed), 2706087434u);
EXPECT_EQ(Hash("\x8e\x4a\xc3\x18\x20\x2f\x06\xe6\x3c", 9, kSeed), 1534654151u);
EXPECT_EQ(Hash("\xb6\xc0\xdd\x05\x3f\xc4\x86\x4c\xef", 9, kSeed), 2355554696u);
EXPECT_EQ(Hash("\x9a\x5f\x78\x0d\xaf\x50\xe1\x1f\x55", 9, kSeed), 1400800912u);
EXPECT_EQ(Hash("\x1a\xb5\xd0\xfe\xab\xc3\x61\xb2\x99", 9, kSeed),
2706087434u);
EXPECT_EQ(Hash("\x8e\x4a\xc3\x18\x20\x2f\x06\xe6\x3c", 9, kSeed),
1534654151u);
EXPECT_EQ(Hash("\xb6\xc0\xdd\x05\x3f\xc4\x86\x4c\xef", 9, kSeed),
2355554696u);
EXPECT_EQ(Hash("\x9a\x5f\x78\x0d\xaf\x50\xe1\x1f\x55", 9, kSeed),
1400800912u);
EXPECT_EQ(Hash("\x22\x6f\x39\x1f\xf8\xdd\x4f\x52\x17\x94", 10, kSeed),
3420325137u);
EXPECT_EQ(Hash("\x32\x89\x2a\x75\x48\x3a\x4a\x02\x69\xdd", 10, kSeed),

@ -9,8 +9,8 @@
#include "util/rate_limiter.h"
#include <cinttypes>
#include <chrono>
#include <cinttypes>
#include <limits>
#include "db/db_test_util.h"

@ -98,7 +98,6 @@ struct ThreadPoolImpl::Impl {
void SetThreadPriority(Env::Priority priority) { priority_ = priority; }
private:
static void BGThreadWrapper(void* arg);
bool low_io_priority_;

@ -24,10 +24,10 @@
#include "util/string_util.h"
#include "utilities/checkpoint/checkpoint_impl.h"
#include <cinttypes>
#include <stdlib.h>
#include <algorithm>
#include <atomic>
#include <cinttypes>
#include <functional>
#include <future>
#include <limits>

@ -6,8 +6,8 @@
#ifndef ROCKSDB_LITE
#include "utilities/blob_db/blob_file.h"
#include <cinttypes>
#include <stdio.h>
#include <cinttypes>
#include <algorithm>
#include <limits>

@ -11,8 +11,8 @@
#include "utilities/checkpoint/checkpoint_impl.h"
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <string>
#include <vector>

@ -368,8 +368,7 @@ TEST_F(CheckpointTest, ExportColumnFamilyWithLinks) {
{
auto cf_options = CurrentOptions();
cf_options.comparator = ReverseBytewiseComparator();
ASSERT_OK(
db_->CreateColumnFamily(cf_options, "yoyo", &cfh_reverse_comp_));
ASSERT_OK(db_->CreateColumnFamily(cf_options, "yoyo", &cfh_reverse_comp_));
const auto key = std::string("foo");
ASSERT_OK(db_->Put(WriteOptions(), cfh_reverse_comp_, key, "v1"));

@ -2,10 +2,10 @@
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#include "utilities/merge_operators/sortlist.h"
#include "rocksdb/merge_operator.h"
#include "rocksdb/slice.h"
#include "utilities/merge_operators.h"
#include "utilities/merge_operators/sortlist.h"
using rocksdb::Logger;
using rocksdb::MergeOperator;

@ -8,8 +8,8 @@
#include "utilities/persistent_cache/persistent_cache_tier.h"
#include <cinttypes>
#include <string>
#include <sstream>
#include <string>
namespace rocksdb {

@ -235,7 +235,9 @@ class SimCacheImpl : public SimCache {
return cache_->GetUsage(handle);
}
size_t GetCharge(Handle* handle) const override { return cache_->GetCharge(handle); }
size_t GetCharge(Handle* handle) const override {
return cache_->GetCharge(handle);
}
size_t GetPinnedUsage() const override { return cache_->GetPinnedUsage(); }

@ -9,7 +9,6 @@
#include <string>
#include <thread>
#include "db/db_impl/db_impl.h"
#include "logging/logging.h"
#include "port/port.h"

@ -638,8 +638,7 @@ void TransactionBaseImpl::TrackKey(TransactionKeyMap* key_map, uint32_t cfh_id,
// in case it is not already in the map
auto result = cf_key_map.try_emplace(key, seq);
auto iter = result.first;
if (!result.second &&
seq < iter->second.seq) {
if (!result.second && seq < iter->second.seq) {
// Now tracking this key with an earlier sequence number
iter->second.seq = seq;
}

@ -5,8 +5,8 @@
#pragma once
#include <cinttypes>
#include <algorithm>
#include <cinttypes>
#include <functional>
#include <string>
#include <thread>

@ -1445,8 +1445,8 @@ TEST_P(WritePreparedTransactionTest, MaxCatchupWithUnbackedSnapshot) {
s = s_vec[0];
ASSERT_TRUE(s.ok() || s.IsTryAgain());
Slice key("key");
txn->MultiGet(ropt, db->DefaultColumnFamily(), 1, &key, &pinnable_val,
&s, true);
txn->MultiGet(ropt, db->DefaultColumnFamily(), 1, &key, &pinnable_val, &s,
true);
ASSERT_TRUE(s.ok() || s.IsTryAgain());
delete txn;
}

@ -411,8 +411,7 @@ Status WriteUnpreparedTxn::FlushWriteBatchWithSavePointToDB() {
bool trailing_batch = i == unflushed_save_points_->size();
SavePointBatchHandler sp_handler(&write_batch_,
*wupt_db_->GetCFHandleMap().get());
size_t curr_boundary = trailing_batch
? wb.GetWriteBatch()->GetDataSize()
size_t curr_boundary = trailing_batch ? wb.GetWriteBatch()->GetDataSize()
: (*unflushed_save_points_)[i];
// Construct the partial write batch up to the savepoint.

@ -87,14 +87,10 @@ class TtlTest : public testing::Test {
}
// Call db_ttl_->Close() before delete db_ttl_
void CloseTtl() {
CloseTtlHelper(true);
}
void CloseTtl() { CloseTtlHelper(true); }
// No db_ttl_->Close() before delete db_ttl_
void CloseTtlNoDBClose() {
CloseTtlHelper(false);
}
void CloseTtlNoDBClose() { CloseTtlHelper(false); }
void CloseTtlHelper(bool close_db) {
if (db_ttl_ != nullptr) {
@ -416,7 +412,6 @@ TEST_F(TtlTest, NoEffect) {
CloseTtl();
}
// Rerun the NoEffect test with a different version of CloseTtl
// function, where db is directly deleted without close.
TEST_F(TtlTest, DestructWithoutClose) {

@ -918,8 +918,8 @@ Status WriteBatchWithIndex::GetFromBatchAndDB(
if (merge_operator) {
std::string merge_result;
s = MergeHelper::TimedFullMerge(
merge_operator, key, merge_data, merge_context.GetOperands(),
s = MergeHelper::TimedFullMerge(merge_operator, key, merge_data,
merge_context.GetOperands(),
&merge_result, logger, statistics, env);
pinnable_val->Reset();
*pinnable_val->GetSelf() = std::move(merge_result);

@ -1308,7 +1308,6 @@ TEST_F(WriteBatchWithIndexTest, TestGetFromBatchAndDBMerge2) {
DestroyDB(dbname, options);
}
TEST_F(WriteBatchWithIndexTest, TestGetFromBatchAndDBMerge3) {
DB* db;
Options options;

Loading…
Cancel
Save