diff --git a/HISTORY.md b/HISTORY.md index f63bfb97b..17ad5d95a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,8 @@ * statistics.stats_level_ becomes atomic. It is preferred to use statistics.set_stats_level() and statistics.get_stats_level() to access it. * Introduce a new IOError subcode, PathNotFound, to indicate trying to open a nonexistent file or directory for read. * Add initial support for multiple db instances sharing the same data in single-writer, multi-reader mode. +* Removed some "using std::xxx" from public headers. + ### Bug Fixes * Fix JEMALLOC_CXX_THROW macro missing from older Jemalloc versions, causing build failures on some platforms. * Fix SstFileReader not able to open file ingested with write_glbal_seqno=true. diff --git a/cache/cache_test.cc b/cache/cache_test.cc index 52513932f..f9db65f31 100644 --- a/cache/cache_test.cc +++ b/cache/cache_test.cc @@ -98,7 +98,7 @@ class CacheTest : public testing::TestWithParam { return nullptr; } - int Lookup(shared_ptr cache, int key) { + int Lookup(std::shared_ptr cache, int key) { Cache::Handle* handle = cache->Lookup(EncodeKey(key)); const int r = (handle == nullptr) ? -1 : DecodeValue(cache->Value(handle)); if (handle != nullptr) { @@ -107,16 +107,16 @@ class CacheTest : public testing::TestWithParam { return r; } - void Insert(shared_ptr cache, int key, int value, int charge = 1) { + void Insert(std::shared_ptr cache, int key, int value, + int charge = 1) { cache->Insert(EncodeKey(key), EncodeValue(value), charge, &CacheTest::Deleter); } - void Erase(shared_ptr cache, int key) { + void Erase(std::shared_ptr cache, int key) { cache->Erase(EncodeKey(key)); } - int Lookup(int key) { return Lookup(cache_, key); } @@ -687,7 +687,8 @@ TEST_P(CacheTest, DefaultShardBits) { } #ifdef SUPPORT_CLOCK_CACHE -shared_ptr (*new_clock_cache_func)(size_t, int, bool) = NewClockCache; +std::shared_ptr (*new_clock_cache_func)(size_t, int, + bool) = NewClockCache; INSTANTIATE_TEST_CASE_P(CacheTestInstance, CacheTest, testing::Values(kLRU, kClock)); #else diff --git a/db/db_impl_compaction_flush.cc b/db/db_impl_compaction_flush.cc index 358a5d9fb..03d9aa4ae 100644 --- a/db/db_impl_compaction_flush.cc +++ b/db/db_impl_compaction_flush.cc @@ -2836,7 +2836,7 @@ void DBImpl::BuildCompactionJobInfo( fmd->fd.GetNumber(), fmd->fd.GetPathId()); compaction_job_info->input_files.push_back(fn); if (compaction_job_info->table_properties.count(fn) == 0) { - shared_ptr tp; + std::shared_ptr tp; auto s = current->GetTableProperties(&tp, fmd, &fn); if (s.ok()) { compaction_job_info->table_properties[fn] = tp; diff --git a/db/log_reader.h b/db/log_reader.h index 63777d6da..058382b8a 100644 --- a/db/log_reader.h +++ b/db/log_reader.h @@ -20,7 +20,6 @@ namespace rocksdb { class SequentialFileReader; class Logger; -using std::unique_ptr; namespace log { diff --git a/db/log_writer.cc b/db/log_writer.cc index c31adbec5..bc99931b9 100644 --- a/db/log_writer.cc +++ b/db/log_writer.cc @@ -18,7 +18,7 @@ namespace rocksdb { namespace log { -Writer::Writer(unique_ptr&& dest, uint64_t log_number, +Writer::Writer(std::unique_ptr&& dest, uint64_t log_number, bool recycle_log_files, bool manual_flush) : dest_(std::move(dest)), block_offset_(0), diff --git a/db/log_writer.h b/db/log_writer.h index dea503387..3638beb7e 100644 --- a/db/log_writer.h +++ b/db/log_writer.h @@ -20,8 +20,6 @@ namespace rocksdb { class WritableFileWriter; -using std::unique_ptr; - namespace log { /** @@ -72,8 +70,9 @@ class Writer { // Create a writer that will append data to "*dest". // "*dest" must be initially empty. // "*dest" must remain live while this Writer is in use. - explicit Writer(unique_ptr&& dest, uint64_t log_number, - bool recycle_log_files, bool manual_flush = false); + explicit Writer(std::unique_ptr&& dest, + uint64_t log_number, bool recycle_log_files, + bool manual_flush = false); ~Writer(); Status AddRecord(const Slice& slice); diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index b9e727479..9e5b5cec7 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -58,8 +58,6 @@ class TraceWriter; class CompactionJobInfo; #endif -using std::unique_ptr; - extern const std::string kDefaultColumnFamilyName; struct ColumnFamilyDescriptor { std::string name; diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index 814903311..dd7c0bf1a 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -50,9 +50,6 @@ class RateLimiter; class ThreadStatusUpdater; struct ThreadStatus; -using std::unique_ptr; -using std::shared_ptr; - const size_t kDefaultPageSize = 4 * 1024; // Options while opening a file to read/write diff --git a/include/rocksdb/table.h b/include/rocksdb/table.h index c873271b5..8cd72bdea 100644 --- a/include/rocksdb/table.h +++ b/include/rocksdb/table.h @@ -41,8 +41,6 @@ class WritableFileWriter; struct EnvOptions; struct Options; -using std::unique_ptr; - enum ChecksumType : char { kNoChecksum = 0x0, kCRC32c = 0x1, diff --git a/table/adaptive_table_factory.h b/table/adaptive_table_factory.h index 2a82dbfa9..5534c8b37 100644 --- a/table/adaptive_table_factory.h +++ b/table/adaptive_table_factory.h @@ -14,7 +14,6 @@ namespace rocksdb { struct EnvOptions; -using std::unique_ptr; class Status; class RandomAccessFile; class WritableFile; diff --git a/table/block_based_table_factory.h b/table/block_based_table_factory.h index cde6f6535..100bb0bc4 100644 --- a/table/block_based_table_factory.h +++ b/table/block_based_table_factory.h @@ -23,7 +23,6 @@ namespace rocksdb { struct EnvOptions; -using std::unique_ptr; class BlockBasedTableBuilder; // A class used to track actual bytes written from the tail in the recent SST diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index b7953fbd2..ac57eec21 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -58,7 +58,6 @@ namespace rocksdb { extern const uint64_t kBlockBasedTableMagicNumber; extern const std::string kHashIndexPrefixesBlock; extern const std::string kHashIndexPrefixesMetadataBlock; -using std::unique_ptr; typedef BlockBasedTable::IndexReader IndexReader; diff --git a/table/block_based_table_reader.h b/table/block_based_table_reader.h index 8ccb42bbb..b0dbb4e40 100644 --- a/table/block_based_table_reader.h +++ b/table/block_based_table_reader.h @@ -53,8 +53,6 @@ struct EnvOptions; struct ReadOptions; class GetContext; -using std::unique_ptr; - typedef std::vector> KVPairBlock; // A Table is a sorted map from strings to strings. Tables are diff --git a/table/plain_table_factory.h b/table/plain_table_factory.h index 157e3acda..990df482e 100644 --- a/table/plain_table_factory.h +++ b/table/plain_table_factory.h @@ -17,7 +17,6 @@ namespace rocksdb { struct EnvOptions; -using std::unique_ptr; class Status; class RandomAccessFile; class WritableFile; diff --git a/table/plain_table_reader.cc b/table/plain_table_reader.cc index 5085edf1e..b0c6dcf07 100644 --- a/table/plain_table_reader.cc +++ b/table/plain_table_reader.cc @@ -206,7 +206,8 @@ InternalIterator* PlainTableReader::NewIterator( } Status PlainTableReader::PopulateIndexRecordList( - PlainTableIndexBuilder* index_builder, vector* prefix_hashes) { + PlainTableIndexBuilder* index_builder, + std::vector* prefix_hashes) { Slice prev_key_prefix_slice; std::string prev_key_prefix_buf; uint32_t pos = data_start_offset_; @@ -256,10 +257,9 @@ Status PlainTableReader::PopulateIndexRecordList( return s; } -void PlainTableReader::AllocateAndFillBloom(int bloom_bits_per_key, - int num_prefixes, - size_t huge_page_tlb_size, - vector* prefix_hashes) { +void PlainTableReader::AllocateAndFillBloom( + int bloom_bits_per_key, int num_prefixes, size_t huge_page_tlb_size, + std::vector* prefix_hashes) { if (!IsTotalOrderMode()) { uint32_t bloom_total_bits = num_prefixes * bloom_bits_per_key; if (bloom_total_bits > 0) { @@ -271,7 +271,7 @@ void PlainTableReader::AllocateAndFillBloom(int bloom_bits_per_key, } } -void PlainTableReader::FillBloom(vector* prefix_hashes) { +void PlainTableReader::FillBloom(std::vector* prefix_hashes) { assert(bloom_.IsInitialized()); for (auto prefix_hash : *prefix_hashes) { bloom_.AddHash(prefix_hash); diff --git a/table/plain_table_reader.h b/table/plain_table_reader.h index 459418dc7..022886b72 100644 --- a/table/plain_table_reader.h +++ b/table/plain_table_reader.h @@ -39,9 +39,6 @@ class InternalKeyComparator; class PlainTableKeyDecoder; class GetContext; -using std::unique_ptr; -using std::unordered_map; -using std::vector; extern const uint32_t kPlainTableVariableLength; struct PlainTableReaderFileInfo { @@ -50,7 +47,7 @@ struct PlainTableReaderFileInfo { uint32_t data_end_offset; std::unique_ptr file; - PlainTableReaderFileInfo(unique_ptr&& _file, + PlainTableReaderFileInfo(std::unique_ptr&& _file, const EnvOptions& storage_options, uint32_t _data_size_offset) : is_mmap_mode(storage_options.use_mmap_reads), @@ -202,14 +199,14 @@ class PlainTableReader: public TableReader { // If bloom_ is not null, all the keys' full-key hash will be added to the // bloom filter. Status PopulateIndexRecordList(PlainTableIndexBuilder* index_builder, - vector* prefix_hashes); + std::vector* prefix_hashes); // Internal helper function to allocate memory for bloom filter and fill it void AllocateAndFillBloom(int bloom_bits_per_key, int num_prefixes, size_t huge_page_tlb_size, - vector* prefix_hashes); + std::vector* prefix_hashes); - void FillBloom(vector* prefix_hashes); + void FillBloom(std::vector* prefix_hashes); // Read the key and value at `offset` to parameters for keys, the and // `seekable`. diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index ac8e47459..0cb4e0eb2 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1222,7 +1222,7 @@ class ReportFileOpEnv : public EnvWrapper { ReportFileOpCounters* counters_; public: - CountingFile(unique_ptr&& target, + CountingFile(std::unique_ptr&& target, ReportFileOpCounters* counters) : target_(std::move(target)), counters_(counters) {} @@ -1254,7 +1254,7 @@ class ReportFileOpEnv : public EnvWrapper { ReportFileOpCounters* counters_; public: - CountingFile(unique_ptr&& target, + CountingFile(std::unique_ptr&& target, ReportFileOpCounters* counters) : target_(std::move(target)), counters_(counters) {} Status Read(uint64_t offset, size_t n, Slice* result, @@ -1283,7 +1283,7 @@ class ReportFileOpEnv : public EnvWrapper { ReportFileOpCounters* counters_; public: - CountingFile(unique_ptr&& target, + CountingFile(std::unique_ptr&& target, ReportFileOpCounters* counters) : target_(std::move(target)), counters_(counters) {} diff --git a/utilities/backupable/backupable_db_test.cc b/utilities/backupable/backupable_db_test.cc index 3adb66c7b..1548203dd 100644 --- a/utilities/backupable/backupable_db_test.cc +++ b/utilities/backupable/backupable_db_test.cc @@ -35,8 +35,6 @@ namespace rocksdb { namespace { -using std::unique_ptr; - class DummyDB : public StackableDB { public: /* implicit */ @@ -206,7 +204,7 @@ class TestEnv : public EnvWrapper { } Status NewRandomAccessFile(const std::string& fname, - unique_ptr* result, + std::unique_ptr* result, const EnvOptions& options) override { MutexLock l(&mutex_); Status s = EnvWrapper::NewRandomAccessFile(fname, result, options); diff --git a/utilities/blob_db/blob_log_reader.cc b/utilities/blob_db/blob_log_reader.cc index 0f098f2d4..8ffcc2fa1 100644 --- a/utilities/blob_db/blob_log_reader.cc +++ b/utilities/blob_db/blob_log_reader.cc @@ -16,7 +16,7 @@ namespace rocksdb { namespace blob_db { -Reader::Reader(unique_ptr&& file_reader, Env* env, +Reader::Reader(std::unique_ptr&& file_reader, Env* env, Statistics* statistics) : file_(std::move(file_reader)), env_(env), diff --git a/utilities/blob_db/blob_log_writer.cc b/utilities/blob_db/blob_log_writer.cc index 9b0ca74f7..51578c5c3 100644 --- a/utilities/blob_db/blob_log_writer.cc +++ b/utilities/blob_db/blob_log_writer.cc @@ -19,7 +19,7 @@ namespace rocksdb { namespace blob_db { -Writer::Writer(unique_ptr&& dest, Env* env, +Writer::Writer(std::unique_ptr&& dest, Env* env, Statistics* statistics, uint64_t log_number, uint64_t bpsync, bool use_fs, uint64_t boffset) : dest_(std::move(dest)),