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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 082b7cce41 [improvement](storage) let the 
`storage_page_cache_shard_size` conf be rounded up to a power of two (#19639)
082b7cce41 is described below

commit 082b7cce41bc1c40a56c132f6c982096f44ebafb
Author: yongkang.zhong <[email protected]>
AuthorDate: Wed May 17 22:54:58 2023 +0800

    [improvement](storage) let the `storage_page_cache_shard_size` conf be 
rounded up to a power of two (#19639)
---
 be/src/runtime/exec_env_init.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 2b9b6f244b..81e050ba02 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -230,6 +230,14 @@ Status ExecEnv::_init_mem_env() {
     }
     int32_t index_percentage = config::index_page_cache_percentage;
     uint32_t num_shards = config::storage_page_cache_shard_size;
+    if ((num_shards & (num_shards - 1)) != 0) {
+        int old_num_shards = num_shards;
+        num_shards = BitUtil::RoundUpToPowerOfTwo(num_shards);
+        LOG(WARNING) << "num_shards should be power of two, but got " << 
old_num_shards
+                     << ". Rounded up to " << num_shards
+                     << ". Please modify the 'storage_page_cache_shard_size' 
parameter in your "
+                        "conf file to be a power of two for better 
performance.";
+    }
     StoragePageCache::create_global_cache(storage_cache_limit, 
index_percentage, num_shards);
     LOG(INFO) << "Storage page cache memory limit: "
               << PrettyPrinter::print(storage_cache_limit, TUnit::BYTES)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to