github-actions[bot] commented on code in PR #65173:
URL: https://github.com/apache/doris/pull/65173#discussion_r3519076721
##########
fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/LoadAction.java:
##########
@@ -451,7 +465,13 @@ private TNetworkAddress selectCloudRedirectBackend(String
clusterName, HttpServl
backend = preSelectedBackend != null ? preSelectedBackend
: selectBackendForGroupCommit(clusterName, req, tableId);
} else {
- backend = StreamLoadHandler.selectBackend(clusterName);
+ backend =
ResourceGroupAffinityPolicyFactory.get().chooseLoadBackendWithAffinity(
Review Comment:
In the default public policy this now picks the first load-available backend
from `getBackendsByClusterName()`. That cluster list is kept sorted by backend
id, so with no downstream affinity implementation installed, cloud non-group
stream load redirects all concentrate on the lowest-id available BE. Before
this change the same path used `StreamLoadHandler.selectBackend()`, which
filtered load-available BEs and chose a `SecureRandom` index;
`MysqlLoadManager` has the same new cloud path. Please preserve the old no-op
distribution, for example by randomizing/shuffling the cloud candidates before
the helper's head-pick when there is no effective load affinity, or by making
the default helper choose randomly for no-op load affinity.
##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java:
##########
@@ -601,6 +606,13 @@ private void addScanRangeLocations(Partition partition,
} else if (replicas.size() > 1) {
Collections.shuffle(replicas);
}
+ if (!skipMissingVersion) {
+ if (affinityDecision == null) {
+ affinityDecision =
context.getQueryResourceGroupAffinityDecision();
+ }
+ replicas =
ResourceGroupAffinityPolicyFactory.get().applyQueryAffinity(affinityDecision,
replicas,
Review Comment:
`applyQueryAffinity()` does not promise that the returned list is mutable,
but this method now assigns `replicas` to that return value and the
cooldown-replica branch below still mutates it with `replicas.clear()` /
`replicas.add(...)` when the cooldown replica is alive. A downstream policy
that returns an immutable reordered list, for example
`ImmutableList.sortedCopyOf(...)`, can make normal scan planning fail with
`UnsupportedOperationException`. Please copy the SPI result into a mutable list
before the later selection logic, or make the cooldown selection non-mutating
and document the intended SPI contract.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]