Skip to content

Commit 878e918

Browse files
committed
fix:block_cache_size
1 parent e179629 commit 878e918

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/pika_server.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,17 +1478,19 @@ void PikaServer::InitStorageOptions() {
14781478

14791479
storage_options_.table_options.pin_l0_filter_and_index_blocks_in_cache =
14801480
g_pika_conf->pin_l0_filter_and_index_blocks_in_cache();
1481-
14821481
if (storage_options_.block_cache_size == 0) {
1482+
// 禁用 block_cache
14831483
storage_options_.table_options.no_block_cache = true;
14841484
storage_options_.table_options.block_cache.reset();
14851485
} else if (storage_options_.share_block_cache) {
1486-
// 共享模式:直接复用已创建好的全局 cache(PikaServer 成员)
1486+
if (!g_pika_conf->share_block_cache()) {
1487+
assert(false && "shared_block_cache_ must be initialized before InitStorageOptions()");
1488+
}
1489+
14871490
storage_options_.table_options.no_block_cache = false;
1488-
assert(share_block_cache_ && "shared_block_cache_ must be initialized before InitStorageOptions()");
1489-
storage_options_.table_options.block_cache = shared_block_cache_;
1491+
1492+
storage_options_.table_options.block_cache = 0;
14901493
} else {
1491-
// 非共享模式:为当前 CF/实例单独创建
14921494
storage_options_.table_options.no_block_cache = false;
14931495
storage_options_.table_options.block_cache =
14941496
rocksdb::NewLRUCache(storage_options_.block_cache_size,

0 commit comments

Comments
 (0)