This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new d75ffdf5907 [enhance](Cooldown) Use config to control whether use cooldown replica for scanning first (#37492) d75ffdf5907 is described below commit d75ffdf590774019e94822c9aca5655ef463dd8b Author: AlexYue <yj976240...@gmail.com> AuthorDate: Thu Jul 11 11:04:21 2024 +0800 [enhance](Cooldown) Use config to control whether use cooldown replica for scanning first (#37492) --- .../main/java/org/apache/doris/common/Config.java | 3 ++ .../org/apache/doris/planner/OlapScanNode.java | 43 ++++++++++++---------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index 1716760ff61..dc8f296cf3e 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -2900,6 +2900,9 @@ public class Config extends ConfigBase { "streamload route policy in cloud mode, availale options are public-private and empty string"}) public static String streamload_redirect_policy = ""; + @ConfField(mutable = true) + public static boolean enable_cooldown_replica_affinity = true; + //========================================================================== // end of cloud config //========================================================================== diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java index 64479cdc855..b30c44c1042 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java @@ -864,28 +864,31 @@ public class OlapScanNode extends ScanNode { } } - final long coolDownReplicaId = tablet.getCooldownReplicaId(); - // we prefer to query using cooldown replica to make sure the cache is fully utilized - // for example: consider there are 3BEs(A,B,C) and each has one replica for tablet X. and X - // is now under cooldown - // first time we choose BE A, and A will download data into cache while the other two's cache is empty - // second time we choose BE B, this time B will be cached, C is still empty - // third time we choose BE C, after this time all replica is cached - // but it means we will do 3 S3 IO to get the data which will bring 3 slow query - if (-1L != coolDownReplicaId) { - final Optional<Replica> replicaOptional = replicas.stream() - .filter(r -> r.getId() == coolDownReplicaId).findAny(); - replicaOptional.ifPresent( - r -> { - Backend backend = Env.getCurrentSystemInfo() - .getBackend(r.getBackendId()); - if (backend != null && backend.isAlive()) { - replicas.clear(); - replicas.add(r); + if (Config.enable_cooldown_replica_affinity) { + final long coolDownReplicaId = tablet.getCooldownReplicaId(); + // we prefer to query using cooldown replica to make sure the cache is fully utilized + // for example: consider there are 3BEs(A,B,C) and each has one replica for tablet X. and X + // is now under cooldown + // first time we choose BE A, and A will download data into cache while the other two's cache is empty + // second time we choose BE B, this time B will be cached, C is still empty + // third time we choose BE C, after this time all replica is cached + // but it means we will do 3 S3 IO to get the data which will bring 3 slow query + if (-1L != coolDownReplicaId) { + final Optional<Replica> replicaOptional = replicas.stream() + .filter(r -> r.getId() == coolDownReplicaId).findAny(); + replicaOptional.ifPresent( + r -> { + Backend backend = Env.getCurrentSystemInfo() + .getBackend(r.getBackendId()); + if (backend != null && backend.isAlive()) { + replicas.clear(); + replicas.add(r); + } } - } - ); + ); + } } + boolean tabletIsNull = true; boolean collectedStat = false; List<String> errs = Lists.newArrayList(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org