From 652617770132a166d7cbf4894c4b7fdec0f39b0e Mon Sep 17 00:00:00 2001 From: yyyyufeng Date: Tue, 26 Sep 2023 00:58:36 +0800 Subject: [PATCH] Add startup parameters for chunkserver Signed-off-by: yyyyufeng --- internal/configure/topology/dc_get.go | 2 ++ internal/configure/topology/dc_item.go | 16 ++++++++++++++++ internal/task/task/common/create_container.go | 4 +++- .../task/task/playground/script/entrypoint.sh | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/internal/configure/topology/dc_get.go b/internal/configure/topology/dc_get.go index cf02f07d2..f3f4cdcc8 100644 --- a/internal/configure/topology/dc_get.go +++ b/internal/configure/topology/dc_get.go @@ -139,6 +139,8 @@ func (dc *DeployConfig) GetListenDummyPort() int { return dc.getInt(CONFIG_L func (dc *DeployConfig) GetListenProxyPort() int { return dc.getInt(CONFIG_LISTEN_PROXY_PORT) } func (dc *DeployConfig) GetListenExternalIp() string { return dc.getString(CONFIG_LISTEN_EXTERNAL_IP) } func (dc *DeployConfig) GetCopysets() int { return dc.getInt(CONFIG_COPYSETS) } +func (dc *DeployConfig) GetChunkFilePoolSize() int { return dc.getInt(CONFIG_CHUNK_FILE_POOL_SIZE) } +func (dc *DeployConfig) GetChunkFormatThreadNum() int { return dc.getInt(CONFIG_CHUNK_FORMAT_THREAD_NUM) } func (dc *DeployConfig) GetS3AccessKey() string { return dc.getString(CONFIG_S3_ACCESS_KEY) } func (dc *DeployConfig) GetS3SecretKey() string { return dc.getString(CONFIG_S3_SECRET_KEY) } func (dc *DeployConfig) GetS3Address() string { return dc.getString(CONFIG_S3_ADDRESS) } diff --git a/internal/configure/topology/dc_item.go b/internal/configure/topology/dc_item.go index 46b0b21b7..5a66d3204 100644 --- a/internal/configure/topology/dc_item.go +++ b/internal/configure/topology/dc_item.go @@ -51,6 +51,8 @@ const ( DEFAULT_ENABLE_EXTERNAL_SERVER = false DEFAULT_CHUNKSERVER_COPYSETS = 100 // copysets per chunkserver DEFAULT_METASERVER_COPYSETS = 100 // copysets per metaserver + DEFAULT_CHUNK_FILE_POOL_SIZE = 10 // size (GB) per chunk file pool + DEFAULT_CHUNK_FORMAT_THREAD_NUM = 2 ) type ( @@ -230,6 +232,20 @@ var ( }, ) + CONFIG_CHUNK_FILE_POOL_SIZE = itemset.insert( + "chunkfilepool.size", + REQUIRE_POSITIVE_INTEGER, + true, + DEFAULT_CHUNK_FILE_POOL_SIZE, + ) + + CONFIG_CHUNK_FORMAT_THREAD_NUM = itemset.insert( + "chunkfilepool.format_thread_num", + REQUIRE_POSITIVE_INTEGER, + true, + DEFAULT_CHUNK_FORMAT_THREAD_NUM, + ) + CONFIG_S3_ACCESS_KEY = itemset.insert( "s3.ak", REQUIRE_STRING, diff --git a/internal/task/task/common/create_container.go b/internal/task/task/common/create_container.go index 4cbc5879c..7718c8c3c 100644 --- a/internal/task/task/common/create_container.go +++ b/internal/task/task/common/create_container.go @@ -118,7 +118,9 @@ func getArguments(dc *topology.DeployConfig) string { "enableExternalServer": dc.GetEnableExternalServer(), "chunkServerExternalIp": dc.GetListenExternalIp(), "chunkServerPort": dc.GetListenPort(), - "chunkFilePoolDir": dataDir, + "chunkFilePoolDir": fmt.Sprintf("%s/chunks", dataDir), + "chunkFilePoolSize": dc.GetChunkFilePoolSize(), + "chunkFormatThreadNum": dc.GetChunkFormatThreadNum(), "chunkFilePoolMetaPath": fmt.Sprintf("%s/chunkfilepool.meta", dataDir), "walFilePoolDir": dataDir, "walFilePoolMetaPath": fmt.Sprintf("%s/walfilepool.meta", dataDir), diff --git a/internal/task/task/playground/script/entrypoint.sh b/internal/task/task/playground/script/entrypoint.sh index f25c66765..d41e4ff8f 100644 --- a/internal/task/task/playground/script/entrypoint.sh +++ b/internal/task/task/playground/script/entrypoint.sh @@ -41,7 +41,7 @@ function start_service() { -raft_sync_segments=true \ -raft_max_install_snapshot_tasks_num=1 \ -chunkServerIp=127.0.0.1 \ - -chunkFilePoolDir="${data_dir}" \ + -chunkFilePoolDir="${data_dir}"/chunks \ -walFilePoolDir="${data_dir}" \ -raft_sync=true \ -raft_max_segment_size=8388608 \