From 1d7048c5985e60be8e356663ec3cb6d020adb44d Mon Sep 17 00:00:00 2001 From: Victor Gao Date: Fri, 21 Jul 2017 14:50:24 -0700 Subject: [PATCH] comment out unused parameters Summary: This uses `clang-tidy` to comment out unused parameters (in functions, methods and lambdas) in fbcode. Cases that the tool failed to handle are fixed manually. Reviewed By: igorsugak Differential Revision: D5454343 fbshipit-source-id: 5dee339b4334e25e963891b519a5aa81fbf627b2 --- cache/cache_test.cc | 6 +- cache/clock_cache.cc | 2 +- cache/sharded_cache.cc | 2 +- db/builder.cc | 8 +- db/c.cc | 16 +- db/column_family_test.cc | 51 +++--- db/compact_files_test.cc | 9 +- db/compacted_db_impl.h | 45 ++--- db/compaction_iterator.cc | 2 +- db/compaction_iterator.h | 2 +- db/compaction_iterator_test.cc | 29 ++-- db/compaction_job_stats_test.cc | 10 +- db/compaction_picker.cc | 9 +- db/compaction_picker.h | 26 +-- db/compaction_picker_test.cc | 4 +- db/comparator_db_test.cc | 18 +- db/db_block_cache_test.cc | 2 +- db/db_bloom_filter_test.cc | 4 +- db/db_compaction_filter_test.cc | 48 +++--- db/db_compaction_test.cc | 46 +++-- db/db_dynamic_level_test.cc | 4 +- db/db_flush_test.cc | 4 +- db/db_impl.cc | 27 +-- db/db_impl_compaction_flush.cc | 2 +- db/db_impl_readonly.cc | 2 +- db/db_impl_readonly.h | 59 +++---- db/db_impl_write.cc | 2 +- db/db_iter_test.cc | 6 +- db/db_iterator_test.cc | 6 +- db/db_memtable_test.cc | 2 +- db/db_properties_test.cc | 12 +- db/db_sst_test.cc | 13 +- db/db_tailing_iter_test.cc | 6 +- db/db_test.cc | 163 +++++++++--------- db/db_test2.cc | 23 ++- db/db_test_util.cc | 11 +- db/db_test_util.h | 2 +- db/db_universal_compaction_test.cc | 50 +++--- db/deletefile_test.cc | 2 +- db/external_sst_file_test.cc | 15 +- db/fault_injection_test.cc | 4 +- db/file_indexer_test.cc | 6 +- db/forward_iterator.cc | 2 +- db/forward_iterator.h | 2 +- db/internal_stats.cc | 117 +++++++------ db/listener_test.cc | 17 +- db/malloc_stats.cc | 2 +- db/manual_compaction_test.cc | 6 +- db/memtable_list.cc | 4 +- db/merge_test.cc | 2 +- db/plain_table_db_test.cc | 2 +- db/prefix_test.cc | 6 +- db/table_cache.cc | 4 +- db/table_properties_collector.cc | 4 +- db/table_properties_collector.h | 2 +- db/table_properties_collector_test.cc | 19 +- db/version_builder.cc | 2 +- db/version_edit.cc | 2 +- db/version_set.cc | 6 +- db/version_set.h | 2 +- db/version_set_test.cc | 4 +- db/wal_manager_test.cc | 2 +- db/write_batch.cc | 6 +- db/write_batch_test.cc | 32 ++-- db/write_callback_test.cc | 6 +- db/write_thread.cc | 3 +- env/env_encryption.cc | 14 +- env/env_hdfs.cc | 10 +- env/env_test.cc | 21 ++- env/io_posix.cc | 4 +- env/io_posix.h | 2 +- env/mock_env.cc | 14 +- hdfs/env_hdfs.h | 101 ++++++----- include/rocksdb/cache.h | 3 +- include/rocksdb/compaction_filter.h | 12 +- include/rocksdb/db.h | 2 +- include/rocksdb/env.h | 51 +++--- include/rocksdb/filter_policy.h | 5 +- include/rocksdb/iterator.h | 2 +- include/rocksdb/listener.h | 4 +- include/rocksdb/memtablerep.h | 8 +- include/rocksdb/merge_operator.h | 15 +- include/rocksdb/rate_limiter.h | 2 +- include/rocksdb/slice.h | 2 +- include/rocksdb/slice_transform.h | 4 +- include/rocksdb/statistics.h | 2 +- include/rocksdb/utilities/geo_db.h | 2 +- .../utilities/optimistic_transaction_db.h | 2 +- include/rocksdb/utilities/transaction.h | 6 +- include/rocksdb/wal_filter.h | 18 +- include/rocksdb/write_batch.h | 11 +- memtable/hash_cuckoo_rep.cc | 6 +- memtable/hash_linklist_rep.cc | 14 +- memtable/hash_skiplist_rep.cc | 14 +- memtable/skiplistrep.cc | 2 +- memtable/vectorrep.cc | 6 +- options/options_helper.cc | 2 +- options/options_parser.cc | 2 +- port/port_posix.cc | 2 +- port/stack_trace.cc | 2 +- table/adaptive_table_factory.cc | 2 +- table/adaptive_table_factory.h | 5 +- table/block_based_filter_block.cc | 10 +- table/block_based_table_builder.cc | 6 +- table/block_based_table_factory.cc | 3 +- table/block_based_table_reader.cc | 18 +- table/block_test.cc | 2 +- table/cuckoo_table_builder_test.cc | 2 +- table/cuckoo_table_factory.cc | 2 +- table/cuckoo_table_factory.h | 5 +- table/cuckoo_table_reader.cc | 11 +- table/cuckoo_table_reader.h | 2 +- table/cuckoo_table_reader_test.cc | 2 +- table/full_filter_block.cc | 14 +- table/full_filter_block.h | 2 +- table/get_context.cc | 2 +- table/index_builder.h | 4 +- table/internal_iterator.h | 5 +- table/iterator.cc | 8 +- table/mock_table.cc | 16 +- table/mock_table.h | 6 +- table/partitioned_filter_block.cc | 2 +- table/partitioned_filter_block_test.cc | 4 +- table/plain_table_factory.cc | 2 +- table/plain_table_factory.h | 5 +- table/plain_table_key_coding.cc | 2 +- table/plain_table_reader.cc | 10 +- table/sst_file_writer_collectors.h | 6 +- table/table_reader.h | 6 +- table/table_test.cc | 53 +++--- third-party/fbson/FbsonDocument.h | 2 +- tools/db_bench_tool.cc | 16 +- tools/ldb_cmd.cc | 40 ++--- tools/ldb_tool.cc | 2 +- tools/sst_dump_tool.cc | 6 +- util/compression.h | 22 +-- util/delete_scheduler_test.cc | 17 +- util/file_reader_writer_test.cc | 36 ++-- util/slice.cc | 8 +- util/testutil.cc | 6 +- util/testutil.h | 74 ++++---- util/thread_local_test.cc | 2 +- utilities/backupable/backupable_db.cc | 2 +- utilities/backupable/backupable_db_test.cc | 11 +- utilities/blob_db/blob_db.h | 6 +- utilities/blob_db/blob_db_impl.cc | 13 +- utilities/blob_db/blob_log_reader.cc | 2 +- utilities/checkpoint/checkpoint_impl.cc | 4 +- utilities/checkpoint/checkpoint_test.cc | 2 +- utilities/col_buf_decoder.h | 2 +- .../remove_emptyvalue_compactionfilter.cc | 11 +- utilities/document/document_db.cc | 21 +-- utilities/merge_operators/max.cc | 8 +- utilities/merge_operators/put.cc | 27 ++- .../string_append/stringappend.cc | 8 +- .../string_append/stringappend2.cc | 8 +- utilities/merge_operators/uint64add.cc | 6 +- utilities/object_registry_test.cc | 13 +- utilities/options/options_util_test.cc | 34 ++-- .../persistent_cache/block_cache_tier_file.cc | 2 +- .../persistent_cache/block_cache_tier_file.h | 6 +- utilities/persistent_cache/hash_table_test.cc | 4 +- .../persistent_cache/persistent_cache_test.h | 4 +- .../persistent_cache/persistent_cache_tier.cc | 4 +- .../persistent_cache/volatile_tier_impl.cc | 2 +- utilities/redis/redis_list_iterator.h | 2 +- utilities/simulator_cache/sim_cache.cc | 2 +- utilities/simulator_cache/sim_cache_test.cc | 2 +- utilities/spatialdb/spatial_db.cc | 2 +- .../compact_on_deletion_collector.cc | 11 +- .../compact_on_deletion_collector.h | 2 +- .../compact_on_deletion_collector_test.cc | 2 +- .../optimistic_transaction_impl.cc | 2 +- .../optimistic_transaction_impl.h | 4 +- utilities/transactions/transaction_base.h | 2 +- utilities/transactions/transaction_impl.cc | 4 +- utilities/transactions/transaction_impl.h | 2 +- utilities/transactions/transaction_test.cc | 8 +- utilities/ttl/ttl_test.cc | 6 +- .../write_batch_with_index_test.cc | 2 +- 180 files changed, 1076 insertions(+), 1006 deletions(-) diff --git a/cache/cache_test.cc b/cache/cache_test.cc index 8e241226d..55f9cc6bb 100644 --- a/cache/cache_test.cc +++ b/cache/cache_test.cc @@ -40,9 +40,9 @@ static int DecodeValue(void* v) { const std::string kLRU = "lru"; const std::string kClock = "clock"; -void dumbDeleter(const Slice& key, void* value) {} +void dumbDeleter(const Slice& /*key*/, void* /*value*/) {} -void eraseDeleter(const Slice& key, void* value) { +void eraseDeleter(const Slice& /*key*/, void* value) { Cache* cache = reinterpret_cast(value); cache->Erase("foo"); } @@ -470,7 +470,7 @@ class Value { }; namespace { -void deleter(const Slice& key, void* value) { +void deleter(const Slice& /*key*/, void* value) { delete static_cast(value); } } // namespace diff --git a/cache/clock_cache.cc b/cache/clock_cache.cc index db9d1438e..d5b32f82f 100644 --- a/cache/clock_cache.cc +++ b/cache/clock_cache.cc @@ -581,7 +581,7 @@ Status ClockCacheShard::Insert(const Slice& key, uint32_t hash, void* value, size_t charge, void (*deleter)(const Slice& key, void* value), Cache::Handle** out_handle, - Cache::Priority priority) { + Cache::Priority /*priority*/) { CleanupContext context; HashTable::accessor accessor; char* key_data = new char[key.size()]; diff --git a/cache/sharded_cache.cc b/cache/sharded_cache.cc index 9bdea3a08..6a0a22282 100644 --- a/cache/sharded_cache.cc +++ b/cache/sharded_cache.cc @@ -53,7 +53,7 @@ Status ShardedCache::Insert(const Slice& key, void* value, size_t charge, ->Insert(key, hash, value, charge, deleter, handle, priority); } -Cache::Handle* ShardedCache::Lookup(const Slice& key, Statistics* stats) { +Cache::Handle* ShardedCache::Lookup(const Slice& key, Statistics* /*stats*/) { uint32_t hash = HashSlice(key); return GetShard(Shard(hash))->Lookup(key, hash); } diff --git a/db/builder.cc b/db/builder.cc index 6f973fdbd..6c68e7c40 100644 --- a/db/builder.cc +++ b/db/builder.cc @@ -61,10 +61,10 @@ TableBuilder* NewTableBuilder( Status BuildTable( const std::string& dbname, Env* env, const ImmutableCFOptions& ioptions, - const MutableCFOptions& mutable_cf_options, const EnvOptions& env_options, - TableCache* table_cache, InternalIterator* iter, - std::unique_ptr range_del_iter, FileMetaData* meta, - const InternalKeyComparator& internal_comparator, + const MutableCFOptions& /*mutable_cf_options*/, + const EnvOptions& env_options, TableCache* table_cache, + InternalIterator* iter, std::unique_ptr range_del_iter, + FileMetaData* meta, const InternalKeyComparator& internal_comparator, const std::vector>* int_tbl_prop_collector_factories, uint32_t column_family_id, const std::string& column_family_name, diff --git a/db/c.cc b/db/c.cc index 441ffade3..a09d014ec 100644 --- a/db/c.cc +++ b/db/c.cc @@ -240,7 +240,7 @@ struct rocksdb_comparator_t : public Comparator { // No-ops since the C binding does not support key shortening methods. virtual void FindShortestSeparator(std::string*, const Slice&) const override {} - virtual void FindShortSuccessor(std::string* key) const override {} + virtual void FindShortSuccessor(std::string* /*key*/) const override {} }; struct rocksdb_filterpolicy_t : public FilterPolicy { @@ -355,7 +355,7 @@ struct rocksdb_mergeoperator_t : public MergeOperator { virtual bool PartialMergeMulti(const Slice& key, const std::deque& operand_list, std::string* new_value, - Logger* logger) const override { + Logger* /*logger*/) const override { size_t operand_count = operand_list.size(); std::vector operand_pointers(operand_count); std::vector operand_sizes(operand_count); @@ -2106,8 +2106,8 @@ void rocksdb_options_set_level0_stop_writes_trigger( opt->rep.level0_stop_writes_trigger = n; } -void rocksdb_options_set_max_mem_compaction_level(rocksdb_options_t* opt, - int n) {} +void rocksdb_options_set_max_mem_compaction_level(rocksdb_options_t* /*opt*/, + int /*n*/) {} void rocksdb_options_set_wal_recovery_mode(rocksdb_options_t* opt,int mode) { opt->rep.wal_recovery_mode = static_cast(mode); @@ -2171,8 +2171,8 @@ void rocksdb_options_set_manifest_preallocation_size( } // noop -void rocksdb_options_set_purge_redundant_kvs_while_flush(rocksdb_options_t* opt, - unsigned char v) {} +void rocksdb_options_set_purge_redundant_kvs_while_flush( + rocksdb_options_t* /*opt*/, unsigned char /*v*/) {} void rocksdb_options_set_use_direct_reads(rocksdb_options_t* opt, unsigned char v) { @@ -2332,7 +2332,7 @@ void rocksdb_options_set_table_cache_numshardbits( } void rocksdb_options_set_table_cache_remove_scan_count_limit( - rocksdb_options_t* opt, int v) { + rocksdb_options_t* /*opt*/, int /*v*/) { // this option is deprecated } @@ -2836,7 +2836,7 @@ rocksdb_sstfilewriter_t* rocksdb_sstfilewriter_create( rocksdb_sstfilewriter_t* rocksdb_sstfilewriter_create_with_comparator( const rocksdb_envoptions_t* env, const rocksdb_options_t* io_options, - const rocksdb_comparator_t* comparator) { + const rocksdb_comparator_t* /*comparator*/) { rocksdb_sstfilewriter_t* writer = new rocksdb_sstfilewriter_t; writer->rep = new SstFileWriter(env->rep, io_options->rep); return writer; diff --git a/db/column_family_test.cc b/db/column_family_test.cc index 88786d469..440fc9930 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -1168,13 +1168,14 @@ TEST_F(ColumnFamilyTest, MemtableNotSupportSnapshot) { #endif // !ROCKSDB_LITE class TestComparator : public Comparator { - int Compare(const rocksdb::Slice& a, const rocksdb::Slice& b) const override { + int Compare(const rocksdb::Slice& /*a*/, + const rocksdb::Slice& /*b*/) const override { return 0; } const char* Name() const override { return "Test"; } - void FindShortestSeparator(std::string* start, - const rocksdb::Slice& limit) const override {} - void FindShortSuccessor(std::string* key) const override {} + void FindShortestSeparator(std::string* /*start*/, + const rocksdb::Slice& /*limit*/) const override {} + void FindShortSuccessor(std::string* /*key*/) const override {} }; static TestComparator third_comparator; @@ -1346,7 +1347,7 @@ TEST_F(ColumnFamilyTest, MultipleManualCompactions) { {"ColumnFamilyTest::MultiManual:2", "ColumnFamilyTest::MultiManual:5"}, {"ColumnFamilyTest::MultiManual:2", "ColumnFamilyTest::MultiManual:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::MultiManual:4"); cf_1_1 = false; @@ -1439,7 +1440,7 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) { {"ColumnFamilyTest::AutoManual:2", "ColumnFamilyTest::AutoManual:5"}, {"ColumnFamilyTest::AutoManual:2", "ColumnFamilyTest::AutoManual:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { cf_1_1 = false; TEST_SYNC_POINT("ColumnFamilyTest::AutoManual:4"); @@ -1540,7 +1541,7 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) { {"ColumnFamilyTest::ManualAuto:5", "ColumnFamilyTest::ManualAuto:2"}, {"ColumnFamilyTest::ManualAuto:2", "ColumnFamilyTest::ManualAuto:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAuto:4"); cf_1_1 = false; @@ -1633,7 +1634,7 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) { {"ColumnFamilyTest::ManualManual:1", "ColumnFamilyTest::ManualManual:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualManual:4"); cf_1_1 = false; @@ -1731,7 +1732,7 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) { {"ColumnFamilyTest::ManualAuto:1", "ColumnFamilyTest::ManualAuto:2"}, {"ColumnFamilyTest::ManualAuto:1", "ColumnFamilyTest::ManualAuto:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAuto:4"); cf_1_1 = false; @@ -1823,7 +1824,7 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) { "ColumnFamilyTest::ManualAuto:3"}, {"ColumnFamilyTest::ManualAuto:1", "ColumnFamilyTest::ManualAuto:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAuto:4"); cf_1_1 = false; @@ -1926,7 +1927,7 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticConflict) { {"ColumnFamilyTest::ManualAutoCon:1", "ColumnFamilyTest::ManualAutoCon:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::ManualAutoCon:4"); cf_1_1 = false; @@ -2030,7 +2031,7 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) { {"CompactionPicker::CompactRange:Conflict", "ColumnFamilyTest::AutoManual:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (cf_1_1) { TEST_SYNC_POINT("ColumnFamilyTest::AutoManual:4"); cf_1_1 = false; @@ -2476,21 +2477,21 @@ TEST_F(ColumnFamilyTest, CreateAndDropRace) { auto main_thread_id = std::this_thread::get_id(); - rocksdb::SyncPoint::GetInstance()->SetCallBack("PersistRocksDBOptions:start", - [&](void* arg) { - auto current_thread_id = std::this_thread::get_id(); - // If it's the main thread hitting this sync-point, then it - // will be blocked until some other thread update the test_stage. - if (main_thread_id == current_thread_id) { - test_stage = kMainThreadStartPersistingOptionsFile; - while (test_stage < kChildThreadFinishDroppingColumnFamily) { - Env::Default()->SleepForMicroseconds(100); - } - } - }); + rocksdb::SyncPoint::GetInstance()->SetCallBack( + "PersistRocksDBOptions:start", [&](void* /*arg*/) { + auto current_thread_id = std::this_thread::get_id(); + // If it's the main thread hitting this sync-point, then it + // will be blocked until some other thread update the test_stage. + if (main_thread_id == current_thread_id) { + test_stage = kMainThreadStartPersistingOptionsFile; + while (test_stage < kChildThreadFinishDroppingColumnFamily) { + Env::Default()->SleepForMicroseconds(100); + } + } + }); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WriteThread::EnterUnbatched:Wait", [&](void* arg) { + "WriteThread::EnterUnbatched:Wait", [&](void* /*arg*/) { // This means a thread doing DropColumnFamily() is waiting for // other thread to finish persisting options. // In such case, we update the test_stage to unblock the main thread. diff --git a/db/compact_files_test.cc b/db/compact_files_test.cc index 5aad6114f..7f1504539 100644 --- a/db/compact_files_test.cc +++ b/db/compact_files_test.cc @@ -37,8 +37,7 @@ class FlushedFileCollector : public EventListener { FlushedFileCollector() {} ~FlushedFileCollector() {} - virtual void OnFlushCompleted( - DB* db, const FlushJobInfo& info) override { + virtual void OnFlushCompleted(DB* /*db*/, const FlushJobInfo& info) override { std::lock_guard lock(mutex_); flushed_files_.push_back(info.file_path); } @@ -257,9 +256,9 @@ TEST_F(CompactFilesTest, CapturingPendingFiles) { TEST_F(CompactFilesTest, CompactionFilterWithGetSv) { class FilterWithGet : public CompactionFilter { public: - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { if (db_ == nullptr) { return true; } diff --git a/db/compacted_db_impl.h b/db/compacted_db_impl.h index de32f21e6..736002e1e 100644 --- a/db/compacted_db_impl.h +++ b/db/compacted_db_impl.h @@ -32,55 +32,56 @@ class CompactedDBImpl : public DBImpl { override; using DBImpl::Put; - virtual Status Put(const WriteOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - const Slice& value) override { + virtual Status Put(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, const Slice& /*value*/) override { return Status::NotSupported("Not supported in compacted db mode."); } using DBImpl::Merge; - virtual Status Merge(const WriteOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - const Slice& value) override { + virtual Status Merge(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, const Slice& /*value*/) override { return Status::NotSupported("Not supported in compacted db mode."); } using DBImpl::Delete; - virtual Status Delete(const WriteOptions& options, - ColumnFamilyHandle* column_family, - const Slice& key) override { + virtual Status Delete(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/) override { return Status::NotSupported("Not supported in compacted db mode."); } - virtual Status Write(const WriteOptions& options, - WriteBatch* updates) override { + virtual Status Write(const WriteOptions& /*options*/, + WriteBatch* /*updates*/) override { return Status::NotSupported("Not supported in compacted db mode."); } using DBImpl::CompactRange; - virtual Status CompactRange(const CompactRangeOptions& options, - ColumnFamilyHandle* column_family, - const Slice* begin, const Slice* end) override { + virtual Status CompactRange(const CompactRangeOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice* /*begin*/, + const Slice* /*end*/) override { return Status::NotSupported("Not supported in compacted db mode."); } virtual Status DisableFileDeletions() override { return Status::NotSupported("Not supported in compacted db mode."); } - virtual Status EnableFileDeletions(bool force) override { + virtual Status EnableFileDeletions(bool /*force*/) override { return Status::NotSupported("Not supported in compacted db mode."); } virtual Status GetLiveFiles(std::vector&, - uint64_t* manifest_file_size, - bool flush_memtable = true) override { + uint64_t* /*manifest_file_size*/, + bool /*flush_memtable*/ = true) override { return Status::NotSupported("Not supported in compacted db mode."); } using DBImpl::Flush; - virtual Status Flush(const FlushOptions& options, - ColumnFamilyHandle* column_family) override { + virtual Status Flush(const FlushOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/) override { return Status::NotSupported("Not supported in compacted db mode."); } using DB::IngestExternalFile; virtual Status IngestExternalFile( - ColumnFamilyHandle* column_family, - const std::vector& external_files, - const IngestExternalFileOptions& ingestion_options) override { + ColumnFamilyHandle* /*column_family*/, + const std::vector& /*external_files*/, + const IngestExternalFileOptions& /*ingestion_options*/) override { return Status::NotSupported("Not supported in compacted db mode."); } diff --git a/db/compaction_iterator.cc b/db/compaction_iterator.cc index 08ae19734..211a48def 100644 --- a/db/compaction_iterator.cc +++ b/db/compaction_iterator.cc @@ -50,7 +50,7 @@ CompactionIterator::CompactionIterator( CompactionIterator::CompactionIterator( InternalIterator* input, const Comparator* cmp, MergeHelper* merge_helper, - SequenceNumber last_sequence, std::vector* snapshots, + SequenceNumber /*last_sequence*/, std::vector* snapshots, SequenceNumber earliest_write_conflict_snapshot, Env* env, bool expect_valid_internal_key, RangeDelAggregator* range_del_agg, std::unique_ptr compaction, diff --git a/db/compaction_iterator.h b/db/compaction_iterator.h index cad238666..492e53abf 100644 --- a/db/compaction_iterator.h +++ b/db/compaction_iterator.h @@ -31,7 +31,7 @@ class CompactionIterator { : compaction_(compaction) {} virtual ~CompactionProxy() = default; - virtual int level(size_t compaction_input_level = 0) const { + virtual int level(size_t /*compaction_input_level*/ = 0) const { return compaction_->level(); } virtual bool KeyNotExistsBeyondOutputLevel( diff --git a/db/compaction_iterator_test.cc b/db/compaction_iterator_test.cc index b625c99ff..7f2915b0a 100644 --- a/db/compaction_iterator_test.cc +++ b/db/compaction_iterator_test.cc @@ -17,15 +17,15 @@ namespace rocksdb { // Expects no merging attempts. class NoMergingMergeOp : public MergeOperator { public: - bool FullMergeV2(const MergeOperationInput& merge_in, - MergeOperationOutput* merge_out) const override { + bool FullMergeV2(const MergeOperationInput& /*merge_in*/, + MergeOperationOutput* /*merge_out*/) const override { ADD_FAILURE(); return false; } - bool PartialMergeMulti(const Slice& key, - const std::deque& operand_list, - std::string* new_value, - Logger* logger) const override { + bool PartialMergeMulti(const Slice& /*key*/, + const std::deque& /*operand_list*/, + std::string* /*new_value*/, + Logger* /*logger*/) const override { ADD_FAILURE(); return false; } @@ -39,9 +39,10 @@ class NoMergingMergeOp : public MergeOperator { // Always returns Decition::kRemove. class StallingFilter : public CompactionFilter { public: - virtual Decision FilterV2(int level, const Slice& key, ValueType t, - const Slice& existing_value, std::string* new_value, - std::string* skip_until) const override { + virtual Decision FilterV2(int /*level*/, const Slice& key, ValueType /*t*/, + const Slice& /*existing_value*/, + std::string* /*new_value*/, + std::string* /*skip_until*/) const override { int k = std::atoi(key.ToString().c_str()); last_seen.store(k); while (k >= stall_at.load()) { @@ -112,7 +113,7 @@ class LoggingForwardVectorIterator : public InternalIterator { keys_.begin(); } - virtual void SeekForPrev(const Slice& target) override { assert(false); } + virtual void SeekForPrev(const Slice& /*target*/) override { assert(false); } virtual void Next() override { assert(Valid()); @@ -144,9 +145,9 @@ class FakeCompaction : public CompactionIterator::CompactionProxy { public: FakeCompaction() = default; - virtual int level(size_t compaction_input_level) const { return 0; } + virtual int level(size_t /*compaction_input_level*/) const { return 0; } virtual bool KeyNotExistsBeyondOutputLevel( - const Slice& user_key, std::vector* level_ptrs) const { + const Slice& /*user_key*/, std::vector* /*level_ptrs*/) const { return key_not_exists_beyond_output_level; } virtual bool bottommost_level() const { return false; } @@ -276,9 +277,9 @@ TEST_F(CompactionIteratorTest, RangeDeletionWithSnapshots) { TEST_F(CompactionIteratorTest, CompactionFilterSkipUntil) { class Filter : public CompactionFilter { - virtual Decision FilterV2(int level, const Slice& key, ValueType t, + virtual Decision FilterV2(int /*level*/, const Slice& key, ValueType t, const Slice& existing_value, - std::string* new_value, + std::string* /*new_value*/, std::string* skip_until) const override { std::string k = key.ToString(); std::string v = existing_value.ToString(); diff --git a/db/compaction_job_stats_test.cc b/db/compaction_job_stats_test.cc index 9a8372f57..c20c120e5 100644 --- a/db/compaction_job_stats_test.cc +++ b/db/compaction_job_stats_test.cc @@ -426,7 +426,7 @@ class CompactionJobStatsChecker : public EventListener { // Once a compaction completed, this function will verify the returned // CompactionJobInfo with the oldest CompactionJobInfo added earlier // in "expected_stats_" which has not yet being used for verification. - virtual void OnCompactionCompleted(DB *db, const CompactionJobInfo& ci) { + virtual void OnCompactionCompleted(DB* /*db*/, const CompactionJobInfo& ci) { if (verify_next_comp_io_stats_) { ASSERT_GT(ci.stats.file_write_nanos, 0); ASSERT_GT(ci.stats.file_range_sync_nanos, 0); @@ -806,7 +806,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { stats_checker->set_verify_next_comp_io_stats(true); std::atomic first_prepare_write(true); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WritableFileWriter::Append:BeforePrepareWrite", [&](void* arg) { + "WritableFileWriter::Append:BeforePrepareWrite", [&](void* /*arg*/) { if (first_prepare_write.load()) { options.env->SleepForMicroseconds(3); first_prepare_write.store(false); @@ -815,7 +815,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { std::atomic first_flush(true); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WritableFileWriter::Flush:BeforeAppend", [&](void* arg) { + "WritableFileWriter::Flush:BeforeAppend", [&](void* /*arg*/) { if (first_flush.load()) { options.env->SleepForMicroseconds(3); first_flush.store(false); @@ -824,7 +824,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { std::atomic first_sync(true); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WritableFileWriter::SyncInternal:0", [&](void* arg) { + "WritableFileWriter::SyncInternal:0", [&](void* /*arg*/) { if (first_sync.load()) { options.env->SleepForMicroseconds(3); first_sync.store(false); @@ -833,7 +833,7 @@ TEST_P(CompactionJobStatsTest, CompactionJobStatsTest) { std::atomic first_range_sync(true); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "WritableFileWriter::RangeSync:0", [&](void* arg) { + "WritableFileWriter::RangeSync:0", [&](void* /*arg*/) { if (first_range_sync.load()) { options.env->SleepForMicroseconds(3); first_range_sync.store(false); diff --git a/db/compaction_picker.cc b/db/compaction_picker.cc index 6ee4ebd1f..7264ed20c 100644 --- a/db/compaction_picker.cc +++ b/db/compaction_picker.cc @@ -199,7 +199,7 @@ void CompactionPicker::GetRange(const std::vector& inputs, assert(initialized); } -bool CompactionPicker::ExpandInputsToCleanCut(const std::string& cf_name, +bool CompactionPicker::ExpandInputsToCleanCut(const std::string& /*cf_name*/, VersionStorageInfo* vstorage, CompactionInputFiles* inputs) { // This isn't good compaction @@ -318,7 +318,7 @@ Compaction* CompactionPicker::CompactFiles( Status CompactionPicker::GetCompactionInputsFromFileNumbers( std::vector* input_files, std::unordered_set* input_set, const VersionStorageInfo* vstorage, - const CompactionOptions& compact_options) const { + const CompactionOptions& /*compact_options*/) const { if (input_set->size() == 0U) { return Status::InvalidArgument( "Compaction must include at least one file."); @@ -1581,8 +1581,9 @@ Compaction* FIFOCompactionPicker::PickCompaction( Compaction* FIFOCompactionPicker::CompactRange( const std::string& cf_name, const MutableCFOptions& mutable_cf_options, VersionStorageInfo* vstorage, int input_level, int output_level, - uint32_t output_path_id, const InternalKey* begin, const InternalKey* end, - InternalKey** compaction_end, bool* manual_conflict) { + uint32_t /*output_path_id*/, const InternalKey* /*begin*/, + const InternalKey* /*end*/, InternalKey** compaction_end, + bool* /*manual_conflict*/) { assert(input_level == 0); assert(output_level == 0); *compaction_end = nullptr; diff --git a/db/compaction_picker.h b/db/compaction_picker.h index f44139c2d..44b93d774 100644 --- a/db/compaction_picker.h +++ b/db/compaction_picker.h @@ -263,27 +263,29 @@ class NullCompactionPicker : public CompactionPicker { virtual ~NullCompactionPicker() {} // Always return "nullptr" - Compaction* PickCompaction(const std::string& cf_name, - const MutableCFOptions& mutable_cf_options, - VersionStorageInfo* vstorage, - LogBuffer* log_buffer) override { + Compaction* PickCompaction(const std::string& /*cf_name*/, + const MutableCFOptions& /*mutable_cf_options*/, + VersionStorageInfo* /*vstorage*/, + LogBuffer* /*log_buffer*/) override { return nullptr; } // Always return "nullptr" - Compaction* CompactRange(const std::string& cf_name, - const MutableCFOptions& mutable_cf_options, - VersionStorageInfo* vstorage, int input_level, - int output_level, uint32_t output_path_id, - const InternalKey* begin, const InternalKey* end, - InternalKey** compaction_end, - bool* manual_conflict) override { + Compaction* CompactRange(const std::string& /*cf_name*/, + const MutableCFOptions& /*mutable_cf_options*/, + VersionStorageInfo* /*vstorage*/, + int /*input_level*/, int /*output_level*/, + uint32_t /*output_path_id*/, + const InternalKey* /*begin*/, + const InternalKey* /*end*/, + InternalKey** /*compaction_end*/, + bool* /*manual_conflict*/) override { return nullptr; } // Always returns false. virtual bool NeedsCompaction( - const VersionStorageInfo* vstorage) const override { + const VersionStorageInfo* /*vstorage*/) const override { return false; } }; diff --git a/db/compaction_picker_test.cc b/db/compaction_picker_test.cc index 1ced12cfd..7e9814517 100644 --- a/db/compaction_picker_test.cc +++ b/db/compaction_picker_test.cc @@ -20,7 +20,9 @@ namespace rocksdb { class CountingLogger : public Logger { public: using Logger::Logv; - virtual void Logv(const char* format, va_list ap) override { log_count++; } + virtual void Logv(const char* /*format*/, va_list /*ap*/) override { + log_count++; + } size_t log_count; }; diff --git a/db/comparator_db_test.cc b/db/comparator_db_test.cc index 28a2a5658..83740ffda 100644 --- a/db/comparator_db_test.cc +++ b/db/comparator_db_test.cc @@ -188,10 +188,10 @@ class DoubleComparator : public Comparator { return -1; } } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const override {} + virtual void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override {} - virtual void FindShortSuccessor(std::string* key) const override {} + virtual void FindShortSuccessor(std::string* /*key*/) const override {} }; class HashComparator : public Comparator { @@ -211,10 +211,10 @@ class HashComparator : public Comparator { return -1; } } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const override {} + virtual void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override {} - virtual void FindShortSuccessor(std::string* key) const override {} + virtual void FindShortSuccessor(std::string* /*key*/) const override {} }; class TwoStrComparator : public Comparator { @@ -243,10 +243,10 @@ class TwoStrComparator : public Comparator { } return a2.compare(b2); } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const override {} + virtual void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override {} - virtual void FindShortSuccessor(std::string* key) const override {} + virtual void FindShortSuccessor(std::string* /*key*/) const override {} }; } // namespace diff --git a/db/db_block_cache_test.cc b/db/db_block_cache_test.cc index 169cadc85..f4d61eefe 100644 --- a/db/db_block_cache_test.cc +++ b/db/db_block_cache_test.cc @@ -47,7 +47,7 @@ class DBBlockCacheTest : public DBTestBase { return options; } - void InitTable(const Options& options) { + void InitTable(const Options& /*options*/) { std::string value(kValueSize, 'a'); for (size_t i = 0; i < kNumBlocks; i++) { ASSERT_OK(Put(ToString(i), value.c_str())); diff --git a/db/db_bloom_filter_test.cc b/db/db_bloom_filter_test.cc index e6248a040..d4b034c53 100644 --- a/db/db_bloom_filter_test.cc +++ b/db/db_bloom_filter_test.cc @@ -1057,10 +1057,10 @@ TEST_F(DBBloomFilterTest, OptimizeFiltersForHits) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); CompactRangeOptions compact_options; diff --git a/db/db_compaction_filter_test.cc b/db/db_compaction_filter_test.cc index 9f751f059..a25adcc35 100644 --- a/db/db_compaction_filter_test.cc +++ b/db/db_compaction_filter_test.cc @@ -26,9 +26,9 @@ class DBTestCompactionFilter : public DBTestBase { class KeepFilter : public CompactionFilter { public: - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, bool* value_changed) const - override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { cfilter_count++; return false; } @@ -38,9 +38,9 @@ class KeepFilter : public CompactionFilter { class DeleteFilter : public CompactionFilter { public: - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, bool* value_changed) const - override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { cfilter_count++; return true; } @@ -50,9 +50,9 @@ class DeleteFilter : public CompactionFilter { class DeleteISFilter : public CompactionFilter { public: - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& key, const Slice& /*value*/, + std::string* /*new_value*/, + bool* /*value_changed*/) const override { cfilter_count++; int i = std::stoi(key.ToString()); if (i > 5 && i <= 105) { @@ -70,8 +70,10 @@ class DeleteISFilter : public CompactionFilter { // zero-padded to length 10. class SkipEvenFilter : public CompactionFilter { public: - virtual Decision FilterV2(int level, const Slice& key, ValueType value_type, - const Slice& existing_value, std::string* new_value, + virtual Decision FilterV2(int /*level*/, const Slice& key, + ValueType /*value_type*/, + const Slice& /*existing_value*/, + std::string* /*new_value*/, std::string* skip_until) const override { cfilter_count++; int i = std::stoi(key.ToString()); @@ -93,9 +95,9 @@ class SkipEvenFilter : public CompactionFilter { class DelayFilter : public CompactionFilter { public: explicit DelayFilter(DBTestBase* d) : db_test(d) {} - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { db_test->env_->addon_time_.fetch_add(1000); return true; } @@ -110,9 +112,9 @@ class ConditionalFilter : public CompactionFilter { public: explicit ConditionalFilter(const std::string* filtered_value) : filtered_value_(filtered_value) {} - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, const Slice& value, + std::string* /*new_value*/, + bool* /*value_changed*/) const override { return value.ToString() == *filtered_value_; } @@ -126,9 +128,9 @@ class ChangeFilter : public CompactionFilter { public: explicit ChangeFilter() {} - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, bool* value_changed) const - override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* new_value, + bool* value_changed) const override { assert(new_value != nullptr); *new_value = NEW_VALUE; *value_changed = true; @@ -217,7 +219,7 @@ class DelayFilterFactory : public CompactionFilterFactory { public: explicit DelayFilterFactory(DBTestBase* d) : db_test(d) {} virtual std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr(new DelayFilter(db_test)); } @@ -233,7 +235,7 @@ class ConditionalFilterFactory : public CompactionFilterFactory { : filtered_value_(filtered_value.ToString()) {} virtual std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr( new ConditionalFilter(&filtered_value_)); } @@ -251,7 +253,7 @@ class ChangeFilterFactory : public CompactionFilterFactory { explicit ChangeFilterFactory() {} virtual std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr(new ChangeFilter()); } diff --git a/db/db_compaction_test.cc b/db/db_compaction_test.cc index 4c7da8d1b..898db51ef 100644 --- a/db/db_compaction_test.cc +++ b/db/db_compaction_test.cc @@ -53,7 +53,7 @@ class FlushedFileCollector : public EventListener { FlushedFileCollector() {} ~FlushedFileCollector() {} - virtual void OnFlushCompleted(DB* db, const FlushJobInfo& info) override { + virtual void OnFlushCompleted(DB* /*db*/, const FlushJobInfo& info) override { std::lock_guard lock(mutex_); flushed_files_.push_back(info.file_path); } @@ -282,7 +282,7 @@ TEST_F(DBCompactionTest, TestTableReaderForCompaction) { }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "TableCache::GetTableReader:0", - [&](void* arg) { num_new_table_reader++; }); + [&](void* /*arg*/) { num_new_table_reader++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); for (int k = 0; k < options.level0_file_num_compaction_trigger; ++k) { @@ -838,7 +838,7 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveOneFile) { int32_t trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -895,10 +895,10 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveNonOverlappingFiles) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -994,10 +994,10 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveTargetLevel) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -1053,10 +1053,10 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); bool first = true; // Purpose of dependencies: // 4 -> 1: ensure the order of two non-trivial compactions @@ -1067,7 +1067,7 @@ TEST_P(DBCompactionTestWithParam, ManualCompactionPartial) { {"DBCompaction::ManualPartial:5", "DBCompaction::ManualPartial:2"}, {"DBCompaction::ManualPartial:5", "DBCompaction::ManualPartial:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (first) { first = false; TEST_SYNC_POINT("DBCompaction::ManualPartial:4"); @@ -1198,17 +1198,17 @@ TEST_F(DBCompactionTest, DISABLED_ManualPartialFill) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); bool first = true; bool second = true; rocksdb::SyncPoint::GetInstance()->LoadDependency( {{"DBCompaction::PartialFill:4", "DBCompaction::PartialFill:1"}, {"DBCompaction::PartialFill:2", "DBCompaction::PartialFill:3"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* arg) { + "DBImpl::BackgroundCompaction:NonTrivial:AfterRun", [&](void* /*arg*/) { if (first) { TEST_SYNC_POINT("DBCompaction::PartialFill:4"); first = false; @@ -1444,10 +1444,10 @@ TEST_P(DBCompactionTestWithParam, TrivialMoveToLastLevelWithFiles) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -2325,16 +2325,16 @@ TEST_P(DBCompactionTestWithParam, CompressLevelCompaction) { rocksdb::SyncPoint::GetInstance()->SetCallBack( "Compaction::InputCompressionMatchesOutput:Matches", - [&](void* arg) { matches++; }); + [&](void* /*arg*/) { matches++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "Compaction::InputCompressionMatchesOutput:DidntMatch", - [&](void* arg) { didnt_match++; }); + [&](void* /*arg*/) { didnt_match++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial++; }); + [&](void* /*arg*/) { non_trivial++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Reopen(options); @@ -2496,10 +2496,10 @@ TEST_P(DBCompactionTestWithParam, ForceBottommostLevelCompaction) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial_move++; }); + [&](void* /*arg*/) { non_trivial_move++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -2656,9 +2656,7 @@ TEST_P(DBCompactionDirectIOTest, DirectIO) { }); if (options.use_direct_io_for_flush_and_compaction) { SyncPoint::GetInstance()->SetCallBack( - "SanitizeOptions:direct_io", [&](void* arg) { - readahead = true; - }); + "SanitizeOptions:direct_io", [&](void* /*arg*/) { readahead = true; }); } SyncPoint::GetInstance()->EnableProcessing(); CreateAndReopenWithCF({"pikachu"}, options); diff --git a/db/db_dynamic_level_test.cc b/db/db_dynamic_level_test.cc index f968e7fc0..6542db18c 100644 --- a/db/db_dynamic_level_test.cc +++ b/db/db_dynamic_level_test.cc @@ -194,7 +194,7 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBase2) { // Hold compaction jobs to make sure rocksdb::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():Start", - [&](void* arg) { env_->SleepForMicroseconds(100000); }); + [&](void* /*arg*/) { env_->SleepForMicroseconds(100000); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(dbfull()->SetOptions({ {"disable_auto_compactions", "true"}, @@ -378,7 +378,7 @@ TEST_F(DBTestDynamicLevel, DynamicLevelMaxBytesBaseInc) { int non_trivial = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", - [&](void* arg) { non_trivial++; }); + [&](void* /*arg*/) { non_trivial++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Random rnd(301); diff --git a/db/db_flush_test.cc b/db/db_flush_test.cc index 107e82467..0dab8bfe5 100644 --- a/db/db_flush_test.cc +++ b/db/db_flush_test.cc @@ -101,7 +101,7 @@ TEST_F(DBFlushTest, FlushInLowPriThreadPool) { std::thread::id tid; int num_flushes = 0, num_compactions = 0; SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BGWorkFlush", [&](void* arg) { + "DBImpl::BGWorkFlush", [&](void* /*arg*/) { if (tid == std::thread::id()) { tid = std::this_thread::get_id(); } else { @@ -110,7 +110,7 @@ TEST_F(DBFlushTest, FlushInLowPriThreadPool) { ++num_flushes; }); SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BGWorkCompaction", [&](void* arg) { + "DBImpl::BGWorkCompaction", [&](void* /*arg*/) { ASSERT_EQ(tid, std::this_thread::get_id()); ++num_compactions; }); diff --git a/db/db_impl.cc b/db/db_impl.cc index f770b51ae..97f9b2024 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -595,8 +595,9 @@ Status DBImpl::SetDBOptions( } // return the same level if it cannot be moved -int DBImpl::FindMinimumEmptyLevelFitting(ColumnFamilyData* cfd, - const MutableCFOptions& mutable_cf_options, int level) { +int DBImpl::FindMinimumEmptyLevelFitting( + ColumnFamilyData* cfd, const MutableCFOptions& /*mutable_cf_options*/, + int level) { mutex_.AssertHeld(); const auto* vstorage = cfd->current()->storage_info(); int minimum_level = level; @@ -806,7 +807,7 @@ struct IterState { bool background_purge; }; -static void CleanupIteratorState(void* arg1, void* arg2) { +static void CleanupIteratorState(void* arg1, void* /*arg2*/) { IterState* state = reinterpret_cast(arg1); if (state->super_version->Unref()) { @@ -2190,31 +2191,31 @@ Status DBImpl::GetDbIdentity(std::string& identity) const { } // Default implementation -- returns not supported status -Status DB::CreateColumnFamily(const ColumnFamilyOptions& cf_options, - const std::string& column_family_name, - ColumnFamilyHandle** handle) { +Status DB::CreateColumnFamily(const ColumnFamilyOptions& /*cf_options*/, + const std::string& /*column_family_name*/, + ColumnFamilyHandle** /*handle*/) { return Status::NotSupported(""); } Status DB::CreateColumnFamilies( - const ColumnFamilyOptions& cf_options, - const std::vector& column_family_names, - std::vector* handles) { + const ColumnFamilyOptions& /*cf_options*/, + const std::vector& /*column_family_names*/, + std::vector* /*handles*/) { return Status::NotSupported(""); } Status DB::CreateColumnFamilies( - const std::vector& column_families, - std::vector* handles) { + const std::vector& /*column_families*/, + std::vector* /*handles*/) { return Status::NotSupported(""); } -Status DB::DropColumnFamily(ColumnFamilyHandle* column_family) { +Status DB::DropColumnFamily(ColumnFamilyHandle* /*column_family*/) { return Status::NotSupported(""); } Status DB::DropColumnFamilies( - const std::vector& column_families) { + const std::vector& /*column_families*/) { return Status::NotSupported(""); } diff --git a/db/db_impl_compaction_flush.cc b/db/db_impl_compaction_flush.cc index 68d283123..e04fc6ee9 100644 --- a/db/db_impl_compaction_flush.cc +++ b/db/db_impl_compaction_flush.cc @@ -779,7 +779,7 @@ int DBImpl::NumberLevels(ColumnFamilyHandle* column_family) { return cfh->cfd()->NumberLevels(); } -int DBImpl::MaxMemCompactionLevel(ColumnFamilyHandle* column_family) { +int DBImpl::MaxMemCompactionLevel(ColumnFamilyHandle* /*column_family*/) { return 0; } diff --git a/db/db_impl_readonly.cc b/db/db_impl_readonly.cc index d4fe7e702..e39703065 100644 --- a/db/db_impl_readonly.cc +++ b/db/db_impl_readonly.cc @@ -105,7 +105,7 @@ Status DBImplReadOnly::NewIterators( } Status DB::OpenForReadOnly(const Options& options, const std::string& dbname, - DB** dbptr, bool error_if_log_file_exist) { + DB** dbptr, bool /*error_if_log_file_exist*/) { *dbptr = nullptr; // Try to first open DB as fully compacted DB diff --git a/db/db_impl_readonly.h b/db/db_impl_readonly.h index 9bdc95cc8..35f2d1c85 100644 --- a/db/db_impl_readonly.h +++ b/db/db_impl_readonly.h @@ -36,46 +36,47 @@ class DBImplReadOnly : public DBImpl { std::vector* iterators) override; using DBImpl::Put; - virtual Status Put(const WriteOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - const Slice& value) override { + virtual Status Put(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, const Slice& /*value*/) override { return Status::NotSupported("Not supported operation in read only mode."); } using DBImpl::Merge; - virtual Status Merge(const WriteOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - const Slice& value) override { + virtual Status Merge(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, const Slice& /*value*/) override { return Status::NotSupported("Not supported operation in read only mode."); } using DBImpl::Delete; - virtual Status Delete(const WriteOptions& options, - ColumnFamilyHandle* column_family, - const Slice& key) override { + virtual Status Delete(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/) override { return Status::NotSupported("Not supported operation in read only mode."); } using DBImpl::SingleDelete; - virtual Status SingleDelete(const WriteOptions& options, - ColumnFamilyHandle* column_family, - const Slice& key) override { + virtual Status SingleDelete(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/) override { return Status::NotSupported("Not supported operation in read only mode."); } - virtual Status Write(const WriteOptions& options, - WriteBatch* updates) override { + virtual Status Write(const WriteOptions& /*options*/, + WriteBatch* /*updates*/) override { return Status::NotSupported("Not supported operation in read only mode."); } using DBImpl::CompactRange; - virtual Status CompactRange(const CompactRangeOptions& options, - ColumnFamilyHandle* column_family, - const Slice* begin, const Slice* end) override { + virtual Status CompactRange(const CompactRangeOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice* /*begin*/, + const Slice* /*end*/) override { return Status::NotSupported("Not supported operation in read only mode."); } using DBImpl::CompactFiles; virtual Status CompactFiles( - const CompactionOptions& compact_options, - ColumnFamilyHandle* column_family, - const std::vector& input_file_names, - const int output_level, const int output_path_id = -1) override { + const CompactionOptions& /*compact_options*/, + ColumnFamilyHandle* /*column_family*/, + const std::vector& /*input_file_names*/, + const int /*output_level*/, const int /*output_path_id*/ = -1) override { return Status::NotSupported("Not supported operation in read only mode."); } @@ -83,18 +84,18 @@ class DBImplReadOnly : public DBImpl { return Status::NotSupported("Not supported operation in read only mode."); } - virtual Status EnableFileDeletions(bool force) override { + virtual Status EnableFileDeletions(bool /*force*/) override { return Status::NotSupported("Not supported operation in read only mode."); } virtual Status GetLiveFiles(std::vector&, - uint64_t* manifest_file_size, - bool flush_memtable = true) override { + uint64_t* /*manifest_file_size*/, + bool /*flush_memtable*/ = true) override { return Status::NotSupported("Not supported operation in read only mode."); } using DBImpl::Flush; - virtual Status Flush(const FlushOptions& options, - ColumnFamilyHandle* column_family) override { + virtual Status Flush(const FlushOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/) override { return Status::NotSupported("Not supported operation in read only mode."); } @@ -105,9 +106,9 @@ class DBImplReadOnly : public DBImpl { using DB::IngestExternalFile; virtual Status IngestExternalFile( - ColumnFamilyHandle* column_family, - const std::vector& external_files, - const IngestExternalFileOptions& ingestion_options) override { + ColumnFamilyHandle* /*column_family*/, + const std::vector& /*external_files*/, + const IngestExternalFileOptions& /*ingestion_options*/) override { return Status::NotSupported("Not supported operation in read only mode."); } diff --git a/db/db_impl_write.cc b/db/db_impl_write.cc index f52bce611..2579cc87c 100644 --- a/db/db_impl_write.cc +++ b/db/db_impl_write.cc @@ -1002,7 +1002,7 @@ Status DBImpl::ScheduleFlushes(WriteContext* context) { } #ifndef ROCKSDB_LITE -void DBImpl::NotifyOnMemTableSealed(ColumnFamilyData* cfd, +void DBImpl::NotifyOnMemTableSealed(ColumnFamilyData* /*cfd*/, const MemTableInfo& mem_table_info) { if (immutable_db_options_.listeners.size() == 0U) { return; diff --git a/db/db_iter_test.cc b/db/db_iter_test.cc index 1b7c13b06..88493ccfb 100644 --- a/db/db_iter_test.cc +++ b/db/db_iter_test.cc @@ -2459,7 +2459,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace1) { // and before an SeekToLast() is called. rocksdb::SyncPoint::GetInstance()->SetCallBack( "MergeIterator::Prev:BeforeSeekToLast", - [&](void* arg) { internal_iter2_->Add("z", kTypeValue, "7", 12u); }); + [&](void* /*arg*/) { internal_iter2_->Add("z", kTypeValue, "7", 12u); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); db_iter_->Prev(); @@ -2494,7 +2494,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace2) { // mem table after MergeIterator::Prev() realized the mem tableiterator is at // its end and before an SeekToLast() is called. rocksdb::SyncPoint::GetInstance()->SetCallBack( - "MergeIterator::Prev:BeforeSeekToLast", [&](void* arg) { + "MergeIterator::Prev:BeforeSeekToLast", [&](void* /*arg*/) { internal_iter2_->Add("z", kTypeValue, "7", 12u); internal_iter2_->Add("z", kTypeValue, "7", 11u); }); @@ -2532,7 +2532,7 @@ TEST_F(DBIterWithMergeIterTest, InnerMergeIteratorDataRace3) { // mem table after MergeIterator::Prev() realized the mem table iterator is at // its end and before an SeekToLast() is called. rocksdb::SyncPoint::GetInstance()->SetCallBack( - "MergeIterator::Prev:BeforeSeekToLast", [&](void* arg) { + "MergeIterator::Prev:BeforeSeekToLast", [&](void* /*arg*/) { internal_iter2_->Add("z", kTypeValue, "7", 16u, true); internal_iter2_->Add("z", kTypeValue, "7", 15u, true); internal_iter2_->Add("z", kTypeValue, "7", 14u, true); diff --git a/db/db_iterator_test.cc b/db/db_iterator_test.cc index 90f43ea37..9d344e7af 100644 --- a/db/db_iterator_test.cc +++ b/db/db_iterator_test.cc @@ -24,7 +24,7 @@ class DBIteratorTest : public DBTestBase { class FlushBlockEveryKeyPolicy : public FlushBlockPolicy { public: - virtual bool Update(const Slice& key, const Slice& value) override { + virtual bool Update(const Slice& /*key*/, const Slice& /*value*/) override { if (!start_) { start_ = true; return false; @@ -44,8 +44,8 @@ class FlushBlockEveryKeyPolicyFactory : public FlushBlockPolicyFactory { } FlushBlockPolicy* NewFlushBlockPolicy( - const BlockBasedTableOptions& table_options, - const BlockBuilder& data_block_builder) const override { + const BlockBasedTableOptions& /*table_options*/, + const BlockBuilder& /*data_block_builder*/) const override { return new FlushBlockEveryKeyPolicy; } }; diff --git a/db/db_memtable_test.cc b/db/db_memtable_test.cc index 63d274f6a..5ce3e3191 100644 --- a/db/db_memtable_test.cc +++ b/db/db_memtable_test.cc @@ -121,7 +121,7 @@ class TestPrefixExtractor : public SliceTransform { return separator(key) != nullptr; } - virtual bool InRange(const Slice& key) const override { return false; } + virtual bool InRange(const Slice& /*key*/) const override { return false; } private: const char* separator(const Slice& key) const { diff --git a/db/db_properties_test.cc b/db/db_properties_test.cc index b09fe1ffa..2b099a39a 100644 --- a/db/db_properties_test.cc +++ b/db/db_properties_test.cc @@ -985,8 +985,9 @@ class CountingUserTblPropCollector : public TablePropertiesCollector { return Status::OK(); } - Status AddUserKey(const Slice& user_key, const Slice& value, EntryType type, - SequenceNumber seq, uint64_t file_size) override { + Status AddUserKey(const Slice& /*user_key*/, const Slice& /*value*/, + EntryType /*type*/, SequenceNumber /*seq*/, + uint64_t /*file_size*/) override { ++count_; return Status::OK(); } @@ -1027,8 +1028,9 @@ class CountingDeleteTabPropCollector : public TablePropertiesCollector { public: const char* Name() const override { return "CountingDeleteTabPropCollector"; } - Status AddUserKey(const Slice& user_key, const Slice& value, EntryType type, - SequenceNumber seq, uint64_t file_size) override { + Status AddUserKey(const Slice& /*user_key*/, const Slice& /*value*/, + EntryType type, SequenceNumber /*seq*/, + uint64_t /*file_size*/) override { if (type == kEntryDelete) { num_deletes_++; } @@ -1055,7 +1057,7 @@ class CountingDeleteTabPropCollectorFactory : public TablePropertiesCollectorFactory { public: virtual TablePropertiesCollector* CreateTablePropertiesCollector( - TablePropertiesCollectorFactory::Context context) override { + TablePropertiesCollectorFactory::Context /*context*/) override { return new CountingDeleteTabPropCollector(); } const char* Name() const override { diff --git a/db/db_sst_test.cc b/db/db_sst_test.cc index 73c6fe801..9427e0b5c 100644 --- a/db/db_sst_test.cc +++ b/db/db_sst_test.cc @@ -231,11 +231,12 @@ TEST_F(DBSSTTest, DBWithSstFileManager) { int files_deleted = 0; int files_moved = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( - "SstFileManagerImpl::OnAddFile", [&](void* arg) { files_added++; }); + "SstFileManagerImpl::OnAddFile", [&](void* /*arg*/) { files_added++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "SstFileManagerImpl::OnDeleteFile", [&](void* arg) { files_deleted++; }); + "SstFileManagerImpl::OnDeleteFile", + [&](void* /*arg*/) { files_deleted++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "SstFileManagerImpl::OnMoveFile", [&](void* arg) { files_moved++; }); + "SstFileManagerImpl::OnMoveFile", [&](void* /*arg*/) { files_moved++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -385,7 +386,7 @@ TEST_F(DBSSTTest, DeleteSchedulerMultipleDBPaths) { int bg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Options options = CurrentOptions(); @@ -453,7 +454,7 @@ TEST_F(DBSSTTest, DestroyDBWithRateLimitedDelete) { int bg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); Status s; @@ -546,7 +547,7 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) { rocksdb::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::FinishCompactionOutputFile:MaxAllowedSpaceReached", - [&](void* arg) { + [&](void* /*arg*/) { bg_error_set = true; GetAllSSTFiles(&total_sst_files_size); reached_max_space_on_compaction++; diff --git a/db/db_tailing_iter_test.cc b/db/db_tailing_iter_test.cc index d217828db..8301d5a92 100644 --- a/db/db_tailing_iter_test.cc +++ b/db/db_tailing_iter_test.cc @@ -157,10 +157,10 @@ TEST_F(DBTestTailingIterator, TailingIteratorTrimSeekToNext) { }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::RenewIterators:Null", - [&](void* arg) { file_iters_renewed_null = true; }); + [&](void* /*arg*/) { file_iters_renewed_null = true; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::RenewIterators:Copy", - [&](void* arg) { file_iters_renewed_copy = true; }); + [&](void* /*arg*/) { file_iters_renewed_copy = true; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); const int num_records = 1000; for (int i = 1; i < num_records; ++i) { @@ -415,7 +415,7 @@ TEST_F(DBTestTailingIterator, TailingIteratorUpperBound) { int immutable_seeks = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "ForwardIterator::SeekInternal:Immutable", - [&](void* arg) { ++immutable_seeks; }); + [&](void* /*arg*/) { ++immutable_seeks; }); // Seek to 13. This should not require any immutable seeks. rocksdb::SyncPoint::GetInstance()->EnableProcessing(); diff --git a/db/db_test.cc b/db/db_test.cc index e9840faa0..16d6580bb 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -231,11 +231,11 @@ TEST_F(DBTest, SkipDelay) { std::atomic sleep_count(0); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Sleep", - [&](void* arg) { sleep_count.fetch_add(1); }); + [&](void* /*arg*/) { sleep_count.fetch_add(1); }); std::atomic wait_count(0); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Wait", - [&](void* arg) { wait_count.fetch_add(1); }); + [&](void* /*arg*/) { wait_count.fetch_add(1); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); WriteOptions wo; @@ -715,9 +715,9 @@ TEST_F(DBTest, FlushSchedule) { namespace { class KeepFilter : public CompactionFilter { public: - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { return false; } @@ -747,9 +747,9 @@ class KeepFilterFactory : public CompactionFilterFactory { class DelayFilter : public CompactionFilter { public: explicit DelayFilter(DBTestBase* d) : db_test(d) {} - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { db_test->env_->addon_time_.fetch_add(1000); return true; } @@ -764,7 +764,7 @@ class DelayFilterFactory : public CompactionFilterFactory { public: explicit DelayFilterFactory(DBTestBase* d) : db_test(d) {} virtual std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr(new DelayFilter(db_test)); } @@ -2210,17 +2210,17 @@ class ModelDB : public DB { return Write(o, &batch); } using DB::Get; - virtual Status Get(const ReadOptions& options, ColumnFamilyHandle* cf, - const Slice& key, PinnableSlice* value) override { + virtual Status Get(const ReadOptions& /*options*/, ColumnFamilyHandle* /*cf*/, + const Slice& key, PinnableSlice* /*value*/) override { return Status::NotSupported(key); } using DB::MultiGet; virtual std::vector MultiGet( - const ReadOptions& options, - const std::vector& column_family, + const ReadOptions& /*options*/, + const std::vector& /*column_family*/, const std::vector& keys, - std::vector* values) override { + std::vector* /*values*/) override { std::vector s(keys.size(), Status::NotSupported("Not implemented.")); return s; @@ -2229,30 +2229,30 @@ class ModelDB : public DB { #ifndef ROCKSDB_LITE using DB::IngestExternalFile; virtual Status IngestExternalFile( - ColumnFamilyHandle* column_family, - const std::vector& external_files, - const IngestExternalFileOptions& options) override { + ColumnFamilyHandle* /*column_family*/, + const std::vector& /*external_files*/, + const IngestExternalFileOptions& /*options*/) override { return Status::NotSupported("Not implemented."); } using DB::GetPropertiesOfAllTables; virtual Status GetPropertiesOfAllTables( - ColumnFamilyHandle* column_family, - TablePropertiesCollection* props) override { + ColumnFamilyHandle* /*column_family*/, + TablePropertiesCollection* /*props*/) override { return Status(); } virtual Status GetPropertiesOfTablesInRange( - ColumnFamilyHandle* column_family, const Range* range, std::size_t n, - TablePropertiesCollection* props) override { + ColumnFamilyHandle* /*column_family*/, const Range* /*range*/, + std::size_t /*n*/, TablePropertiesCollection* /*props*/) override { return Status(); } #endif // ROCKSDB_LITE using DB::KeyMayExist; - virtual bool KeyMayExist(const ReadOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - std::string* value, + virtual bool KeyMayExist(const ReadOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, std::string* /*value*/, bool* value_found = nullptr) override { if (value_found != nullptr) { *value_found = false; @@ -2260,8 +2260,9 @@ class ModelDB : public DB { return true; // Not Supported directly } using DB::NewIterator; - virtual Iterator* NewIterator(const ReadOptions& options, - ColumnFamilyHandle* column_family) override { + virtual Iterator* NewIterator( + const ReadOptions& options, + ColumnFamilyHandle* /*column_family*/) override { if (options.snapshot == nullptr) { KVMap* saved = new KVMap; *saved = map_; @@ -2273,9 +2274,9 @@ class ModelDB : public DB { } } virtual Status NewIterators( - const ReadOptions& options, - const std::vector& column_family, - std::vector* iterators) override { + const ReadOptions& /*options*/, + const std::vector& /*column_family*/, + std::vector* /*iterators*/) override { return Status::NotSupported("Not supported yet"); } virtual const Snapshot* GetSnapshot() override { @@ -2288,7 +2289,7 @@ class ModelDB : public DB { delete reinterpret_cast(snapshot); } - virtual Status Write(const WriteOptions& options, + virtual Status Write(const WriteOptions& /*options*/, WriteBatch* batch) override { class Handler : public WriteBatch::Handler { public: @@ -2296,7 +2297,8 @@ class ModelDB : public DB { virtual void Put(const Slice& key, const Slice& value) override { (*map_)[key.ToString()] = value.ToString(); } - virtual void Merge(const Slice& key, const Slice& value) override { + virtual void Merge(const Slice& /*key*/, + const Slice& /*value*/) override { // ignore merge for now // (*map_)[key.ToString()] = value.ToString(); } @@ -2310,62 +2312,65 @@ class ModelDB : public DB { } using DB::GetProperty; - virtual bool GetProperty(ColumnFamilyHandle* column_family, - const Slice& property, std::string* value) override { + virtual bool GetProperty(ColumnFamilyHandle* /*column_family*/, + const Slice& /*property*/, + std::string* /*value*/) override { return false; } using DB::GetIntProperty; - virtual bool GetIntProperty(ColumnFamilyHandle* column_family, - const Slice& property, uint64_t* value) override { + virtual bool GetIntProperty(ColumnFamilyHandle* /*column_family*/, + const Slice& /*property*/, + uint64_t* /*value*/) override { return false; } using DB::GetMapProperty; - virtual bool GetMapProperty(ColumnFamilyHandle* column_family, - const Slice& property, - std::map* value) override { + virtual bool GetMapProperty( + ColumnFamilyHandle* /*column_family*/, const Slice& /*property*/, + std::map* /*value*/) override { return false; } using DB::GetAggregatedIntProperty; - virtual bool GetAggregatedIntProperty(const Slice& property, - uint64_t* value) override { + virtual bool GetAggregatedIntProperty(const Slice& /*property*/, + uint64_t* /*value*/) override { return false; } using DB::GetApproximateSizes; - virtual void GetApproximateSizes(ColumnFamilyHandle* column_family, - const Range* range, int n, uint64_t* sizes, - uint8_t include_flags + virtual void GetApproximateSizes(ColumnFamilyHandle* /*column_family*/, + const Range* /*range*/, int n, + uint64_t* sizes, + uint8_t /*include_flags*/ = INCLUDE_FILES) override { for (int i = 0; i < n; i++) { sizes[i] = 0; } } using DB::GetApproximateMemTableStats; - virtual void GetApproximateMemTableStats(ColumnFamilyHandle* column_family, - const Range& range, - uint64_t* const count, - uint64_t* const size) override { + virtual void GetApproximateMemTableStats( + ColumnFamilyHandle* /*column_family*/, const Range& /*range*/, + uint64_t* const count, uint64_t* const size) override { *count = 0; *size = 0; } using DB::CompactRange; - virtual Status CompactRange(const CompactRangeOptions& options, - ColumnFamilyHandle* column_family, - const Slice* start, const Slice* end) override { + virtual Status CompactRange(const CompactRangeOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice* /*start*/, + const Slice* /*end*/) override { return Status::NotSupported("Not supported operation."); } virtual Status SetDBOptions( - const std::unordered_map& new_options) + const std::unordered_map& /*new_options*/) override { return Status::NotSupported("Not supported operation."); } using DB::CompactFiles; - virtual Status CompactFiles(const CompactionOptions& compact_options, - ColumnFamilyHandle* column_family, - const std::vector& input_file_names, - const int output_level, - const int output_path_id = -1) override { + virtual Status CompactFiles( + const CompactionOptions& /*compact_options*/, + ColumnFamilyHandle* /*column_family*/, + const std::vector& /*input_file_names*/, + const int /*output_level*/, const int /*output_path_id*/ = -1) override { return Status::NotSupported("Not supported operation."); } @@ -2378,24 +2383,25 @@ class ModelDB : public DB { } Status EnableAutoCompaction( - const std::vector& column_family_handles) override { + const std::vector& /*column_family_handles*/) + override { return Status::NotSupported("Not supported operation."); } using DB::NumberLevels; - virtual int NumberLevels(ColumnFamilyHandle* column_family) override { + virtual int NumberLevels(ColumnFamilyHandle* /*column_family*/) override { return 1; } using DB::MaxMemCompactionLevel; virtual int MaxMemCompactionLevel( - ColumnFamilyHandle* column_family) override { + ColumnFamilyHandle* /*column_family*/) override { return 1; } using DB::Level0StopWriteTrigger; virtual int Level0StopWriteTrigger( - ColumnFamilyHandle* column_family) override { + ColumnFamilyHandle* /*column_family*/) override { return -1; } @@ -2404,7 +2410,8 @@ class ModelDB : public DB { virtual Env* GetEnv() const override { return nullptr; } using DB::GetOptions; - virtual Options GetOptions(ColumnFamilyHandle* column_family) const override { + virtual Options GetOptions( + ColumnFamilyHandle* /*column_family*/) const override { return options_; } @@ -2412,8 +2419,8 @@ class ModelDB : public DB { virtual DBOptions GetDBOptions() const override { return options_; } using DB::Flush; - virtual Status Flush(const rocksdb::FlushOptions& options, - ColumnFamilyHandle* column_family) override { + virtual Status Flush(const rocksdb::FlushOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/) override { Status ret; return ret; } @@ -2423,33 +2430,35 @@ class ModelDB : public DB { #ifndef ROCKSDB_LITE virtual Status DisableFileDeletions() override { return Status::OK(); } - virtual Status EnableFileDeletions(bool force) override { + virtual Status EnableFileDeletions(bool /*force*/) override { return Status::OK(); } - virtual Status GetLiveFiles(std::vector&, uint64_t* size, - bool flush_memtable = true) override { + virtual Status GetLiveFiles(std::vector&, uint64_t* /*size*/, + bool /*flush_memtable*/ = true) override { return Status::OK(); } - virtual Status GetSortedWalFiles(VectorLogPtr& files) override { + virtual Status GetSortedWalFiles(VectorLogPtr& /*files*/) override { return Status::OK(); } - virtual Status DeleteFile(std::string name) override { return Status::OK(); } + virtual Status DeleteFile(std::string /*name*/) override { + return Status::OK(); + } virtual Status GetUpdatesSince( rocksdb::SequenceNumber, unique_ptr*, - const TransactionLogIterator::ReadOptions& read_options = + const TransactionLogIterator::ReadOptions& /*read_options*/ = TransactionLogIterator::ReadOptions()) override { return Status::NotSupported("Not supported in Model DB"); } virtual void GetColumnFamilyMetaData( - ColumnFamilyHandle* column_family, - ColumnFamilyMetaData* metadata) override {} + ColumnFamilyHandle* /*column_family*/, + ColumnFamilyMetaData* /*metadata*/) override {} #endif // ROCKSDB_LITE - virtual Status GetDbIdentity(std::string& identity) const override { + virtual Status GetDbIdentity(std::string& /*identity*/) const override { return Status::OK(); } @@ -3322,7 +3331,7 @@ TEST_F(DBTest, DynamicMemtableOptions) { rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::DelayWrite:Wait", - [&](void* arg) { sleeping_task_low.WakeUp(); }); + [&](void* /*arg*/) { sleeping_task_low.WakeUp(); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); while (!sleeping_task_low.WokenUp() && count < 256) { @@ -4530,7 +4539,7 @@ class DelayedMergeOperator : public MergeOperator { public: explicit DelayedMergeOperator(DBTest* d) : db_test_(d) {} - virtual bool FullMergeV2(const MergeOperationInput& merge_in, + virtual bool FullMergeV2(const MergeOperationInput& /*merge_in*/, MergeOperationOutput* merge_out) const override { db_test_->env_->addon_time_.fetch_add(1000); merge_out->new_value = ""; @@ -4881,7 +4890,7 @@ TEST_F(DBTest, AutomaticConflictsWithManualCompaction) { std::atomic callback_count(0); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction()::Conflict", - [&](void* arg) { callback_count.fetch_add(1); }); + [&](void* /*arg*/) { callback_count.fetch_add(1); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); CompactRangeOptions croptions; croptions.exclusive_manual_compaction = false; @@ -5080,7 +5089,7 @@ TEST_F(DBTest, HardLimit) { std::atomic callback_count(0); rocksdb::SyncPoint::GetInstance()->SetCallBack("DBImpl::DelayWrite:Wait", - [&](void* arg) { + [&](void* /*arg*/) { callback_count.fetch_add(1); sleeping_task_low.WakeUp(); }); @@ -5173,7 +5182,7 @@ TEST_F(DBTest, SoftLimit) { // Only allow one compactin going through. rocksdb::SyncPoint::GetInstance()->SetCallBack( - "BackgroundCallCompaction:0", [&](void* arg) { + "BackgroundCallCompaction:0", [&](void* /*arg*/) { // Schedule a sleeping task. sleeping_task_low.Reset(); env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, diff --git a/db/db_test2.cc b/db/db_test2.cc index aa10789c8..32f2896cd 100644 --- a/db/db_test2.cc +++ b/db/db_test2.cc @@ -497,9 +497,9 @@ TEST_F(DBTest2, WalFilterTest) { apply_option_at_record_index_(apply_option_for_record_index), current_record_index_(0) {} - virtual WalProcessingOption LogRecord(const WriteBatch& batch, - WriteBatch* new_batch, - bool* batch_changed) const override { + virtual WalProcessingOption LogRecord( + const WriteBatch& /*batch*/, WriteBatch* /*new_batch*/, + bool* /*batch_changed*/) const override { WalFilter::WalProcessingOption option_to_return; if (current_record_index_ == apply_option_at_record_index_) { @@ -873,11 +873,10 @@ TEST_F(DBTest2, WalFilterTestWithColumnFamilies) { cf_name_id_map_ = cf_name_id_map; } - virtual WalProcessingOption LogRecordFound(unsigned long long log_number, - const std::string& log_file_name, - const WriteBatch& batch, - WriteBatch* new_batch, - bool* batch_changed) override { + virtual WalProcessingOption LogRecordFound( + unsigned long long log_number, const std::string& /*log_file_name*/, + const WriteBatch& batch, WriteBatch* /*new_batch*/, + bool* /*batch_changed*/) override { class LogRecordBatchHandler : public WriteBatch::Handler { private: const std::map & cf_log_number_map_; @@ -1212,7 +1211,7 @@ class CompactionStallTestListener : public EventListener { public: CompactionStallTestListener() : compacted_files_cnt_(0) {} - void OnCompactionCompleted(DB* db, const CompactionJobInfo& ci) override { + void OnCompactionCompleted(DB* /*db*/, const CompactionJobInfo& ci) override { ASSERT_EQ(ci.cf_name, "default"); ASSERT_EQ(ci.base_input_level, 0); ASSERT_EQ(ci.compaction_reason, CompactionReason::kLevelL0FilesNum); @@ -1673,7 +1672,7 @@ TEST_F(DBTest2, SyncPointMarker) { std::atomic sync_point_called(0); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBTest2::MarkedPoint", - [&](void* arg) { sync_point_called.fetch_add(1); }); + [&](void* /*arg*/) { sync_point_called.fetch_add(1); }); // The first dependency enforces Marker can be loaded before MarkedPoint. // The second checks that thread 1's MarkedPoint should be disabled here. @@ -1942,7 +1941,7 @@ TEST_F(DBTest2, AutomaticCompactionOverlapManualCompaction) { // can fit in L2, these 2 files will be moved to L2 and overlap with // the running compaction and break the LSM consistency. rocksdb::SyncPoint::GetInstance()->SetCallBack( - "CompactionJob::Run():Start", [&](void* arg) { + "CompactionJob::Run():Start", [&](void* /*arg*/) { ASSERT_OK( dbfull()->SetOptions({{"level0_file_num_compaction_trigger", "2"}, {"max_bytes_for_level_base", "1"}})); @@ -2008,7 +2007,7 @@ TEST_F(DBTest2, ManualCompactionOverlapManualCompaction) { // the running compaction and break the LSM consistency. std::atomic flag(false); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "CompactionJob::Run():Start", [&](void* arg) { + "CompactionJob::Run():Start", [&](void* /*arg*/) { if (flag.exchange(true)) { // We want to make sure to call this callback only once return; diff --git a/db/db_test_util.cc b/db/db_test_util.cc index 5ca4b19a2..966fec2cf 100644 --- a/db/db_test_util.cc +++ b/db/db_test_util.cc @@ -1127,17 +1127,18 @@ UpdateStatus DBTestBase::updateInPlaceSmallerVarintSize(char* prevValue, } } -UpdateStatus DBTestBase::updateInPlaceLargerSize(char* prevValue, - uint32_t* prevSize, +UpdateStatus DBTestBase::updateInPlaceLargerSize(char* /*prevValue*/, + uint32_t* /*prevSize*/, Slice delta, std::string* newValue) { *newValue = std::string(delta.size(), 'c'); return UpdateStatus::UPDATED; } -UpdateStatus DBTestBase::updateInPlaceNoAction(char* prevValue, - uint32_t* prevSize, Slice delta, - std::string* newValue) { +UpdateStatus DBTestBase::updateInPlaceNoAction(char* /*prevValue*/, + uint32_t* /*prevSize*/, + Slice /*delta*/, + std::string* /*newValue*/) { return UpdateStatus::UPDATE_FAILED; } diff --git a/db/db_test_util.h b/db/db_test_util.h index cd1265e21..70cc6fd70 100644 --- a/db/db_test_util.h +++ b/db/db_test_util.h @@ -187,7 +187,7 @@ class SpecialSkipListFactory : public MemTableRepFactory { using MemTableRepFactory::CreateMemTableRep; virtual MemTableRep* CreateMemTableRep( const MemTableRep::KeyComparator& compare, Allocator* allocator, - const SliceTransform* transform, Logger* logger) override { + const SliceTransform* transform, Logger* /*logger*/) override { return new SpecialMemTableRep( allocator, factory_.CreateMemTableRep(compare, allocator, transform, 0), num_entries_flush_); diff --git a/db/db_universal_compaction_test.cc b/db/db_universal_compaction_test.cc index c6334f8e0..c88bc30c1 100644 --- a/db/db_universal_compaction_test.cc +++ b/db/db_universal_compaction_test.cc @@ -56,9 +56,9 @@ void VerifyCompactionResult( class KeepFilter : public CompactionFilter { public: - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, bool* value_changed) const - override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { return false; } @@ -88,9 +88,9 @@ class KeepFilterFactory : public CompactionFilterFactory { class DelayFilter : public CompactionFilter { public: explicit DelayFilter(DBTestBase* d) : db_test(d) {} - virtual bool Filter(int level, const Slice& key, const Slice& value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { db_test->env_->addon_time_.fetch_add(1000); return true; } @@ -105,7 +105,7 @@ class DelayFilterFactory : public CompactionFilterFactory { public: explicit DelayFilterFactory(DBTestBase* d) : db_test(d) {} virtual std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr(new DelayFilter(db_test)); } @@ -522,7 +522,7 @@ TEST_P(DBTestUniversalCompactionMultiLevels, UniversalCompactionTrivialMove) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) { non_trivial_move++; @@ -593,23 +593,23 @@ TEST_P(DBTestUniversalCompactionParallel, UniversalCompactionParallel) { // Delay every compaction so multiple compactions will happen. std::atomic num_compactions_running(0); std::atomic has_parallel(false); - rocksdb::SyncPoint::GetInstance()->SetCallBack("CompactionJob::Run():Start", - [&](void* arg) { - if (num_compactions_running.fetch_add(1) > 0) { - has_parallel.store(true); - return; - } - for (int nwait = 0; nwait < 20000; nwait++) { - if (has_parallel.load() || num_compactions_running.load() > 1) { - has_parallel.store(true); - break; - } - env_->SleepForMicroseconds(1000); - } - }); + rocksdb::SyncPoint::GetInstance()->SetCallBack( + "CompactionJob::Run():Start", [&](void* /*arg*/) { + if (num_compactions_running.fetch_add(1) > 0) { + has_parallel.store(true); + return; + } + for (int nwait = 0; nwait < 20000; nwait++) { + if (has_parallel.load() || num_compactions_running.load() > 1) { + has_parallel.store(true); + break; + } + env_->SleepForMicroseconds(1000); + } + }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "CompactionJob::Run():End", - [&](void* arg) { num_compactions_running.fetch_add(-1); }); + [&](void* /*arg*/) { num_compactions_running.fetch_add(-1); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); options = CurrentOptions(options); @@ -984,7 +984,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest1) { int32_t non_trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) { non_trivial_move++; @@ -1030,7 +1030,7 @@ TEST_P(DBTestUniversalCompaction, UniversalCompactionTrivialMoveTest2) { int32_t trivial_move = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:TrivialMove", - [&](void* arg) { trivial_move++; }); + [&](void* /*arg*/) { trivial_move++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:NonTrivial", [&](void* arg) { ASSERT_TRUE(arg != nullptr); diff --git a/db/deletefile_test.cc b/db/deletefile_test.cc index 989c0c411..7a480fc46 100644 --- a/db/deletefile_test.cc +++ b/db/deletefile_test.cc @@ -159,7 +159,7 @@ class DeleteFileTest : public testing::Test { } // An empty job to guard all jobs are processed - static void GuardFinish(void* arg) { + static void GuardFinish(void* /*arg*/) { TEST_SYNC_POINT("DeleteFileTest::GuardFinish"); } }; diff --git a/db/external_sst_file_test.cc b/db/external_sst_file_test.cc index 4a4e82e79..0187265b6 100644 --- a/db/external_sst_file_test.cc +++ b/db/external_sst_file_test.cc @@ -395,8 +395,9 @@ class SstFileWriterCollector : public TablePropertiesCollector { return Status::OK(); } - Status AddUserKey(const Slice& user_key, const Slice& value, EntryType type, - SequenceNumber seq, uint64_t file_size) override { + Status AddUserKey(const Slice& /*user_key*/, const Slice& /*value*/, + EntryType /*type*/, SequenceNumber /*seq*/, + uint64_t /*file_size*/) override { ++count_; return Status::OK(); } @@ -416,7 +417,7 @@ class SstFileWriterCollectorFactory : public TablePropertiesCollectorFactory { explicit SstFileWriterCollectorFactory(std::string prefix) : prefix_(prefix), num_created_(0) {} virtual TablePropertiesCollector* CreateTablePropertiesCollector( - TablePropertiesCollectorFactory::Context context) override { + TablePropertiesCollectorFactory::Context /*context*/) override { num_created_++; return new SstFileWriterCollector(prefix_); } @@ -687,7 +688,7 @@ TEST_F(ExternalSSTFileTest, PurgeObsoleteFilesBug) { DestroyAndReopen(options); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::AddFile:FileCopied", [&](void* arg) { + "DBImpl::AddFile:FileCopied", [&](void* /*arg*/) { ASSERT_OK(Put("aaa", "bbb")); ASSERT_OK(Flush()); ASSERT_OK(Put("aaa", "xxx")); @@ -1126,7 +1127,7 @@ TEST_F(ExternalSSTFileTest, PickedLevelBug) { std::atomic bg_compact_started(false); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BackgroundCompaction:Start", - [&](void* arg) { bg_compact_started.store(true); }); + [&](void* /*arg*/) { bg_compact_started.store(true); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); @@ -1407,7 +1408,7 @@ TEST_F(ExternalSSTFileTest, AddFileTrivialMoveBug) { ASSERT_OK(GenerateAndAddExternalFile(options, {22, 23}, 6)); // L2 rocksdb::SyncPoint::GetInstance()->SetCallBack( - "CompactionJob::Run():Start", [&](void* arg) { + "CompactionJob::Run():Start", [&](void* /*arg*/) { // fit in L3 but will overlap with compaction so will be added // to L2 but a compaction will trivially move it to L3 // and break LSM consistency @@ -1797,7 +1798,7 @@ TEST_F(ExternalSSTFileTest, FileWithCFInfo) { class TestIngestExternalFileListener : public EventListener { public: - void OnExternalFileIngested(DB* db, + void OnExternalFileIngested(DB* /*db*/, const ExternalFileIngestionInfo& info) override { ingested_files.push_back(info); } diff --git a/db/fault_injection_test.cc b/db/fault_injection_test.cc index adfcb4db5..81ffae925 100644 --- a/db/fault_injection_test.cc +++ b/db/fault_injection_test.cc @@ -463,10 +463,10 @@ TEST_P(FaultInjectionTest, UninstalledCompaction) { std::atomic opened(false); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::Open:Opened", [&](void* arg) { opened.store(true); }); + "DBImpl::Open:Opened", [&](void* /*arg*/) { opened.store(true); }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DBImpl::BGWorkCompaction", - [&](void* arg) { ASSERT_TRUE(opened.load()); }); + [&](void* /*arg*/) { ASSERT_TRUE(opened.load()); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(OpenDB()); ASSERT_OK(Verify(0, kNumKeys, FaultInjectionTest::kValExpectFound)); diff --git a/db/file_indexer_test.cc b/db/file_indexer_test.cc index 5cd8c2d2c..b424f91ea 100644 --- a/db/file_indexer_test.cc +++ b/db/file_indexer_test.cc @@ -36,10 +36,10 @@ class IntComparator : public Comparator { const char* Name() const override { return "IntComparator"; } - void FindShortestSeparator(std::string* start, - const Slice& limit) const override {} + void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override {} - void FindShortSuccessor(std::string* key) const override {} + void FindShortSuccessor(std::string* /*key*/) const override {} }; class FileIndexerTest : public testing::Test { diff --git a/db/forward_iterator.cc b/db/forward_iterator.cc index 65fff9595..affeca018 100644 --- a/db/forward_iterator.cc +++ b/db/forward_iterator.cc @@ -104,7 +104,7 @@ class LevelIterator : public InternalIterator { file_iter_->Seek(internal_key); valid_ = file_iter_->Valid(); } - void SeekForPrev(const Slice& internal_key) override { + void SeekForPrev(const Slice& /*internal_key*/) override { status_ = Status::NotSupported("LevelIterator::SeekForPrev()"); valid_ = false; } diff --git a/db/forward_iterator.h b/db/forward_iterator.h index d4f32cba9..8946b7b75 100644 --- a/db/forward_iterator.h +++ b/db/forward_iterator.h @@ -55,7 +55,7 @@ class ForwardIterator : public InternalIterator { ColumnFamilyData* cfd, SuperVersion* current_sv = nullptr); virtual ~ForwardIterator(); - void SeekForPrev(const Slice& target) override { + void SeekForPrev(const Slice& /*target*/) override { status_ = Status::NotSupported("ForwardIterator::SeekForPrev()"); valid_ = false; } diff --git a/db/internal_stats.cc b/db/internal_stats.cc index 54723ea91..70bd9523f 100644 --- a/db/internal_stats.cc +++ b/db/internal_stats.cc @@ -435,7 +435,7 @@ bool InternalStats::GetStringProperty(const DBPropertyInfo& property_info, } bool InternalStats::GetMapProperty(const DBPropertyInfo& property_info, - const Slice& property, + const Slice& /*property*/, std::map* value) { assert(value != nullptr); assert(property_info.handle_map != nullptr); @@ -487,7 +487,7 @@ bool InternalStats::HandleCompressionRatioAtLevelPrefix(std::string* value, return true; } -bool InternalStats::HandleLevelStats(std::string* value, Slice suffix) { +bool InternalStats::HandleLevelStats(std::string* value, Slice /*suffix*/) { char buf[1000]; const auto* vstorage = cfd_->current()->storage_info(); snprintf(buf, sizeof(buf), @@ -519,35 +519,36 @@ bool InternalStats::HandleCFMapStats(std::map* cf_stats) { return true; } -bool InternalStats::HandleCFStats(std::string* value, Slice suffix) { +bool InternalStats::HandleCFStats(std::string* value, Slice /*suffix*/) { DumpCFStats(value); return true; } bool InternalStats::HandleCFStatsNoFileHistogram(std::string* value, - Slice suffix) { + Slice /*suffix*/) { DumpCFStatsNoFileHistogram(value); return true; } -bool InternalStats::HandleCFFileHistogram(std::string* value, Slice suffix) { +bool InternalStats::HandleCFFileHistogram(std::string* value, + Slice /*suffix*/) { DumpCFFileHistogram(value); return true; } -bool InternalStats::HandleDBStats(std::string* value, Slice suffix) { +bool InternalStats::HandleDBStats(std::string* value, Slice /*suffix*/) { DumpDBStats(value); return true; } -bool InternalStats::HandleSsTables(std::string* value, Slice suffix) { +bool InternalStats::HandleSsTables(std::string* value, Slice /*suffix*/) { auto* current = cfd_->current(); *value = current->DebugString(true, true); return true; } bool InternalStats::HandleAggregatedTableProperties(std::string* value, - Slice suffix) { + Slice /*suffix*/) { std::shared_ptr tp; auto s = cfd_->current()->GetAggregatedTableProperties(&tp); if (!s.ok()) { @@ -574,34 +575,34 @@ bool InternalStats::HandleAggregatedTablePropertiesAtLevel(std::string* value, return true; } -bool InternalStats::HandleNumImmutableMemTable(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleNumImmutableMemTable(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { *value = cfd_->imm()->NumNotFlushed(); return true; } bool InternalStats::HandleNumImmutableMemTableFlushed(uint64_t* value, - DBImpl* db, - Version* version) { + DBImpl* /*db*/, + Version* /*version*/) { *value = cfd_->imm()->NumFlushed(); return true; } -bool InternalStats::HandleMemTableFlushPending(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleMemTableFlushPending(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { // Return number of mem tables that are ready to flush (made immutable) *value = (cfd_->imm()->IsFlushPending() ? 1 : 0); return true; } bool InternalStats::HandleNumRunningFlushes(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = db->num_running_flushes(); return true; } -bool InternalStats::HandleCompactionPending(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleCompactionPending(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { // 1 if the system already determines at least one compaction is needed. // 0 otherwise, const auto* vstorage = cfd_->current()->storage_info(); @@ -610,70 +611,74 @@ bool InternalStats::HandleCompactionPending(uint64_t* value, DBImpl* db, } bool InternalStats::HandleNumRunningCompactions(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = db->num_running_compactions_; return true; } -bool InternalStats::HandleBackgroundErrors(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleBackgroundErrors(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { // Accumulated number of errors in background flushes or compactions. *value = GetBackgroundErrorCount(); return true; } -bool InternalStats::HandleCurSizeActiveMemTable(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleCurSizeActiveMemTable(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { // Current size of the active memtable *value = cfd_->mem()->ApproximateMemoryUsage(); return true; } -bool InternalStats::HandleCurSizeAllMemTables(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleCurSizeAllMemTables(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { // Current size of the active memtable + immutable memtables *value = cfd_->mem()->ApproximateMemoryUsage() + cfd_->imm()->ApproximateUnflushedMemTablesMemoryUsage(); return true; } -bool InternalStats::HandleSizeAllMemTables(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleSizeAllMemTables(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { *value = cfd_->mem()->ApproximateMemoryUsage() + cfd_->imm()->ApproximateMemoryUsage(); return true; } -bool InternalStats::HandleNumEntriesActiveMemTable(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleNumEntriesActiveMemTable(uint64_t* value, + DBImpl* /*db*/, + Version* /*version*/) { // Current number of entires in the active memtable *value = cfd_->mem()->num_entries(); return true; } -bool InternalStats::HandleNumEntriesImmMemTables(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleNumEntriesImmMemTables(uint64_t* value, + DBImpl* /*db*/, + Version* /*version*/) { // Current number of entries in the immutable memtables *value = cfd_->imm()->current()->GetTotalNumEntries(); return true; } -bool InternalStats::HandleNumDeletesActiveMemTable(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleNumDeletesActiveMemTable(uint64_t* value, + DBImpl* /*db*/, + Version* /*version*/) { // Current number of entires in the active memtable *value = cfd_->mem()->num_deletes(); return true; } -bool InternalStats::HandleNumDeletesImmMemTables(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleNumDeletesImmMemTables(uint64_t* value, + DBImpl* /*db*/, + Version* /*version*/) { // Current number of entries in the immutable memtables *value = cfd_->imm()->current()->GetTotalNumDeletes(); return true; } -bool InternalStats::HandleEstimateNumKeys(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleEstimateNumKeys(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { // Estimate number of entries in the column family: // Use estimated entries in tables + total entries in memtables. const auto* vstorage = cfd_->current()->storage_info(); @@ -689,77 +694,79 @@ bool InternalStats::HandleEstimateNumKeys(uint64_t* value, DBImpl* db, } bool InternalStats::HandleNumSnapshots(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = db->snapshots().count(); return true; } bool InternalStats::HandleOldestSnapshotTime(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = static_cast(db->snapshots().GetOldestSnapshotTime()); return true; } -bool InternalStats::HandleNumLiveVersions(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleNumLiveVersions(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { *value = cfd_->GetNumLiveVersions(); return true; } -bool InternalStats::HandleCurrentSuperVersionNumber(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleCurrentSuperVersionNumber(uint64_t* value, + DBImpl* /*db*/, + Version* /*version*/) { *value = cfd_->GetSuperVersionNumber(); return true; } bool InternalStats::HandleIsFileDeletionsEnabled(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = db->IsFileDeletionsEnabled(); return true; } -bool InternalStats::HandleBaseLevel(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleBaseLevel(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { const auto* vstorage = cfd_->current()->storage_info(); *value = vstorage->base_level(); return true; } -bool InternalStats::HandleTotalSstFilesSize(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleTotalSstFilesSize(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { *value = cfd_->GetTotalSstFilesSize(); return true; } bool InternalStats::HandleEstimatePendingCompactionBytes(uint64_t* value, - DBImpl* db, - Version* version) { + DBImpl* /*db*/, + Version* /*version*/) { const auto* vstorage = cfd_->current()->storage_info(); *value = vstorage->estimated_compaction_needed_bytes(); return true; } -bool InternalStats::HandleEstimateTableReadersMem(uint64_t* value, DBImpl* db, +bool InternalStats::HandleEstimateTableReadersMem(uint64_t* value, + DBImpl* /*db*/, Version* version) { *value = (version == nullptr) ? 0 : version->GetMemoryUsageByTableReaders(); return true; } -bool InternalStats::HandleEstimateLiveDataSize(uint64_t* value, DBImpl* db, - Version* version) { +bool InternalStats::HandleEstimateLiveDataSize(uint64_t* value, DBImpl* /*db*/, + Version* /*version*/) { const auto* vstorage = cfd_->current()->storage_info(); *value = vstorage->EstimateLiveDataSize(); return true; } bool InternalStats::HandleMinLogNumberToKeep(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = db->MinLogNumberToKeep(); return true; } bool InternalStats::HandleActualDelayedWriteRate(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { const WriteController& wc = db->write_controller(); if (!wc.NeedsDelay()) { *value = 0; @@ -770,7 +777,7 @@ bool InternalStats::HandleActualDelayedWriteRate(uint64_t* value, DBImpl* db, } bool InternalStats::HandleIsWriteStopped(uint64_t* value, DBImpl* db, - Version* version) { + Version* /*version*/) { *value = db->write_controller().IsStopped() ? 1 : 0; return true; } diff --git a/db/listener_test.cc b/db/listener_test.cc index 5b5f2266b..0ab129b11 100644 --- a/db/listener_test.cc +++ b/db/listener_test.cc @@ -46,11 +46,11 @@ class EventListenerTest : public DBTestBase { }; struct TestPropertiesCollector : public rocksdb::TablePropertiesCollector { - virtual rocksdb::Status AddUserKey(const rocksdb::Slice& key, - const rocksdb::Slice& value, - rocksdb::EntryType type, - rocksdb::SequenceNumber seq, - uint64_t file_size) override { + virtual rocksdb::Status AddUserKey(const rocksdb::Slice& /*key*/, + const rocksdb::Slice& /*value*/, + rocksdb::EntryType /*type*/, + rocksdb::SequenceNumber /*seq*/, + uint64_t /*file_size*/) override { return Status::OK(); } virtual rocksdb::Status Finish( @@ -73,7 +73,7 @@ struct TestPropertiesCollector : public rocksdb::TablePropertiesCollector { class TestPropertiesCollectorFactory : public TablePropertiesCollectorFactory { public: virtual TablePropertiesCollector* CreateTablePropertiesCollector( - TablePropertiesCollectorFactory::Context context) override { + TablePropertiesCollectorFactory::Context /*context*/) override { return new TestPropertiesCollector; } const char* Name() const override { return "TestTablePropertiesCollector"; } @@ -425,7 +425,7 @@ TEST_F(EventListenerTest, DisableBGCompaction) { class TestCompactionReasonListener : public EventListener { public: - void OnCompactionCompleted(DB* db, const CompactionJobInfo& ci) override { + void OnCompactionCompleted(DB* /*db*/, const CompactionJobInfo& ci) override { std::lock_guard lock(mutex_); compaction_reasons_.push_back(ci.compaction_reason); } @@ -807,7 +807,8 @@ class BackgroundErrorListener : public EventListener { public: BackgroundErrorListener(SpecialEnv* env) : env_(env), counter_(0) {} - void OnBackgroundError(BackgroundErrorReason reason, Status* bg_error) override { + void OnBackgroundError(BackgroundErrorReason /*reason*/, + Status* bg_error) override { if (counter_ == 0) { // suppress the first error and disable write-dropping such that a retry // can succeed. diff --git a/db/malloc_stats.cc b/db/malloc_stats.cc index 7acca6512..6ea0d5e47 100644 --- a/db/malloc_stats.cc +++ b/db/malloc_stats.cc @@ -36,7 +36,7 @@ static void GetJemallocStatus(void* mstat_arg, const char* status) { } #endif // ROCKSDB_JEMALLOC -void DumpMallocStats(std::string* stats) { +void DumpMallocStats(std::string* /*stats*/) { #ifdef ROCKSDB_JEMALLOC MallocStatus mstat; const unsigned int kMallocStatusLen = 1000000; diff --git a/db/manual_compaction_test.cc b/db/manual_compaction_test.cc index 039b9080e..f31a50b81 100644 --- a/db/manual_compaction_test.cc +++ b/db/manual_compaction_test.cc @@ -46,9 +46,9 @@ class DestroyAllCompactionFilter : public CompactionFilter { public: DestroyAllCompactionFilter() {} - virtual bool Filter(int level, const Slice& key, const Slice& existing_value, - std::string* new_value, - bool* value_changed) const override { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& existing_value, std::string* /*new_value*/, + bool* /*value_changed*/) const override { return existing_value.ToString() == "destroy"; } diff --git a/db/memtable_list.cc b/db/memtable_list.cc index 8f710c2e9..f7e434580 100644 --- a/db/memtable_list.cc +++ b/db/memtable_list.cc @@ -152,7 +152,7 @@ bool MemTableListVersion::GetFromList(std::list* list, } Status MemTableListVersion::AddRangeTombstoneIterators( - const ReadOptions& read_opts, Arena* arena, + const ReadOptions& read_opts, Arena* /*arena*/, RangeDelAggregator* range_del_agg) { assert(range_del_agg != nullptr); for (auto& m : memlist_) { @@ -298,7 +298,7 @@ void MemTableList::PickMemtablesToFlush(autovector* ret) { } void MemTableList::RollbackMemtableFlush(const autovector& mems, - uint64_t file_number) { + uint64_t /*file_number*/) { AutoThreadOperationStageUpdater stage_updater( ThreadStatus::STAGE_MEMTABLE_ROLLBACK); assert(!mems.empty()); diff --git a/db/merge_test.cc b/db/merge_test.cc index b6582b7a5..c1b0cbfae 100644 --- a/db/merge_test.cc +++ b/db/merge_test.cc @@ -504,7 +504,7 @@ void runTest(int argc, const std::string& dbname, const bool use_ttl = false) { } } // namespace -int main(int argc, char *argv[]) { +int main(int argc, char* /*argv*/ []) { //TODO: Make this test like a general rocksdb unit-test rocksdb::port::InstallStackTraceHandler(); runTest(argc, test::TmpDir() + "/merge_testdb"); diff --git a/db/plain_table_db_test.cc b/db/plain_table_db_test.cc index 0b60332e5..8fae9746d 100644 --- a/db/plain_table_db_test.cc +++ b/db/plain_table_db_test.cc @@ -327,7 +327,7 @@ class TestPlainTableFactory : public PlainTableFactory { const TableReaderOptions& table_reader_options, unique_ptr&& file, uint64_t file_size, unique_ptr* table, - bool prefetch_index_and_filter_in_cache) const override { + bool /*prefetch_index_and_filter_in_cache*/) const override { TableProperties* props = nullptr; auto s = ReadTableProperties(file.get(), file_size, kPlainTableMagicNumber, diff --git a/db/prefix_test.cc b/db/prefix_test.cc index a4ed201da..6ac3ffb5d 100644 --- a/db/prefix_test.cc +++ b/db/prefix_test.cc @@ -126,10 +126,10 @@ class TestKeyComparator : public Comparator { return "TestKeyComparator"; } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const override {} + virtual void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override {} - virtual void FindShortSuccessor(std::string* key) const override {} + virtual void FindShortSuccessor(std::string* /*key*/) const override {} }; namespace { diff --git a/db/table_cache.cc b/db/table_cache.cc index 4dc56935f..60092ff61 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -30,7 +30,7 @@ namespace rocksdb { namespace { template -static void DeleteEntry(const Slice& key, void* value) { +static void DeleteEntry(const Slice& /*key*/, void* value) { T* typed_value = reinterpret_cast(value); delete typed_value; } @@ -41,7 +41,7 @@ static void UnrefEntry(void* arg1, void* arg2) { cache->Release(h); } -static void DeleteTableReader(void* arg1, void* arg2) { +static void DeleteTableReader(void* arg1, void* /*arg2*/) { TableReader* table_reader = reinterpret_cast(arg1); delete table_reader; } diff --git a/db/table_properties_collector.cc b/db/table_properties_collector.cc index a1f4dba97..ed9f223cd 100644 --- a/db/table_properties_collector.cc +++ b/db/table_properties_collector.cc @@ -12,8 +12,8 @@ namespace rocksdb { Status InternalKeyPropertiesCollector::InternalAdd(const Slice& key, - const Slice& value, - uint64_t file_size) { + const Slice& /*value*/, + uint64_t /*file_size*/) { ParsedInternalKey ikey; if (!ParseInternalKey(key, &ikey)) { return Status::InvalidArgument("Invalid internal key"); diff --git a/db/table_properties_collector.h b/db/table_properties_collector.h index d8cd75689..7216ec319 100644 --- a/db/table_properties_collector.h +++ b/db/table_properties_collector.h @@ -73,7 +73,7 @@ class InternalKeyPropertiesCollectorFactory : public IntTblPropCollectorFactory { public: virtual IntTblPropCollector* CreateIntTblPropCollector( - uint32_t column_family_id) override { + uint32_t /*column_family_id*/) override { return new InternalKeyPropertiesCollector(); } diff --git a/db/table_properties_collector_test.cc b/db/table_properties_collector_test.cc index 66c66c025..bf382b4fd 100644 --- a/db/table_properties_collector_test.cc +++ b/db/table_properties_collector_test.cc @@ -82,8 +82,9 @@ class RegularKeysStartWithA: public TablePropertiesCollector { return Status::OK(); } - Status AddUserKey(const Slice& user_key, const Slice& value, EntryType type, - SequenceNumber seq, uint64_t file_size) override { + Status AddUserKey(const Slice& user_key, const Slice& /*value*/, + EntryType type, SequenceNumber /*seq*/, + uint64_t file_size) override { // simply asssume all user keys are not empty. if (user_key.data()[0] == 'A') { ++count_; @@ -133,7 +134,7 @@ class RegularKeysStartWithABackwardCompatible return Status::OK(); } - Status Add(const Slice& user_key, const Slice& value) override { + Status Add(const Slice& user_key, const Slice& /*value*/) override { // simply asssume all user keys are not empty. if (user_key.data()[0] == 'A') { ++count_; @@ -161,8 +162,8 @@ class RegularKeysStartWithAInternal : public IntTblPropCollector { return Status::OK(); } - Status InternalAdd(const Slice& user_key, const Slice& value, - uint64_t file_size) override { + Status InternalAdd(const Slice& user_key, const Slice& /*value*/, + uint64_t /*file_size*/) override { // simply asssume all user keys are not empty. if (user_key.data()[0] == 'A') { ++count_; @@ -193,7 +194,7 @@ class RegularKeysStartWithAFactory : public IntTblPropCollectorFactory, } } virtual IntTblPropCollector* CreateIntTblPropCollector( - uint32_t column_family_id) override { + uint32_t /*column_family_id*/) override { return new RegularKeysStartWithAInternal(); } const char* Name() const override { return "RegularKeysStartWithA"; } @@ -203,7 +204,7 @@ class RegularKeysStartWithAFactory : public IntTblPropCollectorFactory, class FlushBlockEveryThreePolicy : public FlushBlockPolicy { public: - virtual bool Update(const Slice& key, const Slice& value) override { + virtual bool Update(const Slice& /*key*/, const Slice& /*value*/) override { return (++count_ % 3U == 0); } @@ -220,8 +221,8 @@ class FlushBlockEveryThreePolicyFactory : public FlushBlockPolicyFactory { } FlushBlockPolicy* NewFlushBlockPolicy( - const BlockBasedTableOptions& table_options, - const BlockBuilder& data_block_builder) const override { + const BlockBasedTableOptions& /*table_options*/, + const BlockBuilder& /*data_block_builder*/) const override { return new FlushBlockEveryThreePolicy; } }; diff --git a/db/version_builder.cc b/db/version_builder.cc index bab8d11f5..48264d4d7 100644 --- a/db/version_builder.cc +++ b/db/version_builder.cc @@ -185,7 +185,7 @@ class VersionBuilder::Rep { } } - void CheckConsistencyForDeletes(VersionEdit* edit, uint64_t number, + void CheckConsistencyForDeletes(VersionEdit* /*edit*/, uint64_t number, int level) { #ifdef NDEBUG if (!base_vstorage_->force_consistency_checks()) { diff --git a/db/version_edit.cc b/db/version_edit.cc index b01f7bbdf..ebfc10584 100644 --- a/db/version_edit.cc +++ b/db/version_edit.cc @@ -198,7 +198,7 @@ static bool GetInternalKey(Slice* input, InternalKey* dst) { } } -bool VersionEdit::GetLevel(Slice* input, int* level, const char** msg) { +bool VersionEdit::GetLevel(Slice* input, int* level, const char** /*msg*/) { uint32_t v; if (GetVarint32(input, &v)) { *level = v; diff --git a/db/version_set.cc b/db/version_set.cc index 0069d86c1..aea3a62fa 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -528,9 +528,7 @@ class LevelFileIteratorState : public TwoLevelIteratorState { for_compaction_, nullptr /* arena */, skip_filters_, level_); } - bool PrefixMayMatch(const Slice& internal_key) override { - return true; - } + bool PrefixMayMatch(const Slice& /*internal_key*/) override { return true; } bool KeyReachedUpperBound(const Slice& internal_key) override { return read_options_.iterate_upper_bound != nullptr && @@ -2656,7 +2654,7 @@ void VersionSet::LogAndApplyCFHelper(VersionEdit* edit) { } void VersionSet::LogAndApplyHelper(ColumnFamilyData* cfd, - VersionBuilder* builder, Version* v, + VersionBuilder* builder, Version* /*v*/, VersionEdit* edit, InstrumentedMutex* mu) { mu->AssertHeld(); assert(!edit->IsColumnFamilyManipulation()); diff --git a/db/version_set.h b/db/version_set.h index 5a1f8d07d..1e60098a6 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -792,7 +792,7 @@ class VersionSet { struct LogReporter : public log::Reader::Reporter { Status* status; - virtual void Corruption(size_t bytes, const Status& s) override { + virtual void Corruption(size_t /*bytes*/, const Status& s) override { if (this->status->ok()) *this->status = s; } }; diff --git a/db/version_set_test.cc b/db/version_set_test.cc index 625d45922..090e074cf 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -76,7 +76,9 @@ class CountingLogger : public Logger { public: CountingLogger() : log_count(0) {} using Logger::Logv; - virtual void Logv(const char* format, va_list ap) override { log_count++; } + virtual void Logv(const char* /*format*/, va_list /*ap*/) override { + log_count++; + } int log_count; }; diff --git a/db/wal_manager_test.cc b/db/wal_manager_test.cc index 9f5cf273d..b0d8beee8 100644 --- a/db/wal_manager_test.cc +++ b/db/wal_manager_test.cc @@ -72,7 +72,7 @@ class WalManagerTest : public testing::Test { } // NOT thread safe - void RollTheLog(bool archived) { + void RollTheLog(bool /*archived*/) { current_log_number_++; std::string fname = ArchivedLogFileName(dbname_, current_log_number_); unique_ptr file; diff --git a/db/write_batch.cc b/db/write_batch.cc index 91be9a0df..042be5ab2 100644 --- a/db/write_batch.cc +++ b/db/write_batch.cc @@ -171,7 +171,7 @@ WriteBatch::~WriteBatch() { delete save_points_; } WriteBatch::Handler::~Handler() { } -void WriteBatch::Handler::LogData(const Slice& blob) { +void WriteBatch::Handler::LogData(const Slice& /*blob*/) { // If the user has not specified something to do with blobs, then we ignore // them. } @@ -469,7 +469,7 @@ void WriteBatchInternal::SetSequence(WriteBatch* b, SequenceNumber seq) { EncodeFixed64(&b->rep_[0], seq); } -size_t WriteBatchInternal::GetFirstOffset(WriteBatch* b) { +size_t WriteBatchInternal::GetFirstOffset(WriteBatch* /*b*/) { return WriteBatchInternal::kHeader; } @@ -1003,7 +1003,7 @@ public: return Status::OK(); } - Status DeleteImpl(uint32_t column_family_id, const Slice& key, + Status DeleteImpl(uint32_t /*column_family_id*/, const Slice& key, const Slice& value, ValueType delete_type) { MemTable* mem = cf_mems_->GetMemTable(); mem->Add(sequence_, delete_type, key, value, concurrent_memtable_writes_, diff --git a/db/write_batch_test.cc b/db/write_batch_test.cc index 4fd156d9b..6f1196345 100644 --- a/db/write_batch_test.cc +++ b/db/write_batch_test.cc @@ -434,7 +434,7 @@ TEST_F(WriteBatchTest, DISABLED_ManyUpdates) { struct NoopHandler : public WriteBatch::Handler { uint32_t num_seen = 0; char expected_char = 'A'; - virtual Status PutCF(uint32_t column_family_id, const Slice& key, + virtual Status PutCF(uint32_t /*column_family_id*/, const Slice& key, const Slice& value) override { EXPECT_EQ(kKeyValueSize, key.size()); EXPECT_EQ(kKeyValueSize, value.size()); @@ -449,22 +449,22 @@ TEST_F(WriteBatchTest, DISABLED_ManyUpdates) { ++num_seen; return Status::OK(); } - virtual Status DeleteCF(uint32_t column_family_id, - const Slice& key) override { + virtual Status DeleteCF(uint32_t /*column_family_id*/, + const Slice& /*key*/) override { ADD_FAILURE(); return Status::OK(); } - virtual Status SingleDeleteCF(uint32_t column_family_id, - const Slice& key) override { + virtual Status SingleDeleteCF(uint32_t /*column_family_id*/, + const Slice& /*key*/) override { ADD_FAILURE(); return Status::OK(); } - virtual Status MergeCF(uint32_t column_family_id, const Slice& key, - const Slice& value) override { + virtual Status MergeCF(uint32_t /*column_family_id*/, const Slice& /*key*/, + const Slice& /*value*/) override { ADD_FAILURE(); return Status::OK(); } - virtual void LogData(const Slice& blob) override { ADD_FAILURE(); } + virtual void LogData(const Slice& /*blob*/) override { ADD_FAILURE(); } virtual bool Continue() override { return num_seen < kNumUpdates; } } handler; @@ -489,7 +489,7 @@ TEST_F(WriteBatchTest, DISABLED_LargeKeyValue) { struct NoopHandler : public WriteBatch::Handler { int num_seen = 0; - virtual Status PutCF(uint32_t column_family_id, const Slice& key, + virtual Status PutCF(uint32_t /*column_family_id*/, const Slice& key, const Slice& value) override { EXPECT_EQ(kKeyValueSize, key.size()); EXPECT_EQ(kKeyValueSize, value.size()); @@ -500,22 +500,22 @@ TEST_F(WriteBatchTest, DISABLED_LargeKeyValue) { ++num_seen; return Status::OK(); } - virtual Status DeleteCF(uint32_t column_family_id, - const Slice& key) override { + virtual Status DeleteCF(uint32_t /*column_family_id*/, + const Slice& /*key*/) override { ADD_FAILURE(); return Status::OK(); } - virtual Status SingleDeleteCF(uint32_t column_family_id, - const Slice& key) override { + virtual Status SingleDeleteCF(uint32_t /*column_family_id*/, + const Slice& /*key*/) override { ADD_FAILURE(); return Status::OK(); } - virtual Status MergeCF(uint32_t column_family_id, const Slice& key, - const Slice& value) override { + virtual Status MergeCF(uint32_t /*column_family_id*/, const Slice& /*key*/, + const Slice& /*value*/) override { ADD_FAILURE(); return Status::OK(); } - virtual void LogData(const Slice& blob) override { ADD_FAILURE(); } + virtual void LogData(const Slice& /*blob*/) override { ADD_FAILURE(); } virtual bool Continue() override { return num_seen < 2; } } handler; diff --git a/db/write_callback_test.cc b/db/write_callback_test.cc index 9edf1c158..41488b8c7 100644 --- a/db/write_callback_test.cc +++ b/db/write_callback_test.cc @@ -55,9 +55,7 @@ class WriteCallbackTestWriteCallback1 : public WriteCallback { class WriteCallbackTestWriteCallback2 : public WriteCallback { public: - Status Callback(DB *db) override { - return Status::Busy(); - } + Status Callback(DB* /*db*/) override { return Status::Busy(); } bool AllowWriteBatching() override { return true; } }; @@ -75,7 +73,7 @@ class MockWriteCallback : public WriteCallback { was_called_.store(other.was_called_.load()); } - Status Callback(DB* db) override { + Status Callback(DB* /*db*/) override { was_called_.store(true); if (should_fail_) { return Status::Busy(); diff --git a/db/write_thread.cc b/db/write_thread.cc index 706346996..6d466e4fd 100644 --- a/db/write_thread.cc +++ b/db/write_thread.cc @@ -434,7 +434,8 @@ void WriteThread::EnterAsMemTableWriter(Writer* leader, last_writer->sequence + WriteBatchInternal::Count(last_writer->batch) - 1; } -void WriteThread::ExitAsMemTableWriter(Writer* self, WriteGroup& write_group) { +void WriteThread::ExitAsMemTableWriter(Writer* /*self*/, + WriteGroup& write_group) { Writer* leader = write_group.leader; Writer* last_writer = write_group.last_writer; diff --git a/env/env_encryption.cc b/env/env_encryption.cc index 6b688a660..ff7f08107 100644 --- a/env/env_encryption.cc +++ b/env/env_encryption.cc @@ -844,7 +844,9 @@ static void decodeCTRParameters(const char *prefix, size_t blockSize, uint64_t & // CreateNewPrefix initialized an allocated block of prefix memory // for a new file. -Status CTREncryptionProvider::CreateNewPrefix(const std::string& fname, char *prefix, size_t prefixLength) { +Status CTREncryptionProvider::CreateNewPrefix(const std::string& /*fname*/, + char* prefix, + size_t prefixLength) { // Create & seed rnd. Random rnd((uint32_t)Env::Default()->NowMicros()); // Fill entire prefix block with random values. @@ -873,7 +875,9 @@ Status CTREncryptionProvider::CreateNewPrefix(const std::string& fname, char *pr // in plain text. // Returns the amount of space (starting from the start of the prefix) // that has been initialized. -size_t CTREncryptionProvider::PopulateSecretPrefixPart(char *prefix, size_t prefixLength, size_t blockSize) { +size_t CTREncryptionProvider::PopulateSecretPrefixPart(char* /*prefix*/, + size_t /*prefixLength*/, + size_t /*blockSize*/) { // Nothing to do here, put in custom data in override when needed. return 0; } @@ -898,8 +902,10 @@ Status CTREncryptionProvider::CreateCipherStream(const std::string& fname, const // CreateCipherStreamFromPrefix creates a block access cipher stream for a file given // given name and options. The given prefix is already decrypted. -Status CTREncryptionProvider::CreateCipherStreamFromPrefix(const std::string& fname, const EnvOptions& options, - uint64_t initialCounter, const Slice& iv, const Slice& prefix, unique_ptr* result) { +Status CTREncryptionProvider::CreateCipherStreamFromPrefix( + const std::string& /*fname*/, const EnvOptions& /*options*/, + uint64_t initialCounter, const Slice& iv, const Slice& /*prefix*/, + unique_ptr* result) { (*result) = unique_ptr(new CTRCipherStream(cipher_, iv.data(), initialCounter)); return Status::OK(); } diff --git a/env/env_hdfs.cc b/env/env_hdfs.cc index d98020c76..6dbbd8627 100644 --- a/env/env_hdfs.cc +++ b/env/env_hdfs.cc @@ -598,13 +598,13 @@ Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { // dummy placeholders used when HDFS is not available namespace rocksdb { - Status HdfsEnv::NewSequentialFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& options) { - return Status::NotSupported("Not compiled with hdfs support"); +Status HdfsEnv::NewSequentialFile(const std::string& /*fname*/, + unique_ptr* /*result*/, + const EnvOptions& /*options*/) { + return Status::NotSupported("Not compiled with hdfs support"); } - Status NewHdfsEnv(Env** hdfs_env, const std::string& fsname) { + Status NewHdfsEnv(Env** /*hdfs_env*/, const std::string& /*fsname*/) { return Status::NotSupported("Not compiled with hdfs support"); } } diff --git a/env/env_test.cc b/env/env_test.cc index 7fd71a3c4..8606bb12a 100644 --- a/env/env_test.cc +++ b/env/env_test.cc @@ -1248,33 +1248,36 @@ TEST_P(EnvPosixTestWithParam, WritableFileWrapper) { inc(0); } - Status Append(const Slice& data) override { inc(1); return Status::OK(); } - Status Truncate(uint64_t size) override { return Status::OK(); } + Status Append(const Slice& /*data*/) override { + inc(1); + return Status::OK(); + } + Status Truncate(uint64_t /*size*/) override { return Status::OK(); } Status Close() override { inc(2); return Status::OK(); } Status Flush() override { inc(3); return Status::OK(); } Status Sync() override { inc(4); return Status::OK(); } Status Fsync() override { inc(5); return Status::OK(); } - void SetIOPriority(Env::IOPriority pri) override { inc(6); } + void SetIOPriority(Env::IOPriority /*pri*/) override { inc(6); } uint64_t GetFileSize() override { inc(7); return 0; } - void GetPreallocationStatus(size_t* block_size, - size_t* last_allocated_block) override { + void GetPreallocationStatus(size_t* /*block_size*/, + size_t* /*last_allocated_block*/) override { inc(8); } - size_t GetUniqueId(char* id, size_t max_size) const override { + size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const override { inc(9); return 0; } - Status InvalidateCache(size_t offset, size_t length) override { + Status InvalidateCache(size_t /*offset*/, size_t /*length*/) override { inc(10); return Status::OK(); } protected: - Status Allocate(uint64_t offset, uint64_t len) override { + Status Allocate(uint64_t /*offset*/, uint64_t /*len*/) override { inc(11); return Status::OK(); } - Status RangeSync(uint64_t offset, uint64_t nbytes) override { + Status RangeSync(uint64_t /*offset*/, uint64_t /*nbytes*/) override { inc(12); return Status::OK(); } diff --git a/env/io_posix.cc b/env/io_posix.cc index c5b14d3ef..cf96795c4 100644 --- a/env/io_posix.cc +++ b/env/io_posix.cc @@ -443,7 +443,7 @@ PosixMmapReadableFile::~PosixMmapReadableFile() { } Status PosixMmapReadableFile::Read(uint64_t offset, size_t n, Slice* result, - char* scratch) const { + char* /*scratch*/) const { Status s; if (offset > length_) { *result = Slice(); @@ -922,7 +922,7 @@ size_t PosixWritableFile::GetUniqueId(char* id, size_t max_size) const { */ PosixRandomRWFile::PosixRandomRWFile(const std::string& fname, int fd, - const EnvOptions& options) + const EnvOptions& /*options*/) : filename_(fname), fd_(fd) {} PosixRandomRWFile::~PosixRandomRWFile() { diff --git a/env/io_posix.h b/env/io_posix.h index 69c98438f..e83f2df73 100644 --- a/env/io_posix.h +++ b/env/io_posix.h @@ -201,7 +201,7 @@ class PosixMmapFile : public WritableFile { // Means Close() will properly take care of truncate // and it does not need any additional information - virtual Status Truncate(uint64_t size) override { return Status::OK(); } + virtual Status Truncate(uint64_t /*size*/) override { return Status::OK(); } virtual Status Close() override; virtual Status Append(const Slice& data) override; virtual Status Flush() override; diff --git a/env/mock_env.cc b/env/mock_env.cc index 79a4f8c44..b59047bde 100644 --- a/env/mock_env.cc +++ b/env/mock_env.cc @@ -445,8 +445,8 @@ MockEnv::~MockEnv() { // Partial implementation of the Env interface. Status MockEnv::NewSequentialFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& soptions) { + unique_ptr* result, + const EnvOptions& /*soptions*/) { auto fn = NormalizePath(fname); MutexLock lock(&mutex_); if (file_map_.find(fn) == file_map_.end()) { @@ -462,8 +462,8 @@ Status MockEnv::NewSequentialFile(const std::string& fname, } Status MockEnv::NewRandomAccessFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& soptions) { + unique_ptr* result, + const EnvOptions& /*soptions*/) { auto fn = NormalizePath(fname); MutexLock lock(&mutex_); if (file_map_.find(fn) == file_map_.end()) { @@ -480,7 +480,7 @@ Status MockEnv::NewRandomAccessFile(const std::string& fname, Status MockEnv::NewRandomRWFile(const std::string& fname, unique_ptr* result, - const EnvOptions& soptions) { + const EnvOptions& /*soptions*/) { auto fn = NormalizePath(fname); MutexLock lock(&mutex_); if (file_map_.find(fn) == file_map_.end()) { @@ -523,8 +523,8 @@ Status MockEnv::NewWritableFile(const std::string& fname, return Status::OK(); } -Status MockEnv::NewDirectory(const std::string& name, - unique_ptr* result) { +Status MockEnv::NewDirectory(const std::string& /*name*/, + unique_ptr* result) { result->reset(new MockEnvDirectory()); return Status::OK(); } diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h index 3a62bc8cb..2ed6ba6d8 100644 --- a/hdfs/env_hdfs.h +++ b/hdfs/env_hdfs.h @@ -245,7 +245,7 @@ static const Status notsup; class HdfsEnv : public Env { public: - explicit HdfsEnv(const std::string& fsname) { + explicit HdfsEnv(const std::string& /*fsname*/) { fprintf(stderr, "You have not build rocksdb with HDFS support\n"); fprintf(stderr, "Please see hdfs/README for details\n"); abort(); @@ -258,112 +258,125 @@ class HdfsEnv : public Env { unique_ptr* result, const EnvOptions& options) override; - virtual Status NewRandomAccessFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& options) override { + virtual Status NewRandomAccessFile(const std::string& /*fname*/, + unique_ptr* /*result*/, + const EnvOptions& /*options*/) override { return notsup; } - virtual Status NewWritableFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& options) override { + virtual Status NewWritableFile(const std::string& /*fname*/, + unique_ptr* /*result*/, + const EnvOptions& /*options*/) override { return notsup; } - virtual Status NewDirectory(const std::string& name, - unique_ptr* result) override { + virtual Status NewDirectory(const std::string& /*name*/, + unique_ptr* /*result*/) override { return notsup; } - virtual Status FileExists(const std::string& fname) override { + virtual Status FileExists(const std::string& /*fname*/) override { return notsup; } - virtual Status GetChildren(const std::string& path, - std::vector* result) override { + virtual Status GetChildren(const std::string& /*path*/, + std::vector* /*result*/) override { return notsup; } - virtual Status DeleteFile(const std::string& fname) override { + virtual Status DeleteFile(const std::string& /*fname*/) override { return notsup; } - virtual Status CreateDir(const std::string& name) override { return notsup; } + virtual Status CreateDir(const std::string& /*name*/) override { + return notsup; + } - virtual Status CreateDirIfMissing(const std::string& name) override { + virtual Status CreateDirIfMissing(const std::string& /*name*/) override { return notsup; } - virtual Status DeleteDir(const std::string& name) override { return notsup; } + virtual Status DeleteDir(const std::string& /*name*/) override { + return notsup; + } - virtual Status GetFileSize(const std::string& fname, - uint64_t* size) override { + virtual Status GetFileSize(const std::string& /*fname*/, + uint64_t* /*size*/) override { return notsup; } - virtual Status GetFileModificationTime(const std::string& fname, - uint64_t* time) override { + virtual Status GetFileModificationTime(const std::string& /*fname*/, + uint64_t* /*time*/) override { return notsup; } - virtual Status RenameFile(const std::string& src, - const std::string& target) override { + virtual Status RenameFile(const std::string& /*src*/, + const std::string& /*target*/) override { return notsup; } - virtual Status LinkFile(const std::string& src, - const std::string& target) override { + virtual Status LinkFile(const std::string& /*src*/, + const std::string& /*target*/) override { return notsup; } - virtual Status LockFile(const std::string& fname, FileLock** lock) override { + virtual Status LockFile(const std::string& /*fname*/, + FileLock** /*lock*/) override { return notsup; } - virtual Status UnlockFile(FileLock* lock) override { return notsup; } + virtual Status UnlockFile(FileLock* /*lock*/) override { return notsup; } - virtual Status NewLogger(const std::string& fname, - shared_ptr* result) override { + virtual Status NewLogger(const std::string& /*fname*/, + shared_ptr* /*result*/) override { return notsup; } - virtual void Schedule(void (*function)(void* arg), void* arg, - Priority pri = LOW, void* tag = nullptr, - void (*unschedFunction)(void* arg) = 0) override {} + virtual void Schedule(void (*/*function*/)(void* arg), void* /*arg*/, + Priority /*pri*/ = LOW, void* /*tag*/ = nullptr, + void (*/*unschedFunction*/)(void* arg) = 0) override {} - virtual int UnSchedule(void* tag, Priority pri) override { return 0; } + virtual int UnSchedule(void* /*tag*/, Priority /*pri*/) override { return 0; } - virtual void StartThread(void (*function)(void* arg), void* arg) override {} + virtual void StartThread(void (*/*function*/)(void* arg), + void* /*arg*/) override {} virtual void WaitForJoin() override {} virtual unsigned int GetThreadPoolQueueLen( - Priority pri = LOW) const override { + Priority /*pri*/ = LOW) const override { return 0; } - virtual Status GetTestDirectory(std::string* path) override { return notsup; } + virtual Status GetTestDirectory(std::string* /*path*/) override { + return notsup; + } virtual uint64_t NowMicros() override { return 0; } - virtual void SleepForMicroseconds(int micros) override {} + virtual void SleepForMicroseconds(int /*micros*/) override {} - virtual Status GetHostName(char* name, uint64_t len) override { + virtual Status GetHostName(char* /*name*/, uint64_t /*len*/) override { return notsup; } - virtual Status GetCurrentTime(int64_t* unix_time) override { return notsup; } + virtual Status GetCurrentTime(int64_t* /*unix_time*/) override { + return notsup; + } - virtual Status GetAbsolutePath(const std::string& db_path, - std::string* outputpath) override { + virtual Status GetAbsolutePath(const std::string& /*db_path*/, + std::string* /*outputpath*/) override { return notsup; } - virtual void SetBackgroundThreads(int number, Priority pri = LOW) override {} - virtual int GetBackgroundThreads(Priority pri = LOW) override { return 0; } - virtual void IncBackgroundThreadsIfNeeded(int number, Priority pri) override { + virtual void SetBackgroundThreads(int /*number*/, + Priority /*pri*/ = LOW) override {} + virtual int GetBackgroundThreads(Priority /*pri*/ = LOW) override { + return 0; } - virtual std::string TimeToString(uint64_t number) override { return ""; } + virtual void IncBackgroundThreadsIfNeeded(int /*number*/, + Priority /*pri*/) override {} + virtual std::string TimeToString(uint64_t /*number*/) override { return ""; } virtual uint64_t GetThreadID() const override { return 0; diff --git a/include/rocksdb/cache.h b/include/rocksdb/cache.h index 5ebd66bde..88efdb05e 100644 --- a/include/rocksdb/cache.h +++ b/include/rocksdb/cache.h @@ -189,7 +189,8 @@ class Cache { // Mark the last inserted object as being a raw data block. This will be used // in tests. The default implementation does nothing. - virtual void TEST_mark_as_data_block(const Slice& key, size_t charge) {} + virtual void TEST_mark_as_data_block(const Slice& /*key*/, + size_t /*charge*/) {} private: // No copying allowed diff --git a/include/rocksdb/compaction_filter.h b/include/rocksdb/compaction_filter.h index 9a8c0318c..94069a914 100644 --- a/include/rocksdb/compaction_filter.h +++ b/include/rocksdb/compaction_filter.h @@ -97,8 +97,10 @@ class CompactionFilter { // The last paragraph is not true if you set max_subcompactions to more than // 1. In that case, subcompaction from multiple threads may call a single // CompactionFilter concurrently. - virtual bool Filter(int level, const Slice& key, const Slice& existing_value, - std::string* new_value, bool* value_changed) const { + virtual bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*existing_value*/, + std::string* /*new_value*/, + bool* /*value_changed*/) const { return false; } @@ -111,8 +113,8 @@ class CompactionFilter { // may not realize there is a write conflict and may allow a Transaction to // Commit that should have failed. Instead, it is better to implement any // Merge filtering inside the MergeOperator. - virtual bool FilterMergeOperand(int level, const Slice& key, - const Slice& operand) const { + virtual bool FilterMergeOperand(int /*level*/, const Slice& /*key*/, + const Slice& /*operand*/) const { return false; } @@ -157,7 +159,7 @@ class CompactionFilter { // MergeOperator. virtual Decision FilterV2(int level, const Slice& key, ValueType value_type, const Slice& existing_value, std::string* new_value, - std::string* skip_until) const { + std::string* /*skip_until*/) const { switch (value_type) { case ValueType::kValue: { bool value_changed = false; diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index ee5706b4c..7c1cc316e 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -855,7 +855,7 @@ class DB { // Flush the WAL memory buffer to the file. If sync is true, it calls SyncWAL // afterwards. - virtual Status FlushWAL(bool sync) { + virtual Status FlushWAL(bool /*sync*/) { return Status::NotSupported("FlushWAL not implemented"); } // Sync the wal. Note that Write() followed by SyncWAL() is not exactly the diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index 869073899..78864dd79 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -170,9 +170,9 @@ class Env { // returns non-OK. // // The returned file will only be accessed by one thread at a time. - virtual Status ReopenWritableFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& options) { + virtual Status ReopenWritableFile(const std::string& /*fname*/, + unique_ptr* /*result*/, + const EnvOptions& /*options*/) { return Status::NotSupported(); } @@ -187,9 +187,9 @@ class Env { // *result and returns OK. On failure returns non-OK. // // The returned file will only be accessed by one thread at a time. - virtual Status NewRandomRWFile(const std::string& fname, - unique_ptr* result, - const EnvOptions& options) { + virtual Status NewRandomRWFile(const std::string& /*fname*/, + unique_ptr* /*result*/, + const EnvOptions& /*options*/) { return Status::NotSupported("RandomRWFile is not implemented in this Env"); } @@ -257,7 +257,8 @@ class Env { const std::string& target) = 0; // Hard Link file src to target. - virtual Status LinkFile(const std::string& src, const std::string& target) { + virtual Status LinkFile(const std::string& /*src*/, + const std::string& /*target*/) { return Status::NotSupported("LinkFile is not supported for this Env"); } @@ -308,7 +309,7 @@ class Env { // Arrange to remove jobs for given arg from the queue_ if they are not // already scheduled. Caller is expected to have exclusive lock on arg. - virtual int UnSchedule(void* arg, Priority pri) { return 0; } + virtual int UnSchedule(void* /*arg*/, Priority /*pri*/) { return 0; } // Start a new thread, invoking "function(arg)" within the new thread. // When "function(arg)" returns, the thread will be destroyed. @@ -318,7 +319,7 @@ class Env { virtual void WaitForJoin() {} // Get thread pool queue length for specific thread pool. - virtual unsigned int GetThreadPoolQueueLen(Priority pri = LOW) const { + virtual unsigned int GetThreadPoolQueueLen(Priority /*pri*/ = LOW) const { return 0; } @@ -372,7 +373,7 @@ class Env { virtual void IncBackgroundThreadsIfNeeded(int number, Priority pri) = 0; // Lower IO priority for threads from the specified pool. - virtual void LowerThreadPoolIOPriority(Priority pool = LOW) {} + virtual void LowerThreadPoolIOPriority(Priority /*pool*/ = LOW) {} // Converts seconds-since-Jan-01-1970 to a printable string virtual std::string TimeToString(uint64_t time) = 0; @@ -416,7 +417,7 @@ class Env { const ImmutableDBOptions& db_options) const; // Returns the status of all threads that belong to the current Env. - virtual Status GetThreadList(std::vector* thread_list) { + virtual Status GetThreadList(std::vector* /*thread_list*/) { return Status::NotSupported("Not supported."); } @@ -482,14 +483,14 @@ class SequentialFile { // Remove any kind of caching of data from the offset to offset+length // of this file. If the length is 0, then it refers to the end of file. // If the system is not caching the file contents, then this is a noop. - virtual Status InvalidateCache(size_t offset, size_t length) { + virtual Status InvalidateCache(size_t /*offset*/, size_t /*length*/) { return Status::NotSupported("InvalidateCache not supported."); } // Positioned Read for direct I/O // If Direct I/O enabled, offset, n, and scratch should be properly aligned - virtual Status PositionedRead(uint64_t offset, size_t n, Slice* result, - char* scratch) { + virtual Status PositionedRead(uint64_t /*offset*/, size_t /*n*/, + Slice* /*result*/, char* /*scratch*/) { return Status::NotSupported(); } }; @@ -515,7 +516,7 @@ class RandomAccessFile { char* scratch) const = 0; // Readahead the file starting from offset by n bytes for caching. - virtual Status Prefetch(uint64_t offset, size_t n) { + virtual Status Prefetch(uint64_t /*offset*/, size_t /*n*/) { return Status::OK(); } @@ -534,14 +535,14 @@ class RandomAccessFile { // a single varint. // // Note: these IDs are only valid for the duration of the process. - virtual size_t GetUniqueId(char* id, size_t max_size) const { + virtual size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const { return 0; // Default implementation to prevent issues with backwards // compatibility. }; enum AccessPattern { NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED }; - virtual void Hint(AccessPattern pattern) {} + virtual void Hint(AccessPattern /*pattern*/) {} // Indicates the upper layers if the current RandomAccessFile implementation // uses direct IO. @@ -554,7 +555,7 @@ class RandomAccessFile { // Remove any kind of caching of data from the offset to offset+length // of this file. If the length is 0, then it refers to the end of file. // If the system is not caching the file contents, then this is a noop. - virtual Status InvalidateCache(size_t offset, size_t length) { + virtual Status InvalidateCache(size_t /*offset*/, size_t /*length*/) { return Status::NotSupported("InvalidateCache not supported."); } }; @@ -604,9 +605,7 @@ class WritableFile { // before closing. It is not always possible to keep track of the file // size due to whole pages writes. The behavior is undefined if called // with other writes to follow. - virtual Status Truncate(uint64_t size) { - return Status::OK(); - } + virtual Status Truncate(uint64_t /*size*/) { return Status::OK(); } virtual Status Close() = 0; virtual Status Flush() = 0; virtual Status Sync() = 0; // sync data @@ -668,7 +667,7 @@ class WritableFile { } // For documentation, refer to RandomAccessFile::GetUniqueId() - virtual size_t GetUniqueId(char* id, size_t max_size) const { + virtual size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const { return 0; // Default implementation to prevent issues with backwards } @@ -676,7 +675,7 @@ class WritableFile { // of this file. If the length is 0, then it refers to the end of file. // If the system is not caching the file contents, then this is a noop. // This call has no effect on dirty pages in the cache. - virtual Status InvalidateCache(size_t offset, size_t length) { + virtual Status InvalidateCache(size_t /*offset*/, size_t /*length*/) { return Status::NotSupported("InvalidateCache not supported."); } @@ -686,7 +685,9 @@ class WritableFile { // This asks the OS to initiate flushing the cached data to disk, // without waiting for completion. // Default implementation does nothing. - virtual Status RangeSync(uint64_t offset, uint64_t nbytes) { return Status::OK(); } + virtual Status RangeSync(uint64_t /*offset*/, uint64_t /*nbytes*/) { + return Status::OK(); + } // PrepareWrite performs any necessary preparation for a write // before the write actually occurs. This allows for pre-allocation @@ -713,7 +714,7 @@ class WritableFile { } // Pre-allocates space for a file. - virtual Status Allocate(uint64_t offset, uint64_t len) { + virtual Status Allocate(uint64_t /*offset*/, uint64_t /*len*/) { return Status::OK(); } diff --git a/include/rocksdb/filter_policy.h b/include/rocksdb/filter_policy.h index 8c813d93e..d442837e6 100644 --- a/include/rocksdb/filter_policy.h +++ b/include/rocksdb/filter_policy.h @@ -45,7 +45,7 @@ class FilterBitsBuilder { virtual Slice Finish(std::unique_ptr* buf) = 0; // Calculate num of entries fit into a space. - virtual int CalculateNumEntry(const uint32_t space) { + virtual int CalculateNumEntry(const uint32_t /*space*/) { #ifndef ROCKSDB_LITE throw std::runtime_error("CalculateNumEntry not Implemented"); #else @@ -114,7 +114,8 @@ class FilterPolicy { // Get the FilterBitsReader, which is ONLY used for full filter block // It contains interface to tell if key can be in filter // The input slice should NOT be deleted by FilterPolicy - virtual FilterBitsReader* GetFilterBitsReader(const Slice& contents) const { + virtual FilterBitsReader* GetFilterBitsReader( + const Slice& /*contents*/) const { return nullptr; } }; diff --git a/include/rocksdb/iterator.h b/include/rocksdb/iterator.h index 4e09f64e9..cb734eccd 100644 --- a/include/rocksdb/iterator.h +++ b/include/rocksdb/iterator.h @@ -51,7 +51,7 @@ class Iterator : public Cleanable { // Position at the last key in the source that at or before target // The iterator is Valid() after this call iff the source contains // an entry that comes at or before target. - virtual void SeekForPrev(const Slice& target) {} + virtual void SeekForPrev(const Slice& /*target*/) {} // Moves to the next entry in the source. After this call, Valid() is // true iff the iterator was not positioned at the last entry in the source. diff --git a/include/rocksdb/listener.h b/include/rocksdb/listener.h index 40d318e09..b44c7a690 100644 --- a/include/rocksdb/listener.h +++ b/include/rocksdb/listener.h @@ -345,8 +345,8 @@ class EventListener { // returns. Otherwise, RocksDB may be blocked. // @param handle is a pointer to the column family handle to be deleted // which will become a dangling pointer after the deletion. - virtual void OnColumnFamilyHandleDeletionStarted(ColumnFamilyHandle* handle) { - } + virtual void OnColumnFamilyHandleDeletionStarted( + ColumnFamilyHandle* /*handle*/) {} // A call-back function for RocksDB which will be called after an external // file is ingested using IngestExternalFile. diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 347dd3096..1256515d5 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -89,14 +89,14 @@ class MemTableRep { // // Currently only skip-list based memtable implement the interface. Other // implementations will fallback to Insert() by default. - virtual void InsertWithHint(KeyHandle handle, void** hint) { + virtual void InsertWithHint(KeyHandle handle, void** /*hint*/) { // Ignore the hint by default. Insert(handle); } // Like Insert(handle), but may be called concurrent with other calls // to InsertConcurrently for other handles - virtual void InsertConcurrently(KeyHandle handle) { + virtual void InsertConcurrently(KeyHandle /*handle*/) { #ifndef ROCKSDB_LITE throw std::runtime_error("concurrent insert not supported"); #else @@ -128,8 +128,8 @@ class MemTableRep { virtual void Get(const LookupKey& k, void* callback_args, bool (*callback_func)(void* arg, const char* entry)); - virtual uint64_t ApproximateNumEntries(const Slice& start_ikey, - const Slice& end_key) { + virtual uint64_t ApproximateNumEntries(const Slice& /*start_ikey*/, + const Slice& /*end_key*/) { return 0; } diff --git a/include/rocksdb/merge_operator.h b/include/rocksdb/merge_operator.h index 5fe3e0bfd..c32249ee8 100644 --- a/include/rocksdb/merge_operator.h +++ b/include/rocksdb/merge_operator.h @@ -66,11 +66,9 @@ class MergeOperator { // internal corruption. This will be treated as an error by the library. // // Also make use of the *logger for error messages. - virtual bool FullMerge(const Slice& key, - const Slice* existing_value, - const std::deque& operand_list, - std::string* new_value, - Logger* logger) const { + virtual bool FullMerge(const Slice& /*key*/, const Slice* /*existing_value*/, + const std::deque& /*operand_list*/, + std::string* /*new_value*/, Logger* /*logger*/) const { // deprecated, please use FullMergeV2() assert(false); return false; @@ -145,9 +143,10 @@ class MergeOperator { // If there is corruption in the data, handle it in the FullMergeV2() function // and return false there. The default implementation of PartialMerge will // always return false. - virtual bool PartialMerge(const Slice& key, const Slice& left_operand, - const Slice& right_operand, std::string* new_value, - Logger* logger) const { + virtual bool PartialMerge(const Slice& /*key*/, const Slice& /*left_operand*/, + const Slice& /*right_operand*/, + std::string* /*new_value*/, + Logger* /*logger*/) const { return false; } diff --git a/include/rocksdb/rate_limiter.h b/include/rocksdb/rate_limiter.h index 838c98a6d..995bf952f 100644 --- a/include/rocksdb/rate_limiter.h +++ b/include/rocksdb/rate_limiter.h @@ -45,7 +45,7 @@ class RateLimiter { // Request for token for bytes. If this request can not be satisfied, the call // is blocked. Caller is responsible to make sure // bytes <= GetSingleBurstBytes() - virtual void Request(const int64_t bytes, const Env::IOPriority pri) { + virtual void Request(const int64_t /*bytes*/, const Env::IOPriority /*pri*/) { assert(false); } diff --git a/include/rocksdb/slice.h b/include/rocksdb/slice.h index fe8dee00f..b45f95c10 100644 --- a/include/rocksdb/slice.h +++ b/include/rocksdb/slice.h @@ -173,7 +173,7 @@ class PinnableSlice : public Slice, public Cleanable { } } - void remove_prefix(size_t n) { + void remove_prefix(size_t /*n*/) { assert(0); // Not implemented } diff --git a/include/rocksdb/slice_transform.h b/include/rocksdb/slice_transform.h index fc82bf584..2143057df 100644 --- a/include/rocksdb/slice_transform.h +++ b/include/rocksdb/slice_transform.h @@ -58,7 +58,7 @@ class SliceTransform { virtual bool InDomain(const Slice& key) const = 0; // This is currently not used and remains here for backward compatibility. - virtual bool InRange(const Slice& dst) const { return false; } + virtual bool InRange(const Slice& /*dst*/) const { return false; } // Transform(s)=Transform(`prefix`) for any s with `prefix` as a prefix. // @@ -83,7 +83,7 @@ class SliceTransform { // "abcd,e", the file can be filtered out and the key will be invisible. // // i.e., an implementation always returning false is safe. - virtual bool SameResultWhenAppended(const Slice& prefix) const { + virtual bool SameResultWhenAppended(const Slice& /*prefix*/) const { return false; } }; diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index b4629358e..ad395cae4 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -445,7 +445,7 @@ class Statistics { virtual uint64_t getTickerCount(uint32_t tickerType) const = 0; virtual void histogramData(uint32_t type, HistogramData* const data) const = 0; - virtual std::string getHistogramString(uint32_t type) const { return ""; } + virtual std::string getHistogramString(uint32_t /*type*/) const { return ""; } virtual void recordTick(uint32_t tickerType, uint64_t count = 0) = 0; virtual void setTickerCount(uint32_t tickerType, uint64_t count) = 0; virtual uint64_t getAndResetTickerCount(uint32_t tickerType) = 0; diff --git a/include/rocksdb/utilities/geo_db.h b/include/rocksdb/utilities/geo_db.h index 408774c59..ec3cbdf26 100644 --- a/include/rocksdb/utilities/geo_db.h +++ b/include/rocksdb/utilities/geo_db.h @@ -80,7 +80,7 @@ class GeoDB : public StackableDB { // GeoDB owns the pointer `DB* db` now. You should not delete it or // use it after the invocation of GeoDB // GeoDB(DB* db, const GeoDBOptions& options) : StackableDB(db) {} - GeoDB(DB* db, const GeoDBOptions& options) : StackableDB(db) {} + GeoDB(DB* db, const GeoDBOptions& /*options*/) : StackableDB(db) {} virtual ~GeoDB() {} // Insert a new object into the location database. The object is diff --git a/include/rocksdb/utilities/optimistic_transaction_db.h b/include/rocksdb/utilities/optimistic_transaction_db.h index 02917ff58..518bc610c 100644 --- a/include/rocksdb/utilities/optimistic_transaction_db.h +++ b/include/rocksdb/utilities/optimistic_transaction_db.h @@ -62,7 +62,7 @@ class OptimisticTransactionDB { protected: // To Create an OptimisticTransactionDB, call Open() - explicit OptimisticTransactionDB(DB* db) {} + explicit OptimisticTransactionDB(DB* /*db*/) {} OptimisticTransactionDB() {} private: diff --git a/include/rocksdb/utilities/transaction.h b/include/rocksdb/utilities/transaction.h index 8507ef133..a461c9e85 100644 --- a/include/rocksdb/utilities/transaction.h +++ b/include/rocksdb/utilities/transaction.h @@ -402,8 +402,8 @@ class Transaction { virtual bool IsDeadlockDetect() const { return false; } - virtual std::vector GetWaitingTxns(uint32_t* column_family_id, - std::string* key) const { + virtual std::vector GetWaitingTxns( + uint32_t* /*column_family_id*/, std::string* /*key*/) const { assert(false); return std::vector(); } @@ -423,7 +423,7 @@ class Transaction { void SetState(TransactionState state) { txn_state_ = state; } protected: - explicit Transaction(const TransactionDB* db) {} + explicit Transaction(const TransactionDB* /*db*/) {} Transaction() {} // the log in which the prepared section for this txn resides diff --git a/include/rocksdb/wal_filter.h b/include/rocksdb/wal_filter.h index 686fa4998..a22dca923 100644 --- a/include/rocksdb/wal_filter.h +++ b/include/rocksdb/wal_filter.h @@ -44,8 +44,8 @@ class WalFilter { // @params cf_name_id_map column_family_name to column_family_id map virtual void ColumnFamilyLogNumberMap( - const std::map& cf_lognumber_map, - const std::map& cf_name_id_map) {} + const std::map& /*cf_lognumber_map*/, + const std::map& /*cf_name_id_map*/) {} // LogRecord is invoked for each log record encountered for all the logs // during replay on logs on recovery. This method can be used to: @@ -75,11 +75,9 @@ class WalFilter { // @returns Processing option for the current record. // Please see WalProcessingOption enum above for // details. - virtual WalProcessingOption LogRecordFound(unsigned long long log_number, - const std::string& log_file_name, - const WriteBatch& batch, - WriteBatch* new_batch, - bool* batch_changed) { + virtual WalProcessingOption LogRecordFound( + unsigned long long /*log_number*/, const std::string& /*log_file_name*/, + const WriteBatch& batch, WriteBatch* new_batch, bool* batch_changed) { // Default implementation falls back to older function for compatibility return LogRecord(batch, new_batch, batch_changed); } @@ -87,9 +85,9 @@ class WalFilter { // Please see the comments for LogRecord above. This function is for // compatibility only and contains a subset of parameters. // New code should use the function above. - virtual WalProcessingOption LogRecord(const WriteBatch& batch, - WriteBatch* new_batch, - bool* batch_changed) const { + virtual WalProcessingOption LogRecord(const WriteBatch& /*batch*/, + WriteBatch* /*new_batch*/, + bool* /*batch_changed*/) const { return WalProcessingOption::kContinueProcessing; } diff --git a/include/rocksdb/write_batch.h b/include/rocksdb/write_batch.h index 8bd93d36c..d708933f8 100644 --- a/include/rocksdb/write_batch.h +++ b/include/rocksdb/write_batch.h @@ -217,8 +217,9 @@ class WriteBatch : public WriteBatchBase { } virtual void SingleDelete(const Slice& /*key*/) {} - virtual Status DeleteRangeCF(uint32_t column_family_id, - const Slice& begin_key, const Slice& end_key) { + virtual Status DeleteRangeCF(uint32_t /*column_family_id*/, + const Slice& /*begin_key*/, + const Slice& /*end_key*/) { return Status::InvalidArgument("DeleteRangeCF not implemented"); } @@ -240,16 +241,16 @@ class WriteBatch : public WriteBatchBase { return Status::InvalidArgument("MarkBeginPrepare() handler not defined."); } - virtual Status MarkEndPrepare(const Slice& xid) { + virtual Status MarkEndPrepare(const Slice& /*xid*/) { return Status::InvalidArgument("MarkEndPrepare() handler not defined."); } - virtual Status MarkRollback(const Slice& xid) { + virtual Status MarkRollback(const Slice& /*xid*/) { return Status::InvalidArgument( "MarkRollbackPrepare() handler not defined."); } - virtual Status MarkCommit(const Slice& xid) { + virtual Status MarkCommit(const Slice& /*xid*/) { return Status::InvalidArgument("MarkCommit() handler not defined."); } diff --git a/memtable/hash_cuckoo_rep.cc b/memtable/hash_cuckoo_rep.cc index 034bf5858..39078633f 100644 --- a/memtable/hash_cuckoo_rep.cc +++ b/memtable/hash_cuckoo_rep.cc @@ -597,8 +597,8 @@ void HashCuckooRep::Iterator::Seek(const Slice& user_key, } // Retreat to the last entry with a key <= target -void HashCuckooRep::Iterator::SeekForPrev(const Slice& user_key, - const char* memtable_key) { +void HashCuckooRep::Iterator::SeekForPrev(const Slice& /*user_key*/, + const char* /*memtable_key*/) { assert(false); } @@ -623,7 +623,7 @@ void HashCuckooRep::Iterator::SeekToLast() { MemTableRep* HashCuckooRepFactory::CreateMemTableRep( const MemTableRep::KeyComparator& compare, Allocator* allocator, - const SliceTransform* transform, Logger* logger) { + const SliceTransform* /*transform*/, Logger* /*logger*/) { // The estimated average fullness. The write performance of any close hash // degrades as the fullness of the mem-table increases. Setting kFullness // to a value around 0.7 can better avoid write performance degradation while diff --git a/memtable/hash_linklist_rep.cc b/memtable/hash_linklist_rep.cc index 932b62a34..b23a9f5e5 100644 --- a/memtable/hash_linklist_rep.cc +++ b/memtable/hash_linklist_rep.cc @@ -362,14 +362,14 @@ class HashLinkListRep : public MemTableRep { // Advance to the first entry with a key >= target virtual void Seek(const Slice& internal_key, - const char* memtable_key) override { + const char* /*memtable_key*/) override { node_ = hash_link_list_rep_->FindGreaterOrEqualInBucket(head_, internal_key); } // Retreat to the last entry with a key <= target - virtual void SeekForPrev(const Slice& internal_key, - const char* memtable_key) override { + virtual void SeekForPrev(const Slice& /*internal_key*/, + const char* /*memtable_key*/) override { // Since we do not support Prev() // We simply do not support SeekForPrev Reset(nullptr); @@ -483,10 +483,10 @@ class HashLinkListRep : public MemTableRep { } virtual void Next() override {} virtual void Prev() override {} - virtual void Seek(const Slice& user_key, - const char* memtable_key) override {} - virtual void SeekForPrev(const Slice& user_key, - const char* memtable_key) override {} + virtual void Seek(const Slice& /*user_key*/, + const char* /*memtable_key*/) override {} + virtual void SeekForPrev(const Slice& /*user_key*/, + const char* /*memtable_key*/) override {} virtual void SeekToFirst() override {} virtual void SeekToLast() override {} diff --git a/memtable/hash_skiplist_rep.cc b/memtable/hash_skiplist_rep.cc index e34743eb2..93082b1ec 100644 --- a/memtable/hash_skiplist_rep.cc +++ b/memtable/hash_skiplist_rep.cc @@ -131,8 +131,8 @@ class HashSkipListRep : public MemTableRep { } // Retreat to the last entry with a key <= target - virtual void SeekForPrev(const Slice& internal_key, - const char* memtable_key) override { + virtual void SeekForPrev(const Slice& /*internal_key*/, + const char* /*memtable_key*/) override { // not supported assert(false); } @@ -219,10 +219,10 @@ class HashSkipListRep : public MemTableRep { } virtual void Next() override {} virtual void Prev() override {} - virtual void Seek(const Slice& internal_key, - const char* memtable_key) override {} - virtual void SeekForPrev(const Slice& internal_key, - const char* memtable_key) override {} + virtual void Seek(const Slice& /*internal_key*/, + const char* /*memtable_key*/) override {} + virtual void SeekForPrev(const Slice& /*internal_key*/, + const char* /*memtable_key*/) override {} virtual void SeekToFirst() override {} virtual void SeekToLast() override {} @@ -335,7 +335,7 @@ MemTableRep::Iterator* HashSkipListRep::GetDynamicPrefixIterator(Arena* arena) { MemTableRep* HashSkipListRepFactory::CreateMemTableRep( const MemTableRep::KeyComparator& compare, Allocator* allocator, - const SliceTransform* transform, Logger* logger) { + const SliceTransform* transform, Logger* /*logger*/) { return new HashSkipListRep(compare, allocator, transform, bucket_count_, skiplist_height_, skiplist_branching_factor_); } diff --git a/memtable/skiplistrep.cc b/memtable/skiplistrep.cc index f56be5dcb..235d33b81 100644 --- a/memtable/skiplistrep.cc +++ b/memtable/skiplistrep.cc @@ -270,7 +270,7 @@ public: MemTableRep* SkipListFactory::CreateMemTableRep( const MemTableRep::KeyComparator& compare, Allocator* allocator, - const SliceTransform* transform, Logger* logger) { + const SliceTransform* transform, Logger* /*logger*/) { return new SkipListRep(compare, allocator, transform, lookahead_); } diff --git a/memtable/vectorrep.cc b/memtable/vectorrep.cc index e54025c2d..378b29624 100644 --- a/memtable/vectorrep.cc +++ b/memtable/vectorrep.cc @@ -227,8 +227,8 @@ void VectorRep::Iterator::Seek(const Slice& user_key, } // Advance to the first entry with a key <= target -void VectorRep::Iterator::SeekForPrev(const Slice& user_key, - const char* memtable_key) { +void VectorRep::Iterator::SeekForPrev(const Slice& /*user_key*/, + const char* /*memtable_key*/) { assert(false); } @@ -296,7 +296,7 @@ MemTableRep::Iterator* VectorRep::GetIterator(Arena* arena) { MemTableRep* VectorRepFactory::CreateMemTableRep( const MemTableRep::KeyComparator& compare, Allocator* allocator, - const SliceTransform*, Logger* logger) { + const SliceTransform*, Logger* /*logger*/) { return new VectorRep(compare, allocator, count_); } } // namespace rocksdb diff --git a/options/options_helper.cc b/options/options_helper.cc index 9e984f6e3..82c734cba 100644 --- a/options/options_helper.cc +++ b/options/options_helper.cc @@ -1129,7 +1129,7 @@ Status GetPlainTableOptionsFromMap( const PlainTableOptions& table_options, const std::unordered_map& opts_map, PlainTableOptions* new_table_options, bool input_strings_escaped, - bool ignore_unknown_options) { + bool /*ignore_unknown_options*/) { assert(new_table_options); *new_table_options = table_options; for (const auto& o : opts_map) { diff --git a/options/options_parser.cc b/options/options_parser.cc index d5a3fec6e..fc4e119f3 100644 --- a/options/options_parser.cc +++ b/options/options_parser.cc @@ -689,7 +689,7 @@ Status RocksDBOptionsParser::VerifyRocksDBOptionsFromFile( Status RocksDBOptionsParser::VerifyDBOptions( const DBOptions& base_opt, const DBOptions& persisted_opt, - const std::unordered_map* opt_map, + const std::unordered_map* /*opt_map*/, OptionsSanityCheckLevel sanity_check_level) { for (auto pair : db_options_type_info) { if (pair.second.verification == OptionVerificationType::kDeprecated) { diff --git a/port/port_posix.cc b/port/port_posix.cc index 59241daff..e3af77260 100644 --- a/port/port_posix.cc +++ b/port/port_posix.cc @@ -35,7 +35,7 @@ static int PthreadCall(const char* label, int result) { return result; } -Mutex::Mutex(bool adaptive) { +Mutex::Mutex(bool /*adaptive*/) { #ifdef ROCKSDB_PTHREAD_ADAPTIVE_MUTEX if (!adaptive) { PthreadCall("init mutex", pthread_mutex_init(&mu_, nullptr)); diff --git a/port/stack_trace.cc b/port/stack_trace.cc index baaf14014..6f657be51 100644 --- a/port/stack_trace.cc +++ b/port/stack_trace.cc @@ -13,7 +13,7 @@ namespace rocksdb { namespace port { void InstallStackTraceHandler() {} -void PrintStack(int first_frames_to_skip) {} +void PrintStack(int /*first_frames_to_skip*/) {} } // namespace port } // namespace rocksdb diff --git a/table/adaptive_table_factory.cc b/table/adaptive_table_factory.cc index f83905dff..173bca71c 100644 --- a/table/adaptive_table_factory.cc +++ b/table/adaptive_table_factory.cc @@ -44,7 +44,7 @@ Status AdaptiveTableFactory::NewTableReader( const TableReaderOptions& table_reader_options, unique_ptr&& file, uint64_t file_size, unique_ptr* table, - bool prefetch_index_and_filter_in_cache) const { + bool /*prefetch_index_and_filter_in_cache*/) const { Footer footer; auto s = ReadFooterFromFile(file.get(), file_size, &footer); if (!s.ok()) { diff --git a/table/adaptive_table_factory.h b/table/adaptive_table_factory.h index b7b52ba96..00af6a76e 100644 --- a/table/adaptive_table_factory.h +++ b/table/adaptive_table_factory.h @@ -44,8 +44,9 @@ class AdaptiveTableFactory : public TableFactory { uint32_t column_family_id, WritableFileWriter* file) const override; // Sanitizes the specified DB Options. - Status SanitizeOptions(const DBOptions& db_opts, - const ColumnFamilyOptions& cf_opts) const override { + Status SanitizeOptions( + const DBOptions& /*db_opts*/, + const ColumnFamilyOptions& /*cf_opts*/) const override { return Status::OK(); } diff --git a/table/block_based_filter_block.cc b/table/block_based_filter_block.cc index 697c11a42..a09f1a0e0 100644 --- a/table/block_based_filter_block.cc +++ b/table/block_based_filter_block.cc @@ -113,7 +113,7 @@ inline void BlockBasedFilterBlockBuilder::AddPrefix(const Slice& key) { } } -Slice BlockBasedFilterBlockBuilder::Finish(const BlockHandle& tmp, +Slice BlockBasedFilterBlockBuilder::Finish(const BlockHandle& /*tmp*/, Status* status) { // In this impl we ignore BlockHandle *status = Status::OK(); @@ -185,8 +185,8 @@ BlockBasedFilterBlockReader::BlockBasedFilterBlockReader( } bool BlockBasedFilterBlockReader::KeyMayMatch( - const Slice& key, uint64_t block_offset, const bool no_io, - const Slice* const const_ikey_ptr) { + const Slice& key, uint64_t block_offset, const bool /*no_io*/, + const Slice* const /*const_ikey_ptr*/) { assert(block_offset != kNotValid); if (!whole_key_filtering_) { return true; @@ -195,8 +195,8 @@ bool BlockBasedFilterBlockReader::KeyMayMatch( } bool BlockBasedFilterBlockReader::PrefixMayMatch( - const Slice& prefix, uint64_t block_offset, const bool no_io, - const Slice* const const_ikey_ptr) { + const Slice& prefix, uint64_t block_offset, const bool /*no_io*/, + const Slice* const /*const_ikey_ptr*/) { assert(block_offset != kNotValid); if (!prefix_extractor_) { return true; diff --git a/table/block_based_table_builder.cc b/table/block_based_table_builder.cc index e87def73e..594fd92fc 100644 --- a/table/block_based_table_builder.cc +++ b/table/block_based_table_builder.cc @@ -209,8 +209,8 @@ class BlockBasedTableBuilder::BlockBasedTablePropertiesCollector whole_key_filtering_(whole_key_filtering), prefix_filtering_(prefix_filtering) {} - virtual Status InternalAdd(const Slice& key, const Slice& value, - uint64_t file_size) override { + virtual Status InternalAdd(const Slice& /*key*/, const Slice& /*value*/, + uint64_t /*file_size*/) override { // Intentionally left blank. Have no interest in collecting stats for // individual key/value pairs. return Status::OK(); @@ -585,7 +585,7 @@ Status BlockBasedTableBuilder::status() const { return rep_->status; } -static void DeleteCachedBlock(const Slice& key, void* value) { +static void DeleteCachedBlock(const Slice& /*key*/, void* value) { Block* block = reinterpret_cast(value); delete block; } diff --git a/table/block_based_table_factory.cc b/table/block_based_table_factory.cc index 4705046bf..3620db141 100644 --- a/table/block_based_table_factory.cc +++ b/table/block_based_table_factory.cc @@ -82,8 +82,7 @@ TableBuilder* BlockBasedTableFactory::NewTableBuilder( } Status BlockBasedTableFactory::SanitizeOptions( - const DBOptions& db_opts, - const ColumnFamilyOptions& cf_opts) const { + const DBOptions& /*db_opts*/, const ColumnFamilyOptions& cf_opts) const { if (table_options_.index_type == BlockBasedTableOptions::kHashSearch && cf_opts.prefix_extractor == nullptr) { return Status::InvalidArgument("Hash index is specified for block-based " diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index 123e1814a..5ac130078 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -91,13 +91,13 @@ Status ReadBlockFromFile(RandomAccessFileReader* file, const Footer& footer, // Delete the resource that is held by the iterator. template -void DeleteHeldResource(void* arg, void* ignored) { +void DeleteHeldResource(void* arg, void* /*ignored*/) { delete reinterpret_cast(arg); } // Delete the entry resided in the cache. template -void DeleteCachedEntry(const Slice& key, void* value) { +void DeleteCachedEntry(const Slice& /*key*/, void* value) { auto entry = reinterpret_cast(value); delete entry; } @@ -179,8 +179,8 @@ class PartitionIndexReader : public IndexReader, public Cleanable { } // return a two-level iterator: first level is on the partition index - virtual InternalIterator* NewIterator(BlockIter* iter = nullptr, - bool dont_care = true) override { + virtual InternalIterator* NewIterator(BlockIter* /*iter*/ = nullptr, + bool /*dont_care*/ = true) override { // Filters are already checked before seeking the index const bool skip_filters = true; const bool is_index = true; @@ -259,7 +259,7 @@ class BinarySearchIndexReader : public IndexReader { } virtual InternalIterator* NewIterator(BlockIter* iter = nullptr, - bool dont_care = true) override { + bool /*dont_care*/ = true) override { return index_block_->NewIterator(icomparator_, iter, true); } @@ -294,7 +294,7 @@ class HashIndexReader : public IndexReader { const BlockHandle& index_handle, InternalIterator* meta_index_iter, IndexReader** index_reader, - bool hash_index_allow_collision, + bool /*hash_index_allow_collision*/, const PersistentCacheOptions& cache_options) { std::unique_ptr index_block; auto s = ReadBlockFromFile( @@ -941,7 +941,7 @@ Status BlockBasedTable::GetDataBlockFromCache( Status BlockBasedTable::PutDataBlockToCache( const Slice& block_cache_key, const Slice& compressed_block_cache_key, Cache* block_cache, Cache* block_cache_compressed, - const ReadOptions& read_options, const ImmutableCFOptions& ioptions, + const ReadOptions& /*read_options*/, const ImmutableCFOptions& ioptions, CachableEntry* block, Block* raw_block, uint32_t format_version, const Slice& compression_dict, size_t read_amp_bytes_per_bit, bool is_index, Cache::Priority priority) { @@ -2257,7 +2257,7 @@ void BlockBasedTable::DumpKeyValue(const Slice& key, const Slice& value, namespace { -void DeleteCachedFilterEntry(const Slice& key, void* value) { +void DeleteCachedFilterEntry(const Slice& /*key*/, void* value) { FilterBlockReader* filter = reinterpret_cast(value); if (filter->statistics() != nullptr) { RecordTick(filter->statistics(), BLOCK_CACHE_FILTER_BYTES_EVICT, @@ -2266,7 +2266,7 @@ void DeleteCachedFilterEntry(const Slice& key, void* value) { delete filter; } -void DeleteCachedIndexEntry(const Slice& key, void* value) { +void DeleteCachedIndexEntry(const Slice& /*key*/, void* value) { IndexReader* index_reader = reinterpret_cast(value); if (index_reader->statistics() != nullptr) { RecordTick(index_reader->statistics(), BLOCK_CACHE_INDEX_BYTES_EVICT, diff --git a/table/block_test.cc b/table/block_test.cc index f5c543975..0258be486 100644 --- a/table/block_test.cc +++ b/table/block_test.cc @@ -133,7 +133,7 @@ TEST_F(BlockTest, SimpleTest) { BlockContents GetBlockContents(std::unique_ptr *builder, const std::vector &keys, const std::vector &values, - const int prefix_group_size = 1) { + const int /*prefix_group_size*/ = 1) { builder->reset(new BlockBuilder(1 /* restart interval */)); // Add only half of the keys diff --git a/table/cuckoo_table_builder_test.cc b/table/cuckoo_table_builder_test.cc index ec282b4b5..dfd80c22a 100644 --- a/table/cuckoo_table_builder_test.cc +++ b/table/cuckoo_table_builder_test.cc @@ -23,7 +23,7 @@ namespace { std::unordered_map> hash_map; uint64_t GetSliceHash(const Slice& s, uint32_t index, - uint64_t max_num_buckets) { + uint64_t /*max_num_buckets*/) { return hash_map[s.ToString()][index]; } } // namespace diff --git a/table/cuckoo_table_factory.cc b/table/cuckoo_table_factory.cc index 2325bcf77..84d22468e 100644 --- a/table/cuckoo_table_factory.cc +++ b/table/cuckoo_table_factory.cc @@ -16,7 +16,7 @@ Status CuckooTableFactory::NewTableReader( const TableReaderOptions& table_reader_options, unique_ptr&& file, uint64_t file_size, std::unique_ptr* table, - bool prefetch_index_and_filter_in_cache) const { + bool /*prefetch_index_and_filter_in_cache*/) const { std::unique_ptr new_reader(new CuckooTableReader( table_reader_options.ioptions, std::move(file), file_size, table_reader_options.internal_comparator.user_comparator(), nullptr)); diff --git a/table/cuckoo_table_factory.h b/table/cuckoo_table_factory.h index 774dc3c3e..e3371563f 100644 --- a/table/cuckoo_table_factory.h +++ b/table/cuckoo_table_factory.h @@ -67,8 +67,9 @@ class CuckooTableFactory : public TableFactory { uint32_t column_family_id, WritableFileWriter* file) const override; // Sanitizes the specified DB Options. - Status SanitizeOptions(const DBOptions& db_opts, - const ColumnFamilyOptions& cf_opts) const override { + Status SanitizeOptions( + const DBOptions& /*db_opts*/, + const ColumnFamilyOptions& /*cf_opts*/) const override { return Status::OK(); } diff --git a/table/cuckoo_table_reader.cc b/table/cuckoo_table_reader.cc index 85670ad1d..47d58753c 100644 --- a/table/cuckoo_table_reader.cc +++ b/table/cuckoo_table_reader.cc @@ -127,8 +127,9 @@ CuckooTableReader::CuckooTableReader( status_ = file_->Read(0, file_size, &file_data_, nullptr); } -Status CuckooTableReader::Get(const ReadOptions& readOptions, const Slice& key, - GetContext* get_context, bool skip_filters) { +Status CuckooTableReader::Get(const ReadOptions& /*readOptions*/, + const Slice& key, GetContext* get_context, + bool /*skip_filters*/) { assert(key.size() == key_length_ + (is_last_level_ ? 8 : 0)); Slice user_key = ExtractUserKey(key); for (uint32_t hash_cnt = 0; hash_cnt < num_hash_func_; ++hash_cnt) { @@ -299,7 +300,7 @@ void CuckooTableIterator::Seek(const Slice& target) { PrepareKVAtCurrIdx(); } -void CuckooTableIterator::SeekForPrev(const Slice& target) { +void CuckooTableIterator::SeekForPrev(const Slice& /*target*/) { // Not supported assert(false); } @@ -364,8 +365,8 @@ extern InternalIterator* NewErrorInternalIterator(const Status& status, Arena* arena); InternalIterator* CuckooTableReader::NewIterator( - const ReadOptions& read_options, Arena* arena, - const InternalKeyComparator* icomp, bool skip_filters) { + const ReadOptions& /*read_options*/, Arena* arena, + const InternalKeyComparator* /*icomp*/, bool /*skip_filters*/) { if (!status().ok()) { return NewErrorInternalIterator( Status::Corruption("CuckooTableReader status is not okay."), arena); diff --git a/table/cuckoo_table_reader.h b/table/cuckoo_table_reader.h index f2b6d1a9c..fdb18beb9 100644 --- a/table/cuckoo_table_reader.h +++ b/table/cuckoo_table_reader.h @@ -55,7 +55,7 @@ class CuckooTableReader: public TableReader { size_t ApproximateMemoryUsage() const override; // Following methods are not implemented for Cuckoo Table Reader - uint64_t ApproximateOffsetOf(const Slice& key) override { return 0; } + uint64_t ApproximateOffsetOf(const Slice& /*key*/) override { return 0; } void SetupForCompaction() override {} // End of methods not implemented. diff --git a/table/cuckoo_table_reader_test.cc b/table/cuckoo_table_reader_test.cc index 7e131e56e..a012bceeb 100644 --- a/table/cuckoo_table_reader_test.cc +++ b/table/cuckoo_table_reader_test.cc @@ -61,7 +61,7 @@ void AddHashLookups(const std::string& s, uint64_t bucket_id, } uint64_t GetSliceHash(const Slice& s, uint32_t index, - uint64_t max_num_buckets) { + uint64_t /*max_num_buckets*/) { return hash_map[s.ToString()][index]; } } // namespace diff --git a/table/full_filter_block.cc b/table/full_filter_block.cc index 5739494e8..448b82784 100644 --- a/table/full_filter_block.cc +++ b/table/full_filter_block.cc @@ -43,7 +43,8 @@ inline void FullFilterBlockBuilder::AddPrefix(const Slice& key) { AddKey(prefix); } -Slice FullFilterBlockBuilder::Finish(const BlockHandle& tmp, Status* status) { +Slice FullFilterBlockBuilder::Finish(const BlockHandle& /*tmp*/, + Status* status) { // In this impl we ignore BlockHandle *status = Status::OK(); if (num_added_ != 0) { @@ -74,8 +75,8 @@ FullFilterBlockReader::FullFilterBlockReader( } bool FullFilterBlockReader::KeyMayMatch(const Slice& key, uint64_t block_offset, - const bool no_io, - const Slice* const const_ikey_ptr) { + const bool /*no_io*/, + const Slice* const /*const_ikey_ptr*/) { assert(block_offset == kNotValid); if (!whole_key_filtering_) { return true; @@ -83,10 +84,9 @@ bool FullFilterBlockReader::KeyMayMatch(const Slice& key, uint64_t block_offset, return MayMatch(key); } -bool FullFilterBlockReader::PrefixMayMatch(const Slice& prefix, - uint64_t block_offset, - const bool no_io, - const Slice* const const_ikey_ptr) { +bool FullFilterBlockReader::PrefixMayMatch( + const Slice& prefix, uint64_t block_offset, const bool /*no_io*/, + const Slice* const /*const_ikey_ptr*/) { assert(block_offset == kNotValid); if (!prefix_extractor_) { return true; diff --git a/table/full_filter_block.h b/table/full_filter_block.h index be27c58b6..e161d079e 100644 --- a/table/full_filter_block.h +++ b/table/full_filter_block.h @@ -43,7 +43,7 @@ class FullFilterBlockBuilder : public FilterBlockBuilder { ~FullFilterBlockBuilder() {} virtual bool IsBlockBased() override { return false; } - virtual void StartBlock(uint64_t block_offset) override {} + virtual void StartBlock(uint64_t /*block_offset*/) override {} virtual void Add(const Slice& key) override; virtual Slice Finish(const BlockHandle& tmp, Status* status) override; using FilterBlockBuilder::Finish; diff --git a/table/get_context.cc b/table/get_context.cc index 0d688fe46..aacf5d5bd 100644 --- a/table/get_context.cc +++ b/table/get_context.cc @@ -73,7 +73,7 @@ void GetContext::MarkKeyMayExist() { } } -void GetContext::SaveValue(const Slice& value, SequenceNumber seq) { +void GetContext::SaveValue(const Slice& value, SequenceNumber /*seq*/) { assert(state_ == kNotFound); appendToReplayLog(replay_log_, kTypeValue, value); diff --git a/table/index_builder.h b/table/index_builder.h index d591e0e53..3793cebc2 100644 --- a/table/index_builder.h +++ b/table/index_builder.h @@ -69,7 +69,7 @@ class IndexBuilder { // This method will be called whenever a key is added. The subclasses may // override OnKeyAdded() if they need to collect additional information. - virtual void OnKeyAdded(const Slice& key) {} + virtual void OnKeyAdded(const Slice& /*key*/) {} // Inform the index builder that all entries has been written. Block builder // may therefore perform any operation required for block finalization. @@ -137,7 +137,7 @@ class ShortenedIndexBuilder : public IndexBuilder { using IndexBuilder::Finish; virtual Status Finish( IndexBlocks* index_blocks, - const BlockHandle& last_partition_block_handle) override { + const BlockHandle& /*last_partition_block_handle*/) override { index_blocks->index_block_contents = index_block_builder_.Finish(); return Status::OK(); } diff --git a/table/internal_iterator.h b/table/internal_iterator.h index 2bfdb7d95..3dc8f9265 100644 --- a/table/internal_iterator.h +++ b/table/internal_iterator.h @@ -74,7 +74,8 @@ class InternalIterator : public Cleanable { // but for Iterators that need to communicate with PinnedIteratorsManager // they will implement this function and use the passed pointer to communicate // with PinnedIteratorsManager. - virtual void SetPinnedItersMgr(PinnedIteratorsManager* pinned_iters_mgr) {} + virtual void SetPinnedItersMgr(PinnedIteratorsManager* /*pinned_iters_mgr*/) { + } // If true, this means that the Slice returned by key() is valid as long as // PinnedIteratorsManager::ReleasePinnedData is not called and the @@ -91,7 +92,7 @@ class InternalIterator : public Cleanable { // Iterator is not deleted. virtual bool IsValuePinned() const { return false; } - virtual Status GetProperty(std::string prop_name, std::string* prop) { + virtual Status GetProperty(std::string /*prop_name*/, std::string* /*prop*/) { return Status::NotSupported(""); } diff --git a/table/iterator.cc b/table/iterator.cc index 23a84b59e..295bf8b9c 100644 --- a/table/iterator.cc +++ b/table/iterator.cc @@ -98,8 +98,8 @@ class EmptyIterator : public Iterator { public: explicit EmptyIterator(const Status& s) : status_(s) { } virtual bool Valid() const override { return false; } - virtual void Seek(const Slice& target) override {} - virtual void SeekForPrev(const Slice& target) override {} + virtual void Seek(const Slice& /*target*/) override {} + virtual void SeekForPrev(const Slice& /*target*/) override {} virtual void SeekToFirst() override {} virtual void SeekToLast() override {} virtual void Next() override { assert(false); } @@ -122,8 +122,8 @@ class EmptyInternalIterator : public InternalIterator { public: explicit EmptyInternalIterator(const Status& s) : status_(s) {} virtual bool Valid() const override { return false; } - virtual void Seek(const Slice& target) override {} - virtual void SeekForPrev(const Slice& target) override {} + virtual void Seek(const Slice& /*target*/) override {} + virtual void SeekForPrev(const Slice& /*target*/) override {} virtual void SeekToFirst() override {} virtual void SeekToLast() override {} virtual void Next() override { assert(false); } diff --git a/table/mock_table.cc b/table/mock_table.cc index 4c9907e45..4e8511031 100644 --- a/table/mock_table.cc +++ b/table/mock_table.cc @@ -27,14 +27,14 @@ stl_wrappers::KVMap MakeMockFile( } InternalIterator* MockTableReader::NewIterator(const ReadOptions&, - Arena* arena, + Arena* /*arena*/, const InternalKeyComparator*, - bool skip_filters) { + bool /*skip_filters*/) { return new MockTableIterator(table_); } Status MockTableReader::Get(const ReadOptions&, const Slice& key, - GetContext* get_context, bool skip_filters) { + GetContext* get_context, bool /*skip_filters*/) { std::unique_ptr iter(new MockTableIterator(table_)); for (iter->Seek(key); iter->Valid(); iter->Next()) { ParsedInternalKey parsed_key; @@ -57,10 +57,10 @@ std::shared_ptr MockTableReader::GetTableProperties() MockTableFactory::MockTableFactory() : next_id_(1) {} Status MockTableFactory::NewTableReader( - const TableReaderOptions& table_reader_options, - unique_ptr&& file, uint64_t file_size, + const TableReaderOptions& /*table_reader_options*/, + unique_ptr&& file, uint64_t /*file_size*/, unique_ptr* table_reader, - bool prefetch_index_and_filter_in_cache) const { + bool /*prefetch_index_and_filter_in_cache*/) const { uint32_t id = GetIDFromFile(file.get()); MutexLock lock_guard(&file_system_.mutex); @@ -76,8 +76,8 @@ Status MockTableFactory::NewTableReader( } TableBuilder* MockTableFactory::NewTableBuilder( - const TableBuilderOptions& table_builder_options, uint32_t column_family_id, - WritableFileWriter* file) const { + const TableBuilderOptions& /*table_builder_options*/, + uint32_t /*column_family_id*/, WritableFileWriter* file) const { uint32_t id = GetAndWriteNextID(file); return new MockTableBuilder(id, &file_system_); diff --git a/table/mock_table.h b/table/mock_table.h index 9e5396341..eca85d1b2 100644 --- a/table/mock_table.h +++ b/table/mock_table.h @@ -46,7 +46,7 @@ class MockTableReader : public TableReader { Status Get(const ReadOptions&, const Slice& key, GetContext* get_context, bool skip_filters = false) override; - uint64_t ApproximateOffsetOf(const Slice& key) override { return 0; } + uint64_t ApproximateOffsetOf(const Slice& /*key*/) override { return 0; } virtual size_t ApproximateMemoryUsage() const override { return 0; } @@ -169,8 +169,8 @@ class MockTableFactory : public TableFactory { stl_wrappers::KVMap file_contents); virtual Status SanitizeOptions( - const DBOptions& db_opts, - const ColumnFamilyOptions& cf_opts) const override { + const DBOptions& /*db_opts*/, + const ColumnFamilyOptions& /*cf_opts*/) const override { return Status::OK(); } diff --git a/table/partitioned_filter_block.cc b/table/partitioned_filter_block.cc index 2b330039e..6a491ad9f 100644 --- a/table/partitioned_filter_block.cc +++ b/table/partitioned_filter_block.cc @@ -87,7 +87,7 @@ Slice PartitionedFilterBlockBuilder::Finish( PartitionedFilterBlockReader::PartitionedFilterBlockReader( const SliceTransform* prefix_extractor, bool _whole_key_filtering, - BlockContents&& contents, FilterBitsReader* filter_bits_reader, + BlockContents&& contents, FilterBitsReader* /*filter_bits_reader*/, Statistics* stats, const Comparator& comparator, const BlockBasedTable* table) : FilterBlockReader(contents.data.size(), stats, _whole_key_filtering), diff --git a/table/partitioned_filter_block_test.cc b/table/partitioned_filter_block_test.cc index a49143dae..86d31a4a7 100644 --- a/table/partitioned_filter_block_test.cc +++ b/table/partitioned_filter_block_test.cc @@ -25,8 +25,8 @@ class MockedBlockBasedTable : public BlockBasedTable { explicit MockedBlockBasedTable(Rep* rep) : BlockBasedTable(rep) {} virtual CachableEntry GetFilter( - const BlockHandle& filter_blk_handle, const bool is_a_filter_partition, - bool no_io) const override { + const BlockHandle& filter_blk_handle, + const bool /*is_a_filter_partition*/, bool /*no_io*/) const override { Slice slice = slices[filter_blk_handle.offset()]; auto obj = new FullFilterBlockReader( nullptr, true, BlockContents(slice, false, kNoCompression), diff --git a/table/plain_table_factory.cc b/table/plain_table_factory.cc index eadc2c099..7a07de731 100644 --- a/table/plain_table_factory.cc +++ b/table/plain_table_factory.cc @@ -18,7 +18,7 @@ Status PlainTableFactory::NewTableReader( const TableReaderOptions& table_reader_options, unique_ptr&& file, uint64_t file_size, unique_ptr* table, - bool prefetch_index_and_filter_in_cache) const { + bool /*prefetch_index_and_filter_in_cache*/) const { return PlainTableReader::Open( table_reader_options.ioptions, table_reader_options.env_options, table_reader_options.internal_comparator, std::move(file), file_size, diff --git a/table/plain_table_factory.h b/table/plain_table_factory.h index 33cd31347..37c120a0f 100644 --- a/table/plain_table_factory.h +++ b/table/plain_table_factory.h @@ -163,8 +163,9 @@ class PlainTableFactory : public TableFactory { static const char kValueTypeSeqId0 = char(0xFF); // Sanitizes the specified DB Options. - Status SanitizeOptions(const DBOptions& db_opts, - const ColumnFamilyOptions& cf_opts) const override { + Status SanitizeOptions( + const DBOptions& /*db_opts*/, + const ColumnFamilyOptions& /*cf_opts*/) const override { return Status::OK(); } diff --git a/table/plain_table_key_coding.cc b/table/plain_table_key_coding.cc index 3e87c03d1..6f5ee9b4a 100644 --- a/table/plain_table_key_coding.cc +++ b/table/plain_table_key_coding.cc @@ -288,7 +288,7 @@ Status PlainTableKeyDecoder::NextPlainEncodingKey(uint32_t start_offset, ParsedInternalKey* parsed_key, Slice* internal_key, uint32_t* bytes_read, - bool* seekable) { + bool* /*seekable*/) { uint32_t user_key_size = 0; Status s; if (fixed_user_key_len_ != kPlainTableVariableLength) { diff --git a/table/plain_table_reader.cc b/table/plain_table_reader.cc index 0f9449e86..8089dcd07 100644 --- a/table/plain_table_reader.cc +++ b/table/plain_table_reader.cc @@ -192,7 +192,7 @@ void PlainTableReader::SetupForCompaction() { InternalIterator* PlainTableReader::NewIterator(const ReadOptions& options, Arena* arena, const InternalKeyComparator*, - bool skip_filters) { + bool /*skip_filters*/) { bool use_prefix_seek = !IsTotalOrderMode() && !options.total_order_seek; if (arena == nullptr) { return new PlainTableIterator(this, use_prefix_seek); @@ -537,8 +537,8 @@ void PlainTableReader::Prepare(const Slice& target) { } } -Status PlainTableReader::Get(const ReadOptions& ro, const Slice& target, - GetContext* get_context, bool skip_filters) { +Status PlainTableReader::Get(const ReadOptions& /*ro*/, const Slice& target, + GetContext* get_context, bool /*skip_filters*/) { // Check bloom filter first. Slice prefix_slice; uint32_t prefix_hash; @@ -602,7 +602,7 @@ Status PlainTableReader::Get(const ReadOptions& ro, const Slice& target, return Status::OK(); } -uint64_t PlainTableReader::ApproximateOffsetOf(const Slice& key) { +uint64_t PlainTableReader::ApproximateOffsetOf(const Slice& /*key*/) { return 0; } @@ -706,7 +706,7 @@ void PlainTableIterator::Seek(const Slice& target) { } } -void PlainTableIterator::SeekForPrev(const Slice& target) { +void PlainTableIterator::SeekForPrev(const Slice& /*target*/) { assert(false); status_ = Status::NotSupported("SeekForPrev() is not supported in PlainTable"); diff --git a/table/sst_file_writer_collectors.h b/table/sst_file_writer_collectors.h index ce3a45f5a..89e0970d8 100644 --- a/table/sst_file_writer_collectors.h +++ b/table/sst_file_writer_collectors.h @@ -26,8 +26,8 @@ class SstFileWriterPropertiesCollector : public IntTblPropCollector { SequenceNumber global_seqno) : version_(version), global_seqno_(global_seqno) {} - virtual Status InternalAdd(const Slice& key, const Slice& value, - uint64_t file_size) override { + virtual Status InternalAdd(const Slice& /*key*/, const Slice& /*value*/, + uint64_t /*file_size*/) override { // Intentionally left blank. Have no interest in collecting stats for // individual key/value pairs. return Status::OK(); @@ -68,7 +68,7 @@ class SstFileWriterPropertiesCollectorFactory : version_(version), global_seqno_(global_seqno) {} virtual IntTblPropCollector* CreateIntTblPropCollector( - uint32_t column_family_id) override { + uint32_t /*column_family_id*/) override { return new SstFileWriterPropertiesCollector(version_, global_seqno_); } diff --git a/table/table_reader.h b/table/table_reader.h index 5f47468e6..9f137dab1 100644 --- a/table/table_reader.h +++ b/table/table_reader.h @@ -44,7 +44,7 @@ class TableReader { bool skip_filters = false) = 0; virtual InternalIterator* NewRangeTombstoneIterator( - const ReadOptions& read_options) { + const ReadOptions& /*read_options*/) { return nullptr; } @@ -63,7 +63,7 @@ class TableReader { virtual std::shared_ptr GetTableProperties() const = 0; // Prepare work that can be done before the real Get() - virtual void Prepare(const Slice& target) {} + virtual void Prepare(const Slice& /*target*/) {} // Report an approximation of how much memory has been used. virtual size_t ApproximateMemoryUsage() const = 0; @@ -95,7 +95,7 @@ class TableReader { } // convert db file to a human readable form - virtual Status DumpTable(WritableFile* out_file) { + virtual Status DumpTable(WritableFile* /*out_file*/) { return Status::NotSupported("DumpTable() not supported"); } diff --git a/table/table_test.cc b/table/table_test.cc index c55eb4255..a1f6a5b6e 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -66,9 +66,13 @@ class DummyPropertiesCollector : public TablePropertiesCollector { public: const char* Name() const { return ""; } - Status Finish(UserCollectedProperties* properties) { return Status::OK(); } + Status Finish(UserCollectedProperties* /*properties*/) { + return Status::OK(); + } - Status Add(const Slice& user_key, const Slice& value) { return Status::OK(); } + Status Add(const Slice& /*user_key*/, const Slice& /*value*/) { + return Status::OK(); + } virtual UserCollectedProperties GetReadableProperties() const { return UserCollectedProperties{}; @@ -79,7 +83,7 @@ class DummyPropertiesCollectorFactory1 : public TablePropertiesCollectorFactory { public: virtual TablePropertiesCollector* CreateTablePropertiesCollector( - TablePropertiesCollectorFactory::Context context) { + TablePropertiesCollectorFactory::Context /*context*/) { return new DummyPropertiesCollector(); } const char* Name() const { return "DummyPropertiesCollector1"; } @@ -89,7 +93,7 @@ class DummyPropertiesCollectorFactory2 : public TablePropertiesCollectorFactory { public: virtual TablePropertiesCollector* CreateTablePropertiesCollector( - TablePropertiesCollectorFactory::Context context) { + TablePropertiesCollectorFactory::Context /*context*/) { return new DummyPropertiesCollector(); } const char* Name() const { return "DummyPropertiesCollector2"; } @@ -207,11 +211,11 @@ class BlockConstructor: public Constructor { ~BlockConstructor() { delete block_; } - virtual Status FinishImpl(const Options& options, - const ImmutableCFOptions& ioptions, - const BlockBasedTableOptions& table_options, - const InternalKeyComparator& internal_comparator, - const stl_wrappers::KVMap& kv_map) override { + virtual Status FinishImpl( + const Options& /*options*/, const ImmutableCFOptions& /*ioptions*/, + const BlockBasedTableOptions& table_options, + const InternalKeyComparator& /*internal_comparator*/, + const stl_wrappers::KVMap& kv_map) override { delete block_; block_ = nullptr; BlockBuilder builder(table_options.block_restart_interval); @@ -305,7 +309,7 @@ class TableConstructor: public Constructor { virtual Status FinishImpl(const Options& options, const ImmutableCFOptions& ioptions, - const BlockBasedTableOptions& table_options, + const BlockBasedTableOptions& /*table_options*/, const InternalKeyComparator& internal_comparator, const stl_wrappers::KVMap& kv_map) override { Reset(); @@ -433,10 +437,11 @@ class MemTableConstructor: public Constructor { ~MemTableConstructor() { delete memtable_->Unref(); } - virtual Status FinishImpl(const Options&, const ImmutableCFOptions& ioptions, - const BlockBasedTableOptions& table_options, - const InternalKeyComparator& internal_comparator, - const stl_wrappers::KVMap& kv_map) override { + virtual Status FinishImpl( + const Options&, const ImmutableCFOptions& ioptions, + const BlockBasedTableOptions& /*table_options*/, + const InternalKeyComparator& /*internal_comparator*/, + const stl_wrappers::KVMap& kv_map) override { delete memtable_->Unref(); ImmutableCFOptions mem_ioptions(ioptions); memtable_ = new MemTable(internal_comparator_, mem_ioptions, @@ -499,11 +504,11 @@ class DBConstructor: public Constructor { ~DBConstructor() { delete db_; } - virtual Status FinishImpl(const Options& options, - const ImmutableCFOptions& ioptions, - const BlockBasedTableOptions& table_options, - const InternalKeyComparator& internal_comparator, - const stl_wrappers::KVMap& kv_map) override { + virtual Status FinishImpl( + const Options& /*options*/, const ImmutableCFOptions& /*ioptions*/, + const BlockBasedTableOptions& /*table_options*/, + const InternalKeyComparator& /*internal_comparator*/, + const stl_wrappers::KVMap& kv_map) override { delete db_; db_ = nullptr; NewDB(); @@ -665,7 +670,7 @@ class FixedOrLessPrefixTransform : public SliceTransform { return Slice(src.data(), prefix_len_); } - virtual bool InDomain(const Slice& src) const override { return true; } + virtual bool InDomain(const Slice& /*src*/) const override { return true; } virtual bool InRange(const Slice& dst) const override { return (dst.size() <= prefix_len_); @@ -795,7 +800,7 @@ class HarnessTest : public testing::Test { TestRandomAccess(rnd, keys, data); } - void TestForwardScan(const std::vector& keys, + void TestForwardScan(const std::vector& /*keys*/, const stl_wrappers::KVMap& data) { InternalIterator* iter = constructor_->NewIterator(); ASSERT_TRUE(!iter->Valid()); @@ -813,7 +818,7 @@ class HarnessTest : public testing::Test { } } - void TestBackwardScan(const std::vector& keys, + void TestBackwardScan(const std::vector& /*keys*/, const stl_wrappers::KVMap& data) { InternalIterator* iter = constructor_->NewIterator(); ASSERT_TRUE(!iter->Valid()); @@ -1528,7 +1533,7 @@ static std::string RandomString(Random* rnd, int len) { } void AddInternalKey(TableConstructor* c, const std::string& prefix, - int suffix_len = 800) { + int /*suffix_len*/ = 800) { static Random rnd(1023); InternalKey k(prefix + RandomString(&rnd, 800), 0, kTypeValue); c->Add(k.Encode().ToString(), "v"); @@ -2865,7 +2870,7 @@ class TestPrefixExtractor : public rocksdb::SliceTransform { return true; } - bool InRange(const rocksdb::Slice& dst) const override { return true; } + bool InRange(const rocksdb::Slice& /*dst*/) const override { return true; } bool IsValid(const rocksdb::Slice& src) const { if (src.size() != 4) { diff --git a/third-party/fbson/FbsonDocument.h b/third-party/fbson/FbsonDocument.h index 6fb8a93f1..fc7ca76ff 100644 --- a/third-party/fbson/FbsonDocument.h +++ b/third-party/fbson/FbsonDocument.h @@ -355,7 +355,7 @@ class NumberValT : public FbsonValue { unsigned int numPackedBytes() const { return sizeof(FbsonValue) + sizeof(T); } // catch all unknow specialization of the template class - bool setVal(T value) { return false; } + bool setVal(T /*value*/) { return false; } private: T num_; diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 0cc424eea..dfa00de5a 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -235,7 +235,7 @@ DEFINE_bool(use_uint64_comparator, false, "use Uint64 user comparator"); DEFINE_int64(batch_size, 1, "Batch size"); -static bool ValidateKeySize(const char* flagname, int32_t value) { +static bool ValidateKeySize(const char* /*flagname*/, int32_t /*value*/) { return true; } @@ -2041,8 +2041,9 @@ class Benchmark { explicit ExpiredTimeFilter( const std::shared_ptr& timestamp_emulator) : timestamp_emulator_(timestamp_emulator) {} - bool Filter(int level, const Slice& key, const Slice& existing_value, - std::string* new_value, bool* value_changed) const override { + bool Filter(int /*level*/, const Slice& key, + const Slice& /*existing_value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { return KeyExpired(timestamp_emulator_.get(), key); } const char* Name() const override { return "ExpiredTimeFilter"; } @@ -3351,12 +3352,9 @@ void VerifyDBFromDB(std::string& truth_db_name) { class KeyGenerator { public: - KeyGenerator(Random64* rand, WriteMode mode, - uint64_t num, uint64_t num_per_set = 64 * 1024) - : rand_(rand), - mode_(mode), - num_(num), - next_(0) { + KeyGenerator(Random64* rand, WriteMode mode, uint64_t num, + uint64_t /*num_per_set*/ = 64 * 1024) + : rand_(rand), mode_(mode), num_(num), next_(0) { if (mode_ == UNIQUE_RANDOM) { // NOTE: if memory consumption of this approach becomes a concern, // we can either break it into pieces and only random shuffle a section diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index 2cd4d94d1..1c02ef640 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -111,7 +111,7 @@ LDBCommand* LDBCommand::InitFromCmdLineArgs( LDBCommand* LDBCommand::InitFromCmdLineArgs( const std::vector& args, const Options& options, const LDBOptions& ldb_options, - const std::vector* column_families, + const std::vector* /*column_families*/, const std::function& selector) { // --x=y command line arguments are added as x->y map entries in // parsed_params.option_map. @@ -456,7 +456,7 @@ std::vector LDBCommand::BuildCmdLineOptions( * updated. */ bool LDBCommand::ParseIntOption( - const std::map& options, + const std::map& /*options*/, const std::string& option, int& value, LDBCommandExecuteResult& exec_state) { std::map::const_iterator itr = @@ -486,7 +486,7 @@ bool LDBCommand::ParseIntOption( * Returns false otherwise. */ bool LDBCommand::ParseStringOption( - const std::map& options, + const std::map& /*options*/, const std::string& option, std::string* value) { auto itr = option_map_.find(option); if (itr != option_map_.end()) { @@ -764,7 +764,7 @@ bool LDBCommand::StringToBool(std::string val) { } CompactorCommand::CompactorCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false, @@ -834,7 +834,7 @@ const std::string DBLoaderCommand::ARG_BULK_LOAD = "bulk_load"; const std::string DBLoaderCommand::ARG_COMPACT = "compact"; DBLoaderCommand::DBLoaderCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand( @@ -950,7 +950,7 @@ void ManifestDumpCommand::Help(std::string& ret) { } ManifestDumpCommand::ManifestDumpCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand( @@ -1145,7 +1145,7 @@ const std::string InternalDumpCommand::ARG_STATS = "stats"; const std::string InternalDumpCommand::ARG_INPUT_KEY_HEX = "input_key_hex"; InternalDumpCommand::InternalDumpCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand( @@ -1284,7 +1284,7 @@ const std::string DBDumperCommand::ARG_STATS = "stats"; const std::string DBDumperCommand::ARG_TTL_BUCKET = "bucket"; DBDumperCommand::DBDumperCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, true, @@ -1560,7 +1560,7 @@ const std::string ReduceDBLevelsCommand::ARG_PRINT_OLD_LEVELS = "print_old_levels"; ReduceDBLevelsCommand::ReduceDBLevelsCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false, @@ -1689,7 +1689,7 @@ const std::string ChangeCompactionStyleCommand::ARG_NEW_COMPACTION_STYLE = "new_compaction_style"; ChangeCompactionStyleCommand::ChangeCompactionStyleCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false, @@ -1826,7 +1826,7 @@ void ChangeCompactionStyleCommand::DoCommand() { namespace { struct StdErrReporter : public log::Reader::Reporter { - virtual void Corruption(size_t bytes, const Status& s) override { + virtual void Corruption(size_t /*bytes*/, const Status& s) override { std::cerr << "Corruption detected in log file " << s.ToString() << "\n"; } }; @@ -1990,7 +1990,7 @@ const std::string WALDumperCommand::ARG_PRINT_VALUE = "print_value"; const std::string WALDumperCommand::ARG_PRINT_HEADER = "header"; WALDumperCommand::WALDumperCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, true, @@ -2074,7 +2074,7 @@ void GetCommand::DoCommand() { // ---------------------------------------------------------------------------- ApproxSizeCommand::ApproxSizeCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, true, @@ -2190,7 +2190,7 @@ Options BatchPutCommand::PrepareOptionsForOpenDB() { // ---------------------------------------------------------------------------- -ScanCommand::ScanCommand(const std::vector& params, +ScanCommand::ScanCommand(const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand( @@ -2474,7 +2474,7 @@ const char* DBQuerierCommand::PUT_CMD = "put"; const char* DBQuerierCommand::DELETE_CMD = "delete"; DBQuerierCommand::DBQuerierCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand( @@ -2553,7 +2553,7 @@ void DBQuerierCommand::DoCommand() { // ---------------------------------------------------------------------------- CheckConsistencyCommand::CheckConsistencyCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false, BuildCmdLineOptions({})) {} @@ -2585,7 +2585,7 @@ void CheckConsistencyCommand::DoCommand() { const std::string CheckPointCommand::ARG_CHECKPOINT_DIR = "checkpoint_dir"; CheckPointCommand::CheckPointCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false /* is_read_only */, @@ -2623,7 +2623,7 @@ void CheckPointCommand::DoCommand() { // ---------------------------------------------------------------------------- -RepairCommand::RepairCommand(const std::vector& params, +RepairCommand::RepairCommand(const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false, BuildCmdLineOptions({})) {} @@ -2653,7 +2653,7 @@ const std::string BackupableCommand::ARG_BACKUP_DIR = "backup_dir"; const std::string BackupableCommand::ARG_STDERR_LOG_LEVEL = "stderr_log_level"; BackupableCommand::BackupableCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, false /* is_read_only */, @@ -2831,7 +2831,7 @@ void DumpSstFile(std::string filename, bool output_hex, bool show_properties) { } // namespace DBFileDumperCommand::DBFileDumperCommand( - const std::vector& params, + const std::vector& /*params*/, const std::map& options, const std::vector& flags) : LDBCommand(options, flags, true, BuildCmdLineOptions({})) {} diff --git a/tools/ldb_tool.cc b/tools/ldb_tool.cc index e8229ef7b..b09076ecc 100644 --- a/tools/ldb_tool.cc +++ b/tools/ldb_tool.cc @@ -13,7 +13,7 @@ namespace rocksdb { LDBOptions::LDBOptions() {} void LDBCommandRunner::PrintHelp(const LDBOptions& ldb_options, - const char* exec_name) { + const char* /*exec_name*/) { std::string ret; ret.append(ldb_options.print_help_header); diff --git a/tools/sst_dump_tool.cc b/tools/sst_dump_tool.cc index 2a1729c76..6110d5d5c 100644 --- a/tools/sst_dump_tool.cc +++ b/tools/sst_dump_tool.cc @@ -110,9 +110,9 @@ Status SstFileReader::GetTableReader(const std::string& file_path) { } Status SstFileReader::NewTableReader( - const ImmutableCFOptions& ioptions, const EnvOptions& soptions, - const InternalKeyComparator& internal_comparator, uint64_t file_size, - unique_ptr* table_reader) { + const ImmutableCFOptions& /*ioptions*/, const EnvOptions& /*soptions*/, + const InternalKeyComparator& /*internal_comparator*/, uint64_t file_size, + unique_ptr* /*table_reader*/) { // We need to turn off pre-fetching of index and filter nodes for // BlockBasedTable shared_ptr block_table_factory = diff --git a/util/compression.h b/util/compression.h index 468b961fb..b75672f14 100644 --- a/util/compression.h +++ b/util/compression.h @@ -151,8 +151,9 @@ inline std::string CompressionTypeToString(CompressionType compression_type) { // 2 -- Zlib, BZip2 and LZ4 encode decompressed size as Varint32 just before the // start of compressed block. Snappy format is the same as version 1. -inline bool Snappy_Compress(const CompressionOptions& opts, const char* input, - size_t length, ::std::string* output) { +inline bool Snappy_Compress(const CompressionOptions& /*opts*/, + const char* input, size_t length, + ::std::string* output) { #ifdef SNAPPY output->resize(snappy::MaxCompressedLength(length)); size_t outlen; @@ -381,10 +382,9 @@ inline char* Zlib_Uncompress(const char* input_data, size_t input_length, // block header // compress_format_version == 2 -- decompressed size is included in the block // header in varint32 format -inline bool BZip2_Compress(const CompressionOptions& opts, - uint32_t compress_format_version, - const char* input, size_t length, - ::std::string* output) { +inline bool BZip2_Compress(const CompressionOptions& /*opts*/, + uint32_t compress_format_version, const char* input, + size_t length, ::std::string* output) { #ifdef BZIP2 if (length > std::numeric_limits::max()) { // Can't compress more than 4GB @@ -520,7 +520,7 @@ inline char* BZip2_Uncompress(const char* input_data, size_t input_length, // header in varint32 format // @param compression_dict Data for presetting the compression library's // dictionary. -inline bool LZ4_Compress(const CompressionOptions& opts, +inline bool LZ4_Compress(const CompressionOptions& /*opts*/, uint32_t compress_format_version, const char* input, size_t length, ::std::string* output, const Slice compression_dict = Slice()) { @@ -705,15 +705,17 @@ inline bool LZ4HC_Compress(const CompressionOptions& opts, return false; } -inline bool XPRESS_Compress(const char* input, size_t length, std::string* output) { +inline bool XPRESS_Compress(const char* /*input*/, size_t /*length*/, + std::string* /*output*/) { #ifdef XPRESS return port::xpress::Compress(input, length, output); #endif return false; } -inline char* XPRESS_Uncompress(const char* input_data, size_t input_length, - int* decompress_size) { +inline char* XPRESS_Uncompress(const char* /*input_data*/, + size_t /*input_length*/, + int* /*decompress_size*/) { #ifdef XPRESS return port::xpress::Decompress(input_data, input_length, decompress_size); #endif diff --git a/util/delete_scheduler_test.cc b/util/delete_scheduler_test.cc index 208bdd741..7d531244c 100644 --- a/util/delete_scheduler_test.cc +++ b/util/delete_scheduler_test.cc @@ -239,7 +239,7 @@ TEST_F(DeleteSchedulerTest, DisableRateLimiting) { int bg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); @@ -346,7 +346,7 @@ TEST_F(DeleteSchedulerTest, StartBGEmptyTrashMultipleTimes) { int bg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024 * 1024; // 1 MB / sec @@ -381,7 +381,7 @@ TEST_F(DeleteSchedulerTest, DestructorWithNonEmptyQueue) { int bg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1; // 1 Byte / sec @@ -410,7 +410,7 @@ TEST_F(DeleteSchedulerTest, MoveToTrashError) { int bg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); rate_bytes_per_sec_ = 1024; // 1 Kb / sec @@ -436,10 +436,9 @@ TEST_F(DeleteSchedulerTest, DISABLED_DynamicRateLimiting1) { int fg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DeleteScheduler::DeleteFile", - [&](void* arg) { fg_delete_file++; }); + "DeleteScheduler::DeleteFile", [&](void* /*arg*/) { fg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::BackgroundEmptyTrash:Wait", [&](void* arg) { penalties.push_back(*(static_cast(arg))); }); @@ -518,9 +517,9 @@ TEST_F(DeleteSchedulerTest, ImmediateDeleteOn25PercDBSize) { int fg_delete_file = 0; rocksdb::SyncPoint::GetInstance()->SetCallBack( "DeleteScheduler::DeleteTrashFile:DeleteFile", - [&](void* arg) { bg_delete_file++; }); + [&](void* /*arg*/) { bg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DeleteScheduler::DeleteFile", [&](void* arg) { fg_delete_file++; }); + "DeleteScheduler::DeleteFile", [&](void* /*arg*/) { fg_delete_file++; }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); diff --git a/util/file_reader_writer_test.cc b/util/file_reader_writer_test.cc index dac518245..aa8199266 100644 --- a/util/file_reader_writer_test.cc +++ b/util/file_reader_writer_test.cc @@ -26,9 +26,7 @@ TEST_F(WritableFileWriterTest, RangeSync) { size_ += data.size(); return Status::OK(); } - virtual Status Truncate(uint64_t size) override { - return Status::OK(); - } + virtual Status Truncate(uint64_t /*size*/) override { return Status::OK(); } Status Close() override { EXPECT_GE(size_, last_synced_ + kMb); EXPECT_LT(size_, last_synced_ + 2 * kMb); @@ -39,17 +37,21 @@ TEST_F(WritableFileWriterTest, RangeSync) { Status Flush() override { return Status::OK(); } Status Sync() override { return Status::OK(); } Status Fsync() override { return Status::OK(); } - void SetIOPriority(Env::IOPriority pri) override {} + void SetIOPriority(Env::IOPriority /*pri*/) override {} uint64_t GetFileSize() override { return size_; } - void GetPreallocationStatus(size_t* block_size, - size_t* last_allocated_block) override {} - size_t GetUniqueId(char* id, size_t max_size) const override { return 0; } - Status InvalidateCache(size_t offset, size_t length) override { + void GetPreallocationStatus(size_t* /*block_size*/, + size_t* /*last_allocated_block*/) override {} + size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const override { + return 0; + } + Status InvalidateCache(size_t /*offset*/, size_t /*length*/) override { return Status::OK(); } protected: - Status Allocate(uint64_t offset, uint64_t len) override { return Status::OK(); } + Status Allocate(uint64_t /*offset*/, uint64_t /*len*/) override { + return Status::OK(); + } Status RangeSync(uint64_t offset, uint64_t nbytes) override { EXPECT_EQ(offset % 4096, 0u); EXPECT_EQ(nbytes % 4096, 0u); @@ -119,12 +121,14 @@ TEST_F(WritableFileWriterTest, IncrementalBuffer) { Status Flush() override { return Status::OK(); } Status Sync() override { return Status::OK(); } Status Fsync() override { return Status::OK(); } - void SetIOPriority(Env::IOPriority pri) override {} + void SetIOPriority(Env::IOPriority /*pri*/) override {} uint64_t GetFileSize() override { return size_; } - void GetPreallocationStatus(size_t* block_size, - size_t* last_allocated_block) override {} - size_t GetUniqueId(char* id, size_t max_size) const override { return 0; } - Status InvalidateCache(size_t offset, size_t length) override { + void GetPreallocationStatus(size_t* /*block_size*/, + size_t* /*last_allocated_block*/) override {} + size_t GetUniqueId(char* /*id*/, size_t /*max_size*/) const override { + return 0; + } + Status InvalidateCache(size_t /*offset*/, size_t /*length*/) override { return Status::OK(); } bool use_direct_io() const override { return use_direct_io_; } @@ -174,13 +178,13 @@ TEST_F(WritableFileWriterTest, AppendStatusReturn) { explicit FakeWF() : use_direct_io_(false), io_error_(false) {} virtual bool use_direct_io() const override { return use_direct_io_; } - Status Append(const Slice& data) override { + Status Append(const Slice& /*data*/) override { if (io_error_) { return Status::IOError("Fake IO error"); } return Status::OK(); } - Status PositionedAppend(const Slice& data, uint64_t) override { + Status PositionedAppend(const Slice& /*data*/, uint64_t) override { if (io_error_) { return Status::IOError("Fake IO error"); } diff --git a/util/slice.cc b/util/slice.cc index 8d95a8ae1..eed59657f 100644 --- a/util/slice.cc +++ b/util/slice.cc @@ -74,7 +74,7 @@ class CappedPrefixTransform : public SliceTransform { return Slice(src.data(), std::min(cap_len_, src.size())); } - virtual bool InDomain(const Slice& src) const override { return true; } + virtual bool InDomain(const Slice& /*src*/) const override { return true; } virtual bool InRange(const Slice& dst) const override { return (dst.size() <= cap_len_); @@ -93,11 +93,11 @@ class NoopTransform : public SliceTransform { virtual Slice Transform(const Slice& src) const override { return src; } - virtual bool InDomain(const Slice& src) const override { return true; } + virtual bool InDomain(const Slice& /*src*/) const override { return true; } - virtual bool InRange(const Slice& dst) const override { return true; } + virtual bool InRange(const Slice& /*dst*/) const override { return true; } - virtual bool SameResultWhenAppended(const Slice& prefix) const override { + virtual bool SameResultWhenAppended(const Slice& /*prefix*/) const override { return false; } }; diff --git a/util/testutil.cc b/util/testutil.cc index f3010f3f2..516410144 100644 --- a/util/testutil.cc +++ b/util/testutil.cc @@ -107,12 +107,12 @@ class Uint64ComparatorImpl : public Comparator { } } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const override { + virtual void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override { return; } - virtual void FindShortSuccessor(std::string* key) const override { + virtual void FindShortSuccessor(std::string* /*key*/) const override { return; } }; diff --git a/util/testutil.h b/util/testutil.h index 02bfb0ff6..069b883f2 100644 --- a/util/testutil.h +++ b/util/testutil.h @@ -121,10 +121,10 @@ class SimpleSuffixReverseComparator : public Comparator { return -(suffix_a.compare(suffix_b)); } } - virtual void FindShortestSeparator(std::string* start, - const Slice& limit) const override {} + virtual void FindShortestSeparator(std::string* /*start*/, + const Slice& /*limit*/) const override {} - virtual void FindShortSuccessor(std::string* key) const override {} + virtual void FindShortSuccessor(std::string* /*key*/) const override {} }; // Returns a user key comparator that can be used for comparing two uint64_t @@ -255,7 +255,8 @@ class RandomRWStringSink : public RandomRWFile { return Status::OK(); } - Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const { + Status Read(uint64_t offset, size_t n, Slice* result, + char* /*scratch*/) const { *result = Slice(nullptr, 0); if (offset < ss_->contents_.size()) { size_t str_res_sz = @@ -376,7 +377,7 @@ class StringSource: public RandomAccessFile { class NullLogger : public Logger { public: using Logger::Logv; - virtual void Logv(const char* format, va_list ap) override {} + virtual void Logv(const char* /*format*/, va_list /*ap*/) override {} virtual size_t GetLogFileSize() const override { return 0; } }; @@ -457,15 +458,16 @@ class FilterNumber : public CompactionFilter { std::string last_merge_operand_key() { return last_merge_operand_key_; } - bool Filter(int level, const rocksdb::Slice& key, const rocksdb::Slice& value, - std::string* new_value, bool* value_changed) const override { + bool Filter(int /*level*/, const rocksdb::Slice& /*key*/, + const rocksdb::Slice& value, std::string* /*new_value*/, + bool* /*value_changed*/) const override { if (value.size() == sizeof(uint64_t)) { return num_ == DecodeFixed64(value.data()); } return true; } - bool FilterMergeOperand(int level, const rocksdb::Slice& key, + bool FilterMergeOperand(int /*level*/, const rocksdb::Slice& key, const rocksdb::Slice& value) const override { last_merge_operand_key_ = key.ToString(); if (value.size() == sizeof(uint64_t)) { @@ -563,7 +565,7 @@ class StringEnv : public EnvWrapper { // The following text is boilerplate that forwards all methods to target() Status NewSequentialFile(const std::string& f, unique_ptr* r, - const EnvOptions& options) override { + const EnvOptions& /*options*/) override { auto iter = files_.find(f); if (iter == files_.end()) { return Status::NotFound("The specified file does not exist", f); @@ -571,13 +573,13 @@ class StringEnv : public EnvWrapper { r->reset(new SeqStringSource(iter->second)); return Status::OK(); } - Status NewRandomAccessFile(const std::string& f, - unique_ptr* r, - const EnvOptions& options) override { + Status NewRandomAccessFile(const std::string& /*f*/, + unique_ptr* /*r*/, + const EnvOptions& /*options*/) override { return Status::NotSupported(); } Status NewWritableFile(const std::string& f, unique_ptr* r, - const EnvOptions& options) override { + const EnvOptions& /*options*/) override { auto iter = files_.find(f); if (iter != files_.end()) { return Status::IOError("The specified file already exists", f); @@ -585,8 +587,8 @@ class StringEnv : public EnvWrapper { r->reset(new StringSink(&files_[f])); return Status::OK(); } - virtual Status NewDirectory(const std::string& name, - unique_ptr* result) override { + virtual Status NewDirectory(const std::string& /*name*/, + unique_ptr* /*result*/) override { return Status::NotSupported(); } Status FileExists(const std::string& f) override { @@ -595,21 +597,21 @@ class StringEnv : public EnvWrapper { } return Status::OK(); } - Status GetChildren(const std::string& dir, - std::vector* r) override { + Status GetChildren(const std::string& /*dir*/, + std::vector* /*r*/) override { return Status::NotSupported(); } Status DeleteFile(const std::string& f) override { files_.erase(f); return Status::OK(); } - Status CreateDir(const std::string& d) override { + Status CreateDir(const std::string& /*d*/) override { return Status::NotSupported(); } - Status CreateDirIfMissing(const std::string& d) override { + Status CreateDirIfMissing(const std::string& /*d*/) override { return Status::NotSupported(); } - Status DeleteDir(const std::string& d) override { + Status DeleteDir(const std::string& /*d*/) override { return Status::NotSupported(); } Status GetFileSize(const std::string& f, uint64_t* s) override { @@ -621,24 +623,25 @@ class StringEnv : public EnvWrapper { return Status::OK(); } - Status GetFileModificationTime(const std::string& fname, - uint64_t* file_mtime) override { + Status GetFileModificationTime(const std::string& /*fname*/, + uint64_t* /*file_mtime*/) override { return Status::NotSupported(); } - Status RenameFile(const std::string& s, const std::string& t) override { + Status RenameFile(const std::string& /*s*/, + const std::string& /*t*/) override { return Status::NotSupported(); } - Status LinkFile(const std::string& s, const std::string& t) override { + Status LinkFile(const std::string& /*s*/, const std::string& /*t*/) override { return Status::NotSupported(); } - Status LockFile(const std::string& f, FileLock** l) override { + Status LockFile(const std::string& /*f*/, FileLock** /*l*/) override { return Status::NotSupported(); } - Status UnlockFile(FileLock* l) override { return Status::NotSupported(); } + Status UnlockFile(FileLock* /*l*/) override { return Status::NotSupported(); } protected: std::unordered_map files_; @@ -661,14 +664,14 @@ class ChanglingMergeOperator : public MergeOperator { void SetName(const std::string& name) { name_ = name; } - virtual bool FullMergeV2(const MergeOperationInput& merge_in, - MergeOperationOutput* merge_out) const override { + virtual bool FullMergeV2(const MergeOperationInput& /*merge_in*/, + MergeOperationOutput* /*merge_out*/) const override { return false; } - virtual bool PartialMergeMulti(const Slice& key, - const std::deque& operand_list, - std::string* new_value, - Logger* logger) const override { + virtual bool PartialMergeMulti(const Slice& /*key*/, + const std::deque& /*operand_list*/, + std::string* /*new_value*/, + Logger* /*logger*/) const override { return false; } virtual const char* Name() const override { return name_.c_str(); } @@ -689,8 +692,9 @@ class ChanglingCompactionFilter : public CompactionFilter { void SetName(const std::string& name) { name_ = name; } - bool Filter(int level, const Slice& key, const Slice& existing_value, - std::string* new_value, bool* value_changed) const override { + bool Filter(int /*level*/, const Slice& /*key*/, + const Slice& /*existing_value*/, std::string* /*new_value*/, + bool* /*value_changed*/) const override { return false; } @@ -713,7 +717,7 @@ class ChanglingCompactionFilterFactory : public CompactionFilterFactory { void SetName(const std::string& name) { name_ = name; } std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr(); } diff --git a/util/thread_local_test.cc b/util/thread_local_test.cc index 6fee5eaa5..789be83d8 100644 --- a/util/thread_local_test.cc +++ b/util/thread_local_test.cc @@ -535,7 +535,7 @@ TEST_F(ThreadLocalTest, CompareAndSwap) { namespace { -void* AccessThreadLocal(void* arg) { +void* AccessThreadLocal(void* /*arg*/) { TEST_SYNC_POINT("AccessThreadLocal:Start"); ThreadLocalPtr tlp; tlp.Reset(new std::string("hello RocksDB")); diff --git a/utilities/backupable/backupable_db.cc b/utilities/backupable/backupable_db.cc index 8921309e4..53f450dac 100644 --- a/utilities/backupable/backupable_db.cc +++ b/utilities/backupable/backupable_db.cc @@ -754,7 +754,7 @@ Status BackupEngineImpl::CreateNewBackupWithMetadata( uint64_t sequence_number = 0; s = checkpoint.CreateCustomCheckpoint( db->GetDBOptions(), - [&](const std::string& src_dirname, const std::string& fname, + [&](const std::string& /*src_dirname*/, const std::string& /*fname*/, FileType) { // custom checkpoint will switch to calling copy_file_cb after it sees // NotSupported returned from link_file_cb. diff --git a/utilities/backupable/backupable_db_test.cc b/utilities/backupable/backupable_db_test.cc index be20a8d9b..8b68c2153 100644 --- a/utilities/backupable/backupable_db_test.cc +++ b/utilities/backupable/backupable_db_test.cc @@ -57,7 +57,8 @@ class DummyDB : public StackableDB { } using DB::GetOptions; - virtual Options GetOptions(ColumnFamilyHandle* column_family) const override { + virtual Options GetOptions( + ColumnFamilyHandle* /*column_family*/) const override { return options_; } @@ -65,7 +66,7 @@ class DummyDB : public StackableDB { return DBOptions(options_); } - virtual Status EnableFileDeletions(bool force) override { + virtual Status EnableFileDeletions(bool /*force*/) override { EXPECT_TRUE(!deletions_enabled_); deletions_enabled_ = true; return Status::OK(); @@ -78,7 +79,7 @@ class DummyDB : public StackableDB { } virtual Status GetLiveFiles(std::vector& vec, uint64_t* mfs, - bool flush_memtable = true) override { + bool /*flush_memtable*/ = true) override { EXPECT_TRUE(!deletions_enabled_); vec = live_files_; *mfs = 100; @@ -135,7 +136,7 @@ class DummyDB : public StackableDB { } // To avoid FlushWAL called on stacked db which is nullptr - virtual Status FlushWAL(bool sync) override { return Status::OK(); } + virtual Status FlushWAL(bool /*sync*/) override { return Status::OK(); } std::vector live_files_; // pair @@ -521,7 +522,7 @@ class BackupableDBTest : public testing::Test { void OpenDBAndBackupEngineShareWithChecksum( bool destroy_old_data = false, bool dummy = false, - bool share_table_files = true, bool share_with_checksums = false) { + bool /*share_table_files*/ = true, bool share_with_checksums = false) { backupable_options_->share_files_with_checksum = share_with_checksums; OpenDBAndBackupEngine(destroy_old_data, dummy, share_with_checksums); } diff --git a/utilities/blob_db/blob_db.h b/utilities/blob_db/blob_db.h index f45a42f60..0b101e968 100644 --- a/utilities/blob_db/blob_db.h +++ b/utilities/blob_db/blob_db.h @@ -147,9 +147,9 @@ class BlobDB : public StackableDB { const Slice& key) override = 0; using rocksdb::StackableDB::Merge; - virtual Status Merge(const WriteOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - const Slice& value) override { + virtual Status Merge(const WriteOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, const Slice& /*value*/) override { return Status::NotSupported("Not supported operation in blob db."); } diff --git a/utilities/blob_db/blob_db_impl.cc b/utilities/blob_db/blob_db_impl.cc index 1dd72b6bc..e16482711 100644 --- a/utilities/blob_db/blob_db_impl.cc +++ b/utilities/blob_db/blob_db_impl.cc @@ -143,8 +143,9 @@ void BlobDBFlushBeginListener::OnFlushBegin(DB* db, const FlushJobInfo& info) { } WalFilter::WalProcessingOption BlobReconcileWalFilter::LogRecordFound( - unsigned long long log_number, const std::string& log_file_name, - const WriteBatch& batch, WriteBatch* new_batch, bool* batch_changed) { + unsigned long long /*log_number*/, const std::string& /*log_file_name*/, + const WriteBatch& /*batch*/, WriteBatch* /*new_batch*/, + bool* /*batch_changed*/) { return WalFilter::WalProcessingOption::kContinueProcessing; } @@ -158,7 +159,7 @@ bool blobf_compare_ttl::operator()(const std::shared_ptr& lhs, } void EvictAllVersionsCompactionListener::InternalListener::OnCompaction( - int level, const Slice& key, + int /*level*/, const Slice& key, CompactionEventListener::CompactionListenerValueType value_type, const Slice& existing_value, const SequenceNumber& sn, bool is_new) { if (!is_new && @@ -354,7 +355,7 @@ void BlobDBImpl::StartBackgroundTasks() { void BlobDBImpl::Shutdown() { shutdown_.store(true); } -void BlobDBImpl::OnFlushBeginHandler(DB* db, const FlushJobInfo& info) { +void BlobDBImpl::OnFlushBeginHandler(DB* /*db*/, const FlushJobInfo& /*info*/) { if (shutdown_.load()) return; // a callback that happens too soon needs to be ignored @@ -1395,7 +1396,7 @@ std::pair BlobDBImpl::SanityCheck(bool aborted) { } std::pair BlobDBImpl::CloseSeqWrite( - std::shared_ptr bfile, bool aborted) { + std::shared_ptr bfile, bool /*aborted*/) { { WriteLock wl(&mutex_); @@ -2051,7 +2052,7 @@ bool BlobDBImpl::CallbackEvictsImpl(std::shared_ptr bfile) { } std::pair BlobDBImpl::RemoveTimerQ(TimerQueue* tq, - bool aborted) { + bool /*aborted*/) { WriteLock wl(&mutex_); for (auto itr = cb_threads_.begin(); itr != cb_threads_.end(); ++itr) { if ((*itr).get() != tq) continue; diff --git a/utilities/blob_db/blob_log_reader.cc b/utilities/blob_db/blob_log_reader.cc index 3931c8669..09c329a05 100644 --- a/utilities/blob_db/blob_log_reader.cc +++ b/utilities/blob_db/blob_log_reader.cc @@ -41,7 +41,7 @@ Status Reader::ReadHeader(BlobLogHeader* header) { } Status Reader::ReadRecord(BlobLogRecord* record, ReadLevel level, - WALRecoveryMode wal_recovery_mode) { + WALRecoveryMode /*wal_recovery_mode*/) { record->Clear(); buffer_.clear(); backing_store_[0] = '\0'; diff --git a/utilities/checkpoint/checkpoint_impl.cc b/utilities/checkpoint/checkpoint_impl.cc index 0cdddbd62..c1cea914b 100644 --- a/utilities/checkpoint/checkpoint_impl.cc +++ b/utilities/checkpoint/checkpoint_impl.cc @@ -37,8 +37,8 @@ Status Checkpoint::Create(DB* db, Checkpoint** checkpoint_ptr) { return Status::OK(); } -Status Checkpoint::CreateCheckpoint(const std::string& checkpoint_dir, - uint64_t log_size_for_flush) { +Status Checkpoint::CreateCheckpoint(const std::string& /*checkpoint_dir*/, + uint64_t /*log_size_for_flush*/) { return Status::NotSupported(""); } diff --git a/utilities/checkpoint/checkpoint_test.cc b/utilities/checkpoint/checkpoint_test.cc index 56c8c6e05..ef3954196 100644 --- a/utilities/checkpoint/checkpoint_test.cc +++ b/utilities/checkpoint/checkpoint_test.cc @@ -370,7 +370,7 @@ TEST_F(CheckpointTest, CheckpointCFNoFlush) { Status s; // Take a snapshot rocksdb::SyncPoint::GetInstance()->SetCallBack( - "DBImpl::BackgroundCallFlush:start", [&](void* arg) { + "DBImpl::BackgroundCallFlush:start", [&](void* /*arg*/) { // Flush should never trigger. FAIL(); }); diff --git a/utilities/col_buf_decoder.h b/utilities/col_buf_decoder.h index e795e4ecd..918f87f94 100644 --- a/utilities/col_buf_decoder.h +++ b/utilities/col_buf_decoder.h @@ -23,7 +23,7 @@ struct ColDeclaration; class ColBufDecoder { public: virtual ~ColBufDecoder() = 0; - virtual size_t Init(const char* src) { return 0; } + virtual size_t Init(const char* /*src*/) { return 0; } virtual size_t Decode(const char* src, char** dest) = 0; static ColBufDecoder* NewColBufDecoder(const ColDeclaration& col_declaration); diff --git a/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc b/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc index 43a252934..49760ba5a 100644 --- a/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc +++ b/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc @@ -16,12 +16,11 @@ const char* RemoveEmptyValueCompactionFilter::Name() const { return "RemoveEmptyValueCompactionFilter"; } -bool RemoveEmptyValueCompactionFilter::Filter(int level, - const Slice& key, - const Slice& existing_value, - std::string* new_value, - bool* value_changed) const { - +bool RemoveEmptyValueCompactionFilter::Filter(int /*level*/, + const Slice& /*key*/, + const Slice& existing_value, + std::string* /*new_value*/, + bool* /*value_changed*/) const { // remove kv pairs that have empty values return existing_value.empty(); } diff --git a/utilities/document/document_db.cc b/utilities/document/document_db.cc index f7b5b3b2f..ac36f0e76 100644 --- a/utilities/document/document_db.cc +++ b/utilities/document/document_db.cc @@ -1038,24 +1038,25 @@ class DocumentDBImpl : public DocumentDB { // RocksDB functions using DB::Get; - virtual Status Get(const ReadOptions& options, - ColumnFamilyHandle* column_family, const Slice& key, - PinnableSlice* value) override { + virtual Status Get(const ReadOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/, PinnableSlice* /*value*/) override { return Status::NotSupported(""); } - virtual Status Get(const ReadOptions& options, const Slice& key, - std::string* value) override { + virtual Status Get(const ReadOptions& /*options*/, const Slice& /*key*/, + std::string* /*value*/) override { return Status::NotSupported(""); } - virtual Status Write(const WriteOptions& options, - WriteBatch* updates) override { + virtual Status Write(const WriteOptions& /*options*/, + WriteBatch* /*updates*/) override { return Status::NotSupported(""); } - virtual Iterator* NewIterator(const ReadOptions& options, - ColumnFamilyHandle* column_family) override { + virtual Iterator* NewIterator( + const ReadOptions& /*options*/, + ColumnFamilyHandle* /*column_family*/) override { return nullptr; } - virtual Iterator* NewIterator(const ReadOptions& options) override { + virtual Iterator* NewIterator(const ReadOptions& /*options*/) override { return nullptr; } diff --git a/utilities/merge_operators/max.cc b/utilities/merge_operators/max.cc index 06e233fe8..ff7b2a75a 100644 --- a/utilities/merge_operators/max.cc +++ b/utilities/merge_operators/max.cc @@ -36,9 +36,9 @@ class MaxOperator : public MergeOperator { return true; } - virtual bool PartialMerge(const Slice& key, const Slice& left_operand, + virtual bool PartialMerge(const Slice& /*key*/, const Slice& left_operand, const Slice& right_operand, std::string* new_value, - Logger* logger) const override { + Logger* /*logger*/) const override { if (left_operand.compare(right_operand) >= 0) { new_value->assign(left_operand.data(), left_operand.size()); } else { @@ -47,10 +47,10 @@ class MaxOperator : public MergeOperator { return true; } - virtual bool PartialMergeMulti(const Slice& key, + virtual bool PartialMergeMulti(const Slice& /*key*/, const std::deque& operand_list, std::string* new_value, - Logger* logger) const override { + Logger* /*logger*/) const override { Slice max; for (const auto& operand : operand_list) { if (max.compare(operand) < 0) { diff --git a/utilities/merge_operators/put.cc b/utilities/merge_operators/put.cc index 7f206ad3b..fcbf67d9b 100644 --- a/utilities/merge_operators/put.cc +++ b/utilities/merge_operators/put.cc @@ -22,11 +22,10 @@ namespace { // anonymous namespace // From the client-perspective, semantics are the same. class PutOperator : public MergeOperator { public: - virtual bool FullMerge(const Slice& key, - const Slice* existing_value, + virtual bool FullMerge(const Slice& /*key*/, const Slice* /*existing_value*/, const std::deque& operand_sequence, std::string* new_value, - Logger* logger) const override { + Logger* /*logger*/) const override { // Put basically only looks at the current/latest value assert(!operand_sequence.empty()); assert(new_value != nullptr); @@ -34,20 +33,18 @@ class PutOperator : public MergeOperator { return true; } - virtual bool PartialMerge(const Slice& key, - const Slice& left_operand, - const Slice& right_operand, - std::string* new_value, - Logger* logger) const override { + virtual bool PartialMerge(const Slice& /*key*/, const Slice& /*left_operand*/, + const Slice& right_operand, std::string* new_value, + Logger* /*logger*/) const override { new_value->assign(right_operand.data(), right_operand.size()); return true; } using MergeOperator::PartialMergeMulti; - virtual bool PartialMergeMulti(const Slice& key, + virtual bool PartialMergeMulti(const Slice& /*key*/, const std::deque& operand_list, - std::string* new_value, Logger* logger) const - override { + std::string* new_value, + Logger* /*logger*/) const override { new_value->assign(operand_list.back().data(), operand_list.back().size()); return true; } @@ -58,10 +55,10 @@ class PutOperator : public MergeOperator { }; class PutOperatorV2 : public PutOperator { - virtual bool FullMerge(const Slice& key, const Slice* existing_value, - const std::deque& operand_sequence, - std::string* new_value, - Logger* logger) const override { + virtual bool FullMerge(const Slice& /*key*/, const Slice* /*existing_value*/, + const std::deque& /*operand_sequence*/, + std::string* /*new_value*/, + Logger* /*logger*/) const override { assert(false); return false; } diff --git a/utilities/merge_operators/string_append/stringappend.cc b/utilities/merge_operators/string_append/stringappend.cc index ff19348f0..e3e755dfd 100644 --- a/utilities/merge_operators/string_append/stringappend.cc +++ b/utilities/merge_operators/string_append/stringappend.cc @@ -21,12 +21,10 @@ StringAppendOperator::StringAppendOperator(char delim_char) } // Implementation for the merge operation (concatenates two strings) -bool StringAppendOperator::Merge(const Slice& key, +bool StringAppendOperator::Merge(const Slice& /*key*/, const Slice* existing_value, - const Slice& value, - std::string* new_value, - Logger* logger) const { - + const Slice& value, std::string* new_value, + Logger* /*logger*/) const { // Clear the *new_value for writing. assert(new_value); new_value->clear(); diff --git a/utilities/merge_operators/string_append/stringappend2.cc b/utilities/merge_operators/string_append/stringappend2.cc index 2d7b7423c..6e46d80a1 100644 --- a/utilities/merge_operators/string_append/stringappend2.cc +++ b/utilities/merge_operators/string_append/stringappend2.cc @@ -68,16 +68,16 @@ bool StringAppendTESTOperator::FullMergeV2( } bool StringAppendTESTOperator::PartialMergeMulti( - const Slice& key, const std::deque& operand_list, - std::string* new_value, Logger* logger) const { + const Slice& /*key*/, const std::deque& /*operand_list*/, + std::string* /*new_value*/, Logger* /*logger*/) const { return false; } // A version of PartialMerge that actually performs "partial merging". // Use this to simulate the exact behaviour of the StringAppendOperator. bool StringAppendTESTOperator::_AssocPartialMergeMulti( - const Slice& key, const std::deque& operand_list, - std::string* new_value, Logger* logger) const { + const Slice& /*key*/, const std::deque& operand_list, + std::string* new_value, Logger* /*logger*/) const { // Clear the *new_value for writing assert(new_value); new_value->clear(); diff --git a/utilities/merge_operators/uint64add.cc b/utilities/merge_operators/uint64add.cc index d78217375..dc761e74b 100644 --- a/utilities/merge_operators/uint64add.cc +++ b/utilities/merge_operators/uint64add.cc @@ -20,10 +20,8 @@ namespace { // anonymous namespace // Implemented as an AssociativeMergeOperator for simplicity and example. class UInt64AddOperator : public AssociativeMergeOperator { public: - virtual bool Merge(const Slice& key, - const Slice* existing_value, - const Slice& value, - std::string* new_value, + virtual bool Merge(const Slice& /*key*/, const Slice* existing_value, + const Slice& value, std::string* new_value, Logger* logger) const override { uint64_t orig_value = 0; if (existing_value){ diff --git a/utilities/object_registry_test.cc b/utilities/object_registry_test.cc index 40fb387bc..fe69d9a39 100644 --- a/utilities/object_registry_test.cc +++ b/utilities/object_registry_test.cc @@ -18,13 +18,14 @@ class EnvRegistryTest : public testing::Test { int EnvRegistryTest::num_a = 0; int EnvRegistryTest::num_b = 0; -static Registrar test_reg_a("a://.*", [](const std::string& uri, - std::unique_ptr* env_guard) { - ++EnvRegistryTest::num_a; - return Env::Default(); -}); +static Registrar test_reg_a("a://.*", + [](const std::string& /*uri*/, + std::unique_ptr* /*env_guard*/) { + ++EnvRegistryTest::num_a; + return Env::Default(); + }); -static Registrar test_reg_b("b://.*", [](const std::string& uri, +static Registrar test_reg_b("b://.*", [](const std::string& /*uri*/, std::unique_ptr* env_guard) { ++EnvRegistryTest::num_b; // Env::Default() is a singleton so we can't grant ownership directly to the diff --git a/utilities/options/options_util_test.cc b/utilities/options/options_util_test.cc index 86b382cfa..39fbec52b 100644 --- a/utilities/options/options_util_test.cc +++ b/utilities/options/options_util_test.cc @@ -102,22 +102,22 @@ class DummyTableFactory : public TableFactory { virtual const char* Name() const { return "DummyTableFactory"; } - virtual Status NewTableReader(const TableReaderOptions& table_reader_options, - unique_ptr&& file, - uint64_t file_size, - unique_ptr* table_reader, - bool prefetch_index_and_filter_in_cache) const { + virtual Status NewTableReader( + const TableReaderOptions& /*table_reader_options*/, + unique_ptr&& /*file*/, uint64_t /*file_size*/, + unique_ptr* /*table_reader*/, + bool /*prefetch_index_and_filter_in_cache*/) const { return Status::NotSupported(); } virtual TableBuilder* NewTableBuilder( - const TableBuilderOptions& table_builder_options, - uint32_t column_family_id, WritableFileWriter* file) const { + const TableBuilderOptions& /*table_builder_options*/, + uint32_t /*column_family_id*/, WritableFileWriter* /*file*/) const { return nullptr; } - virtual Status SanitizeOptions(const DBOptions& db_opts, - const ColumnFamilyOptions& cf_opts) const { + virtual Status SanitizeOptions(const DBOptions& /*db_opts*/, + const ColumnFamilyOptions& /*cf_opts*/) const { return Status::NotSupported(); } @@ -129,15 +129,15 @@ class DummyMergeOperator : public MergeOperator { DummyMergeOperator() {} virtual ~DummyMergeOperator() {} - virtual bool FullMergeV2(const MergeOperationInput& merge_in, - MergeOperationOutput* merge_out) const override { + virtual bool FullMergeV2(const MergeOperationInput& /*merge_in*/, + MergeOperationOutput* /*merge_out*/) const override { return false; } - virtual bool PartialMergeMulti(const Slice& key, - const std::deque& operand_list, - std::string* new_value, - Logger* logger) const override { + virtual bool PartialMergeMulti(const Slice& /*key*/, + const std::deque& /*operand_list*/, + std::string* /*new_value*/, + Logger* /*logger*/) const override { return false; } @@ -156,10 +156,10 @@ class DummySliceTransform : public SliceTransform { virtual Slice Transform(const Slice& src) const { return src; } // determine whether this is a valid src upon the function applies - virtual bool InDomain(const Slice& src) const { return false; } + virtual bool InDomain(const Slice& /*src*/) const { return false; } // determine whether dst=Transform(src) for some src - virtual bool InRange(const Slice& dst) const { return false; } + virtual bool InRange(const Slice& /*dst*/) const { return false; } }; } // namespace diff --git a/utilities/persistent_cache/block_cache_tier_file.cc b/utilities/persistent_cache/block_cache_tier_file.cc index 85e0610b7..fac8d75e2 100644 --- a/utilities/persistent_cache/block_cache_tier_file.cc +++ b/utilities/persistent_cache/block_cache_tier_file.cc @@ -277,7 +277,7 @@ WriteableCacheFile::~WriteableCacheFile() { ClearBuffers(); } -bool WriteableCacheFile::Create(const bool enable_direct_writes, +bool WriteableCacheFile::Create(const bool /*enable_direct_writes*/, const bool enable_direct_reads) { WriteLock _(&rwlock_); diff --git a/utilities/persistent_cache/block_cache_tier_file.h b/utilities/persistent_cache/block_cache_tier_file.h index 3922136d6..ef5dbab04 100644 --- a/utilities/persistent_cache/block_cache_tier_file.h +++ b/utilities/persistent_cache/block_cache_tier_file.h @@ -103,13 +103,15 @@ class BlockCacheFile : public LRUElement { virtual ~BlockCacheFile() {} // append key/value to file and return LBA locator to user - virtual bool Append(const Slice& key, const Slice& val, LBA* const lba) { + virtual bool Append(const Slice& /*key*/, const Slice& /*val*/, + LBA* const /*lba*/) { assert(!"not implemented"); return false; } // read from the record locator (LBA) and return key, value and status - virtual bool Read(const LBA& lba, Slice* key, Slice* block, char* scratch) { + virtual bool Read(const LBA& /*lba*/, Slice* /*key*/, Slice* /*block*/, + char* /*scratch*/) { assert(!"not implemented"); return false; } diff --git a/utilities/persistent_cache/hash_table_test.cc b/utilities/persistent_cache/hash_table_test.cc index 1a6df4e61..6fe5a5965 100644 --- a/utilities/persistent_cache/hash_table_test.cc +++ b/utilities/persistent_cache/hash_table_test.cc @@ -43,7 +43,7 @@ struct HashTableTest : public testing::Test { } }; - static void ClearNode(Node node) {} + static void ClearNode(Node /*node*/) {} HashTable map_; }; @@ -73,7 +73,7 @@ struct EvictableHashTableTest : public testing::Test { } }; - static void ClearNode(Node* node) {} + static void ClearNode(Node* /*node*/) {} EvictableHashTable map_; }; diff --git a/utilities/persistent_cache/persistent_cache_test.h b/utilities/persistent_cache/persistent_cache_test.h index 77fd172ba..37e842f2e 100644 --- a/utilities/persistent_cache/persistent_cache_test.h +++ b/utilities/persistent_cache/persistent_cache_test.h @@ -233,8 +233,8 @@ class PersistentCacheDBTest : public DBTestBase { // insert data to table void Insert(const Options& options, - const BlockBasedTableOptions& table_options, const int num_iter, - std::vector* values) { + const BlockBasedTableOptions& /*table_options*/, + const int num_iter, std::vector* values) { CreateAndReopenWithCF({"pikachu"}, options); // default column family doesn't have block cache Options no_block_cache_opts; diff --git a/utilities/persistent_cache/persistent_cache_tier.cc b/utilities/persistent_cache/persistent_cache_tier.cc index 0f500e871..732762a16 100644 --- a/utilities/persistent_cache/persistent_cache_tier.cc +++ b/utilities/persistent_cache/persistent_cache_tier.cc @@ -75,12 +75,12 @@ Status PersistentCacheTier::Close() { return Status::OK(); } -bool PersistentCacheTier::Reserve(const size_t size) { +bool PersistentCacheTier::Reserve(const size_t /*size*/) { // default implementation is a pass through return true; } -bool PersistentCacheTier::Erase(const Slice& key) { +bool PersistentCacheTier::Erase(const Slice& /*key*/) { // default implementation is a pass through since not all cache tiers might // support erase return true; diff --git a/utilities/persistent_cache/volatile_tier_impl.cc b/utilities/persistent_cache/volatile_tier_impl.cc index d190a2102..177fc9169 100644 --- a/utilities/persistent_cache/volatile_tier_impl.cc +++ b/utilities/persistent_cache/volatile_tier_impl.cc @@ -106,7 +106,7 @@ Status VolatileCacheTier::Lookup(const Slice& page_key, return Status::NotFound("key not found in volatile cache"); } -bool VolatileCacheTier::Erase(const Slice& key) { +bool VolatileCacheTier::Erase(const Slice& /*key*/) { assert(!"not supported"); return true; } diff --git a/utilities/redis/redis_list_iterator.h b/utilities/redis/redis_list_iterator.h index 73907ddf8..1c4bc11e5 100644 --- a/utilities/redis/redis_list_iterator.h +++ b/utilities/redis/redis_list_iterator.h @@ -288,7 +288,7 @@ class RedisListIterator { /// Will throw an exception based on the passed-in message. /// This function is guaranteed to STOP THE CONTROL-FLOW. /// (i.e.: you do not have to call "return" after calling ThrowError) - void ThrowError(const char* const msg = NULL) { + void ThrowError(const char* const /*msg*/ = NULL) { // TODO: For now we ignore the msg parameter. This can be expanded later. throw RedisListException(); } diff --git a/utilities/simulator_cache/sim_cache.cc b/utilities/simulator_cache/sim_cache.cc index 335ac9896..6c0adf6a7 100644 --- a/utilities/simulator_cache/sim_cache.cc +++ b/utilities/simulator_cache/sim_cache.cc @@ -43,7 +43,7 @@ class SimCacheImpl : public SimCache { Handle* h = key_only_cache_->Lookup(key); if (h == nullptr) { key_only_cache_->Insert(key, nullptr, charge, - [](const Slice& k, void* v) {}, nullptr, + [](const Slice& /*k*/, void* /*v*/) {}, nullptr, priority); } else { key_only_cache_->Release(h); diff --git a/utilities/simulator_cache/sim_cache_test.cc b/utilities/simulator_cache/sim_cache_test.cc index 01b328c78..d01cdd530 100644 --- a/utilities/simulator_cache/sim_cache_test.cc +++ b/utilities/simulator_cache/sim_cache_test.cc @@ -39,7 +39,7 @@ class SimCacheTest : public DBTestBase { return options; } - void InitTable(const Options& options) { + void InitTable(const Options& /*options*/) { std::string value(kValueSize, 'a'); for (size_t i = 0; i < kNumBlocks * 2; i++) { ASSERT_OK(Put(ToString(i), value.c_str())); diff --git a/utilities/spatialdb/spatial_db.cc b/utilities/spatialdb/spatial_db.cc index 539ddd06e..a9b990ee2 100644 --- a/utilities/spatialdb/spatial_db.cc +++ b/utilities/spatialdb/spatial_db.cc @@ -704,7 +704,7 @@ DBOptions GetDBOptionsFromSpatialDBOptions(const SpatialDBOptions& options) { return db_options; } -ColumnFamilyOptions GetColumnFamilyOptions(const SpatialDBOptions& options, +ColumnFamilyOptions GetColumnFamilyOptions(const SpatialDBOptions& /*options*/, std::shared_ptr block_cache) { ColumnFamilyOptions column_family_options; column_family_options.write_buffer_size = 128 * 1024 * 1024; // 128MB diff --git a/utilities/table_properties_collectors/compact_on_deletion_collector.cc b/utilities/table_properties_collectors/compact_on_deletion_collector.cc index 304cdfff8..625318609 100644 --- a/utilities/table_properties_collectors/compact_on_deletion_collector.cc +++ b/utilities/table_properties_collectors/compact_on_deletion_collector.cc @@ -39,10 +39,11 @@ void CompactOnDeletionCollector::Reset() { // @params key the user key that is inserted into the table. // @params value the value that is inserted into the table. // @params file_size file size up to now -Status CompactOnDeletionCollector::AddUserKey( - const Slice& key, const Slice& value, - EntryType type, SequenceNumber seq, - uint64_t file_size) { +Status CompactOnDeletionCollector::AddUserKey(const Slice& /*key*/, + const Slice& /*value*/, + EntryType type, + SequenceNumber /*seq*/, + uint64_t /*file_size*/) { if (need_compaction_) { // If the output file already needs to be compacted, skip the check. return Status::OK(); @@ -77,7 +78,7 @@ Status CompactOnDeletionCollector::AddUserKey( TablePropertiesCollector* CompactOnDeletionCollectorFactory::CreateTablePropertiesCollector( - TablePropertiesCollectorFactory::Context context) { + TablePropertiesCollectorFactory::Context /*context*/) { return new CompactOnDeletionCollector( sliding_window_size_, deletion_trigger_); } diff --git a/utilities/table_properties_collectors/compact_on_deletion_collector.h b/utilities/table_properties_collectors/compact_on_deletion_collector.h index bd240e517..34cd63365 100644 --- a/utilities/table_properties_collectors/compact_on_deletion_collector.h +++ b/utilities/table_properties_collectors/compact_on_deletion_collector.h @@ -60,7 +60,7 @@ class CompactOnDeletionCollector : public TablePropertiesCollector { // for writing the properties block. // @params properties User will add their collected statistics to // `properties`. - virtual Status Finish(UserCollectedProperties* properties) override { + virtual Status Finish(UserCollectedProperties* /*properties*/) override { Reset(); return Status::OK(); } diff --git a/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc b/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc index 3c946bf41..eabc2271c 100644 --- a/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc +++ b/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc @@ -20,7 +20,7 @@ #include "util/random.h" #include "utilities/table_properties_collectors/compact_on_deletion_collector.h" -int main(int argc, char** argv) { +int main(int /*argc*/, char** /*argv*/) { const int kWindowSizes[] = {1000, 10000, 10000, 127, 128, 129, 255, 256, 257, 2, 10000}; const int kDeletionTriggers[] = diff --git a/utilities/transactions/optimistic_transaction_impl.cc b/utilities/transactions/optimistic_transaction_impl.cc index 5652189bc..bae0d609f 100644 --- a/utilities/transactions/optimistic_transaction_impl.cc +++ b/utilities/transactions/optimistic_transaction_impl.cc @@ -133,7 +133,7 @@ Status OptimisticTransactionImpl::CheckTransactionForConflicts(DB* db) { true /* cache_only */); } -Status OptimisticTransactionImpl::SetName(const TransactionName& name) { +Status OptimisticTransactionImpl::SetName(const TransactionName& /*name*/) { return Status::InvalidArgument("Optimistic transactions cannot be named."); } diff --git a/utilities/transactions/optimistic_transaction_impl.h b/utilities/transactions/optimistic_transaction_impl.h index 6baec6962..3618c6932 100644 --- a/utilities/transactions/optimistic_transaction_impl.h +++ b/utilities/transactions/optimistic_transaction_impl.h @@ -67,8 +67,8 @@ class OptimisticTransactionImpl : public TransactionBaseImpl { void Clear() override; - void UnlockGetForUpdate(ColumnFamilyHandle* column_family, - const Slice& key) override { + void UnlockGetForUpdate(ColumnFamilyHandle* /*column_family*/, + const Slice& /*key*/) override { // Nothing to unlock. } diff --git a/utilities/transactions/transaction_base.h b/utilities/transactions/transaction_base.h index 151483648..105da0ab9 100644 --- a/utilities/transactions/transaction_base.h +++ b/utilities/transactions/transaction_base.h @@ -165,7 +165,7 @@ class TransactionBaseImpl : public Transaction { WriteBatchWithIndex* GetWriteBatch() override; - virtual void SetLockTimeout(int64_t timeout) override { /* Do nothing */ + virtual void SetLockTimeout(int64_t /*timeout*/) override { /* Do nothing */ } const Snapshot* GetSnapshot() const override { diff --git a/utilities/transactions/transaction_impl.cc b/utilities/transactions/transaction_impl.cc index 408b15bcd..2e3d69633 100644 --- a/utilities/transactions/transaction_impl.cc +++ b/utilities/transactions/transaction_impl.cc @@ -367,12 +367,12 @@ Status TransactionImpl::LockBatch(WriteBatch* batch, } virtual Status PutCF(uint32_t column_family_id, const Slice& key, - const Slice& value) override { + const Slice& /*value*/) override { RecordKey(column_family_id, key); return Status::OK(); } virtual Status MergeCF(uint32_t column_family_id, const Slice& key, - const Slice& value) override { + const Slice& /*value*/) override { RecordKey(column_family_id, key); return Status::OK(); } diff --git a/utilities/transactions/transaction_impl.h b/utilities/transactions/transaction_impl.h index 01f8f4b2a..79db430e7 100644 --- a/utilities/transactions/transaction_impl.h +++ b/utilities/transactions/transaction_impl.h @@ -180,7 +180,7 @@ class TransactionCallback : public WriteCallback { public: explicit TransactionCallback(TransactionImpl* txn) : txn_(txn) {} - Status Callback(DB* db) override { + Status Callback(DB* /*db*/) override { if (txn_->IsExpired()) { return Status::Expired(); } else { diff --git a/utilities/transactions/transaction_test.cc b/utilities/transactions/transaction_test.cc index ce01388f8..7b2f8a3c7 100644 --- a/utilities/transactions/transaction_test.cc +++ b/utilities/transactions/transaction_test.cc @@ -211,7 +211,7 @@ TEST_P(TransactionTest, WaitingTxn) { ASSERT_TRUE(txn2); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", [&](void* arg) { + "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", [&](void* /*arg*/) { std::string key; uint32_t cf_id; std::vector wait = txn2->GetWaitingTxns(&cf_id, &key); @@ -433,7 +433,7 @@ TEST_P(TransactionTest, DeadlockCycleShared) { std::atomic checkpoints(0); rocksdb::SyncPoint::GetInstance()->SetCallBack( "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", - [&](void* arg) { checkpoints.fetch_add(1); }); + [&](void* /*arg*/) { checkpoints.fetch_add(1); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); // We want the leaf transactions to block and hold everyone back. @@ -501,7 +501,7 @@ TEST_P(TransactionTest, DeadlockCycle) { std::atomic checkpoints(0); rocksdb::SyncPoint::GetInstance()->SetCallBack( "TransactionLockMgr::AcquireWithTimeout:WaitingTxn", - [&](void* arg) { checkpoints.fetch_add(1); }); + [&](void* /*arg*/) { checkpoints.fetch_add(1); }); rocksdb::SyncPoint::GetInstance()->EnableProcessing(); // We want the last transaction in the chain to block and hold everyone @@ -4423,7 +4423,7 @@ TEST_P(TransactionTest, ExpiredTransactionDataRace1) { rocksdb::SyncPoint::GetInstance()->LoadDependency( {{"TransactionTest::ExpirableTransactionDataRace:1"}}); rocksdb::SyncPoint::GetInstance()->SetCallBack( - "TransactionTest::ExpirableTransactionDataRace:1", [&](void* arg) { + "TransactionTest::ExpirableTransactionDataRace:1", [&](void* /*arg*/) { WriteOptions write_options; TransactionOptions txn_options; diff --git a/utilities/ttl/ttl_test.cc b/utilities/ttl/ttl_test.cc index 586d0ce1f..7aa411b61 100644 --- a/utilities/ttl/ttl_test.cc +++ b/utilities/ttl/ttl_test.cc @@ -295,8 +295,8 @@ class TtlTest : public testing::Test { // Keeps key if it is in [kSampleSize_/3, 2*kSampleSize_/3), // Change value if it is in [2*kSampleSize_/3, kSampleSize_) // Eg. kSampleSize_=6. Drop:key0-1...Keep:key2-3...Change:key4-5... - virtual bool Filter(int level, const Slice& key, - const Slice& value, std::string* new_value, + virtual bool Filter(int /*level*/, const Slice& key, const Slice& /*value*/, + std::string* new_value, bool* value_changed) const override { assert(new_value != nullptr); @@ -345,7 +345,7 @@ class TtlTest : public testing::Test { } virtual std::unique_ptr CreateCompactionFilter( - const CompactionFilter::Context& context) override { + const CompactionFilter::Context& /*context*/) override { return std::unique_ptr( new TestFilter(kSampleSize_, kNewValue_)); } diff --git a/utilities/write_batch_with_index/write_batch_with_index_test.cc b/utilities/write_batch_with_index/write_batch_with_index_test.cc index 5b1250a64..105f7517d 100644 --- a/utilities/write_batch_with_index/write_batch_with_index_test.cc +++ b/utilities/write_batch_with_index/write_batch_with_index_test.cc @@ -63,7 +63,7 @@ struct TestHandler : public WriteBatch::Handler { seen[column_family_id].push_back(e); return Status::OK(); } - virtual void LogData(const Slice& blob) {} + virtual void LogData(const Slice& /*blob*/) {} virtual Status DeleteCF(uint32_t column_family_id, const Slice& key) { Entry e; e.key = key.ToString();