You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/08/30 03:22:17 UTC
[GitHub] [incubator-doris] caiconghui commented on a change in pull request #6513: [Optimize][Clone] Take version count into consideration when choosing src replica for clone task
caiconghui commented on a change in pull request #6513:
URL: https://github.com/apache/incubator-doris/pull/6513#discussion_r698136571
##########
File path: fe/fe-core/src/main/java/org/apache/doris/clone/TabletSchedCtx.java
##########
@@ -499,10 +501,26 @@ public void chooseSrcReplica(Map<Long, PathSlot> backendsWorkingSlots) throws Sc
long srcPathHash = slot.takeSlot(srcReplica.getPathHash());
if (srcPathHash != -1) {
- setSrc(srcReplica);
- return;
+ if (!findSrcReplica) {
+ // version count is set by report process, so it may not be set yet and default value is -1.
+ // so we need to check it.
+ minVersionCount = srcReplica.getVersionCount() == -1 ? Long.MAX_VALUE : srcReplica.getVersionCount();
+ setSrc(srcReplica);
+ findSrcReplica = true;
+ } else {
+ long curVerCount = srcReplica.getVersionCount() == -1 ? Long.MAX_VALUE : srcReplica.getVersionCount();
+ if (curVerCount < minVersionCount) {
+ minVersionCount = curVerCount;
+ setSrc(srcReplica);
+ findSrcReplica = true;
+ }
+ }
}
}
+
+ if (findSrcReplica) {
Review comment:
```suggestion
if (!findSrcReplica) {
throw new SchedException(Status.SCHEDULE_FAILED, "unable to find source slot");
}
```
--
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-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org