Skip to content

Commit 9db7e32

Browse files
committed
add
1 parent 447b477 commit 9db7e32

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

be/src/olap/storage_engine.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,13 @@ Status StorageEngine::_open() {
298298
auto dirs = get_stores();
299299
RETURN_IF_ERROR(load_data_dirs(dirs));
300300

301-
_disk_num = cast_set<int>(dirs.size());
301+
if (config::is_cloud_mode()) {
302+
// (Refrian) In cloud mode, the number of flush threads currently depends on the file cache setting.
303+
// A more precise adaptive algorithm is needed.
304+
_disk_num = cast_set<int>(io::FileCacheFactory::instance()->get_cache_instance_size());
305+
} else {
306+
_disk_num = cast_set<int>(dirs.size());
307+
}
302308
_memtable_flush_executor = std::make_unique<MemTableFlushExecutor>();
303309
_memtable_flush_executor->init(_disk_num);
304310

be/src/olap/storage_engine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ class BaseStorageEngine {
177177

178178
int64_t _memory_limitation_bytes_for_schema_change;
179179

180+
// The value depends on the number of `storage_root_path` parameters in non-cloud mode,
181+
// or the number of `file_cache_path` parameters in cloud mode.
180182
int _disk_num {-1};
181183

182184
std::shared_ptr<StreamLoadRecorder> _stream_load_recorder;

0 commit comments

Comments
 (0)