You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by ti...@apache.org on 2022/05/31 03:29:40 UTC

[incubator-kvrocks] branch unstable updated: Update blob_file_size unit MiB to bytes. (#611)

This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new a4e52ed  Update blob_file_size unit MiB to bytes. (#611)
a4e52ed is described below

commit a4e52edc5e802f7f0ab5a8a1933fa711f5e88f1c
Author: bitstring <i...@eventloop.live>
AuthorDate: Tue May 31 11:29:35 2022 +0800

    Update blob_file_size unit MiB to bytes. (#611)
---
 kvrocks.conf         | 4 ++--
 src/config.cc        | 4 ++--
 src/storage.cc       | 2 +-
 tests/config_test.cc | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kvrocks.conf b/kvrocks.conf
index 94fd4c1..e734c91 100644
--- a/kvrocks.conf
+++ b/kvrocks.conf
@@ -601,8 +601,8 @@ rocksdb.min_blob_size 4096
 # The size limit for blob files. When writing blob files, a new file is
 # opened once this limit is reached.
 #
-# Default: 256 MiB
-rocksdb.blob_file_size 256
+# Default: 268435456 bytes
+rocksdb.blob_file_size 268435456
 
 # Enables garbage collection of blobs. Valid blobs residing in blob files
 # older than a cutoff get relocated to new files as they are encountered
diff --git a/src/config.cc b/src/config.cc
index 8f40607..6b7260f 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -169,7 +169,7 @@ Config::Config() {
        false, new IntField(&RocksDB.level0_file_num_compaction_trigger, 4, 1, 1024)},
       {"rocksdb.enable_blob_files", false, new YesNoField(&RocksDB.enable_blob_files, false)},
       {"rocksdb.min_blob_size", false, new IntField(&RocksDB.min_blob_size, 4096, 0, INT_MAX)},
-      {"rocksdb.blob_file_size", false, new IntField(&RocksDB.blob_file_size, 256, 0, INT_MAX)},
+      {"rocksdb.blob_file_size", false, new IntField(&RocksDB.blob_file_size, 268435456, 0, INT_MAX)},
       {"rocksdb.enable_blob_garbage_collection", false, new YesNoField(&RocksDB.enable_blob_garbage_collection, true)},
       {"rocksdb.blob_garbage_collection_age_cutoff",
        false, new IntField(&RocksDB.blob_garbage_collection_age_cutoff, 25, 0, 100)},
@@ -417,7 +417,7 @@ void Config::initFieldCallback() {
           return Status(Status::NotOK, errNotEnableBlobDB);
         }
         return srv->storage_->SetColumnFamilyOption(trimRocksDBPrefix(k),
-                                                    std::to_string(RocksDB.blob_file_size * MiB));
+                                                    std::to_string(RocksDB.blob_file_size));
       }},
       {"rocksdb.enable_blob_garbage_collection", [this](Server* srv, const std::string &k,
                                                         const std::string& v)->Status {
diff --git a/src/storage.cc b/src/storage.cc
index 964d7a8..9f942db 100644
--- a/src/storage.cc
+++ b/src/storage.cc
@@ -108,7 +108,7 @@ void Storage::InitTableOptions(rocksdb::BlockBasedTableOptions *table_options) {
 void Storage::SetBlobDB(rocksdb::ColumnFamilyOptions *cf_options) {
   cf_options->enable_blob_files = config_->RocksDB.enable_blob_files;
   cf_options->min_blob_size = config_->RocksDB.min_blob_size;
-  cf_options->blob_file_size = config_->RocksDB.blob_file_size * MiB;
+  cf_options->blob_file_size = config_->RocksDB.blob_file_size;
   cf_options->blob_compression_type = static_cast<rocksdb::CompressionType>(config_->RocksDB.compression);
   cf_options->enable_blob_garbage_collection = config_->RocksDB.enable_blob_garbage_collection;
   // Use 100.0 to force converting blob_garbage_collection_age_cutoff to double
diff --git a/tests/config_test.cc b/tests/config_test.cc
index 8f85a40..fd8afd0 100644
--- a/tests/config_test.cc
+++ b/tests/config_test.cc
@@ -71,7 +71,7 @@ TEST(Config, GetAndSet) {
       {"rocksdb.level0_stop_writes_trigger", "100"},
       {"rocksdb.enable_blob_files", "no"},
       {"rocksdb.min_blob_size", "4096"},
-      {"rocksdb.blob_file_size", "256"},
+      {"rocksdb.blob_file_size", "268435456"},
       {"rocksdb.enable_blob_garbage_collection", "yes"},
       {"rocksdb.blob_garbage_collection_age_cutoff", "25"},
       {"rocksdb.max_bytes_for_level_base", "256"},