From 629e3e1d776012c8eaded6764ccd9f1a7905cae3 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Thu, 3 Feb 2022 15:14:17 -0800 Subject: [PATCH] Fix spelling in public API (#9490) Summary: I feel it would be nice if we can fix this spelling error. In `SizeApproximationOptions`, the `include_memtabtles` should be `include_memtables`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9490 Test Plan: make check Reviewed By: hx235 Differential Revision: D33949862 Pulled By: riversand963 fbshipit-source-id: b2be67501b65d4aabb6b8df1bf25eb8d54cc1466 --- HISTORY.md | 1 + db/db_impl/db_impl.cc | 4 ++-- db/db_test.cc | 8 ++++---- db/db_with_timestamp_basic_test.cc | 2 +- db_stress_tool/db_stress_test_base.cc | 4 ++-- include/rocksdb/db.h | 2 +- include/rocksdb/options.h | 6 +++--- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index bd110c637..6ab23a3f1 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,7 @@ * Remove deprecated API AdvancedColumnFamilyOptions::rate_limit_delay_max_milliseconds. * Removed timestamp from WriteOptions. Accordingly, added to DB APIs Put, Delete, SingleDelete, etc. accepting an additional argument 'timestamp'. Added Put, Delete, SingleDelete, etc to WriteBatch accepting an additional argument 'timestamp'. Removed WriteBatch::AssignTimestamps(vector) API. Renamed WriteBatch::AssignTimestamp() to WriteBatch::UpdateTimestamps() with clarified comments. * Remove default implementation of Name() from FileSystemWrapper. +* Rename `SizeApproximationOptions.include_memtabtles` to `SizeApproximationOptions.include_memtables`. ### Behavior Changes * Disallow the combination of DBOptions.use_direct_io_for_flush_and_compaction == true and DBOptions.writable_file_max_buffer_size == 0. This combination can cause WritableFileWriter::Append() to loop forever, and it does not make much sense in direct IO. diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 93c70276d..fd4d8a0c9 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -3592,7 +3592,7 @@ void DBImpl::GetApproximateMemTableStats(ColumnFamilyHandle* column_family, Status DBImpl::GetApproximateSizes(const SizeApproximationOptions& options, ColumnFamilyHandle* column_family, const Range* range, int n, uint64_t* sizes) { - if (!options.include_memtabtles && !options.include_files) { + if (!options.include_memtables && !options.include_files) { return Status::InvalidArgument("Invalid options"); } @@ -3630,7 +3630,7 @@ Status DBImpl::GetApproximateSizes(const SizeApproximationOptions& options, options, v, k1.Encode(), k2.Encode(), /*start_level=*/0, /*end_level=*/-1, TableReaderCaller::kUserApproximateSize); } - if (options.include_memtabtles) { + if (options.include_memtables) { sizes[i] += sv->mem->ApproximateStats(k1.Encode(), k2.Encode()).size; sizes[i] += sv->imm->ApproximateStats(k1.Encode(), k2.Encode()).size; } diff --git a/db/db_test.cc b/db/db_test.cc index 6dfc0d245..a6e378ec5 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -1450,7 +1450,7 @@ TEST_F(DBTest, ApproximateSizesMemTable) { std::string end = Key(60); Range r(start, end); SizeApproximationOptions size_approx_options; - size_approx_options.include_memtabtles = true; + size_approx_options.include_memtables = true; size_approx_options.include_files = true; ASSERT_OK( db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size)); @@ -1551,8 +1551,8 @@ TEST_F(DBTest, ApproximateSizesMemTable) { ASSERT_GT(size_with_mt, size_without_mt); ASSERT_GT(size_without_mt, 6000); - // Check that include_memtabtles flag works as expected - size_approx_options.include_memtabtles = false; + // Check that include_memtables flag works as expected + size_approx_options.include_memtables = false; ASSERT_OK( db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size)); ASSERT_EQ(size, size_without_mt); @@ -1614,7 +1614,7 @@ TEST_F(DBTest, ApproximateSizesFilesWithErrorMargin) { const Range r(start, end); SizeApproximationOptions size_approx_options; - size_approx_options.include_memtabtles = false; + size_approx_options.include_memtables = false; size_approx_options.include_files = true; size_approx_options.files_size_error_margin = -1.0; // disabled diff --git a/db/db_with_timestamp_basic_test.cc b/db/db_with_timestamp_basic_test.cc index d5e5f65eb..6c6505277 100644 --- a/db/db_with_timestamp_basic_test.cc +++ b/db/db_with_timestamp_basic_test.cc @@ -572,7 +572,7 @@ TEST_F(DBBasicTestWithTimestamp, GetApproximateSizes) { std::string end = Key(60); Range r(start, end); SizeApproximationOptions size_approx_options; - size_approx_options.include_memtabtles = true; + size_approx_options.include_memtables = true; size_approx_options.include_files = true; ASSERT_OK( db_->GetApproximateSizes(size_approx_options, default_cf, &r, 1, &size)); diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index b1cfee9c2..95bd3a276 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -1669,8 +1669,8 @@ Status StressTest::TestApproximateSize( std::string key2_str = Key(key2); Range range{Slice(key1_str), Slice(key2_str)}; SizeApproximationOptions sao; - sao.include_memtabtles = thread->rand.OneIn(2); - if (sao.include_memtabtles) { + sao.include_memtables = thread->rand.OneIn(2); + if (sao.include_memtables) { sao.include_files = thread->rand.OneIn(2); } if (thread->rand.OneIn(2)) { diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index e792073ad..d721d70f7 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -1139,7 +1139,7 @@ class DB { uint64_t* sizes, uint8_t include_flags = INCLUDE_FILES) { SizeApproximationOptions options; - options.include_memtabtles = + options.include_memtables = (include_flags & SizeApproximationFlags::INCLUDE_MEMTABLES) != 0; options.include_files = (include_flags & SizeApproximationFlags::INCLUDE_FILES) != 0; diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 7a9cbf378..45512234c 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -1870,10 +1870,10 @@ struct ImportColumnFamilyOptions { // Options used with DB::GetApproximateSizes() struct SizeApproximationOptions { // Defines whether the returned size should include the recently written - // data in the mem-tables. If set to false, include_files must be true. - bool include_memtabtles = false; + // data in the memtables. If set to false, include_files must be true. + bool include_memtables = false; // Defines whether the returned size should include data serialized to disk. - // If set to false, include_memtabtles must be true. + // If set to false, include_memtables must be true. bool include_files = true; // When approximating the files total size that is used to store a keys range // using DB::GetApproximateSizes, allow approximation with an error margin of