Skip to content

Commit

Permalink
[Enhancement] Add config to turn on balancing tablets between workers…
Browse files Browse the repository at this point in the history
… in shared-data mode (#50843)

Signed-off-by: Kevin Xiaohua Cai <[email protected]>
  • Loading branch information
kevincai authored Sep 10, 2024
1 parent 34bd0d3 commit 5dbaaf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/common/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,16 @@ public class Config extends ConfigBase {
@ConfField(mutable = true, comment = "the max number of threads for lake table delete txnLog when enable batch publish")
public static int lake_publish_delete_txnlog_max_threads = 16;

@ConfField(mutable = true, comment =
"Consider balancing between workers during tablet migration in shared data mode. Default: false")
public static boolean lake_enable_balance_tablets_between_workers = false;

@ConfField(mutable = true, comment =
"Threshold of considering the balancing between workers in shared-data mode, The imbalance factor is " +
"calculated as f = (MAX(tablets) - MIN(tablets)) / AVERAGE(tablets), " +
"if f > lake_balance_tablets_threshold, balancing will be triggered. Default: 0.15")
public static double lake_balance_tablets_threshold = 0.15;

/**
* Default lake compaction txn timeout
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,17 @@ public void initialize(BDBEnvironment environment, String baseImageDir) throws I
com.staros.util.Config.WORKER_HEARTBEAT_INTERVAL_SEC = Config.heartbeat_timeout_second;
com.staros.util.Config.WORKER_HEARTBEAT_RETRY_COUNT = Config.heartbeat_retry_times;
com.staros.util.Config.GRPC_RPC_TIME_OUT_SEC = Config.starmgr_grpc_timeout_seconds;
com.staros.util.Config.ENABLE_BALANCE_SHARD_NUM_BETWEEN_WORKERS = Config.lake_enable_balance_tablets_between_workers;
com.staros.util.Config.BALANCE_WORKER_SHARDS_THRESHOLD_IN_PERCENT = Config.lake_balance_tablets_threshold;

// sync the mutable configVar to StarMgr in case any changes
GlobalStateMgr.getCurrentState().getConfigRefreshDaemon().registerListener(() -> {
com.staros.util.Config.DISABLE_BACKGROUND_SHARD_SCHEDULE_CHECK = Config.tablet_sched_disable_balance;
com.staros.util.Config.WORKER_HEARTBEAT_INTERVAL_SEC = Config.heartbeat_timeout_second;
com.staros.util.Config.WORKER_HEARTBEAT_RETRY_COUNT = Config.heartbeat_retry_times;
com.staros.util.Config.GRPC_RPC_TIME_OUT_SEC = Config.starmgr_grpc_timeout_seconds;
com.staros.util.Config.ENABLE_BALANCE_SHARD_NUM_BETWEEN_WORKERS = Config.lake_enable_balance_tablets_between_workers;
com.staros.util.Config.BALANCE_WORKER_SHARDS_THRESHOLD_IN_PERCENT = Config.lake_balance_tablets_threshold;
});
// set the following config, in order to provide a customized worker group definition
// com.staros.util.Config.RESOURCE_MANAGER_WORKER_GROUP_SPEC_RESOURCE_FILE = "";
Expand Down

0 comments on commit 5dbaaf5

Please sign in to comment.