This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 8e6ee5a685e Pick "[enhance](Cooldown) Use config to control whether
use cooldown replica for scanning first" (#38323)
8e6ee5a685e is described below
commit 8e6ee5a685e123c04c2ac0b5ea37707feba6cc71
Author: AlexYue <[email protected]>
AuthorDate: Wed Jul 31 11:45:02 2024 +0800
Pick "[enhance](Cooldown) Use config to control whether use cooldown
replica for scanning first" (#38323)
## Proposed changes
<!--Describe your changes.-->
same as master #37492
---
.../main/java/org/apache/doris/common/Config.java | 3 ++
.../org/apache/doris/planner/OlapScanNode.java | 42 +++++++++++-----------
2 files changed, 25 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 57b6cf0e2eb..eef95904f6a 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
@@ -2418,4 +2418,7 @@ public class Config extends ConfigBase {
@ConfField(mutable = true)
public static boolean fix_tablet_partition_id_eq_0 = false;
+
+ @ConfField(mutable = true)
+ public static boolean enable_cooldown_replica_affinity = true;
}
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 687c27bf1dd..0509eabeb65 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
@@ -795,27 +795,29 @@ public class OlapScanNode extends ScanNode {
replicas.clear();
replicas.add(replica);
}
- 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;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]