yiguolei commented on code in PR #17101: URL: https://github.com/apache/doris/pull/17101#discussion_r1116804564
########## fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java: ########## @@ -690,11 +690,39 @@ private void addScanRangeLocations(Partition partition, throw new UserException("Failed to get scan range, no queryable replica found in tablet: " + tabletId); } - Collections.shuffle(replicas); + int useFixReplica = -1; + if (ConnectContext.get() != null) { + useFixReplica = ConnectContext.get().getSessionVariable().useFixReplica; + } + if (useFixReplica == -1) { + Collections.shuffle(replicas); + } else { + LOG.debug("use fix replica, value: {}, replica num: {}", useFixReplica, replicas.size()); + // sort by replica id Review Comment: the logic is too complicated!!! if (useFixReplica == -1) { Collections.shuffle(replicas); } else { LOG.debug("use fix replica, value: {}, replica num: {}", useFixReplica, replicas.size()); // sort by replica id replicas.sort(Replica.ID_COMPARATOR); Replica replica = replicas.get(useFixReplica >= replicas.size() : replicas.size() - 1 ? useFixReplica); replicas.clear(); replicas.add(replica); } Then other code does not need change. -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org