Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Skip rebalancing scan ranges for hdfs backend selector by default when using datacache. #51996

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ private ComputeNode reBalanceScanRangeForComputeNode(List<ComputeNode> backends,
return null;
}

boolean forceReBalance = ConnectContext.get() != null ? ConnectContext.get().getSessionVariable().
getHdfsBackendSelectorForceRebalance() : false;
boolean enableDataCache = ConnectContext.get() != null ? ConnectContext.get().getSessionVariable().
isEnableScanDataCache() : false;
// If force-rebalancing is not specified and cache is used, skip the rebalancing directly.
if (!forceReBalance && enableDataCache) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need add user guide that only when cache enabled, forceReBalance does it's work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need add user guide that only when cache enabled, forceReBalance does it's work.

Ok,set it invisible currently, and if it is necessary to expose it to users, we will add relevant documentation to explain it

return backends.get(0);
}

ComputeNode node = null;
long addedScans = scanRangeLocations.scan_range.hdfs_scan_range.length;
for (ComputeNode backend : backends) {
Expand Down Expand Up @@ -349,4 +358,4 @@ private void recordScanRangeStatistic() {
Tracers.count(Tracers.Module.EXTERNAL, key, value);
}
}
}
}
13 changes: 13 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/qe/SessionVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ public static MaterializedViewRewriteMode parse(String str) {

public static final String HDFS_BACKEND_SELECTOR_HASH_ALGORITHM = "hdfs_backend_selector_hash_algorithm";

public static final String HDFS_BACKEND_SELECTOR_FORCE_REBALANCE = "hdfs_backend_selector_force_rebalance";

public static final String CONSISTENT_HASH_VIRTUAL_NUMBER = "consistent_hash_virtual_number";

public static final String ENABLE_COLLECT_TABLE_LEVEL_SCAN_STATS = "enable_collect_table_level_scan_stats";
Expand Down Expand Up @@ -1545,6 +1547,9 @@ public static MaterializedViewRewriteMode parse(String str) {
@VariableMgr.VarAttr(name = HDFS_BACKEND_SELECTOR_HASH_ALGORITHM, flag = VariableMgr.INVISIBLE)
private String hdfsBackendSelectorHashAlgorithm = "consistent";

@VariableMgr.VarAttr(name = HDFS_BACKEND_SELECTOR_FORCE_REBALANCE, flag = VariableMgr.INVISIBLE)
private boolean hdfsBackendSelectorForceRebalance = false;

@VariableMgr.VarAttr(name = CONSISTENT_HASH_VIRTUAL_NUMBER, flag = VariableMgr.INVISIBLE)
private int consistentHashVirtualNodeNum = 256;

Expand Down Expand Up @@ -2723,6 +2728,14 @@ public void setHdfsBackendSelectorHashAlgorithm(String hdfsBackendSelectorHashAl
this.hdfsBackendSelectorHashAlgorithm = hdfsBackendSelectorHashAlgorithm;
}

public boolean getHdfsBackendSelectorForceRebalance() {
return hdfsBackendSelectorForceRebalance;
}

public void setHdfsBackendSelectorForceRebalance(boolean hdfsBackendSelectorForceRebalance) {
this.hdfsBackendSelectorForceRebalance = hdfsBackendSelectorForceRebalance;
}

public int getConsistentHashVirtualNodeNum() {
return consistentHashVirtualNodeNum;
}
Expand Down
Loading