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: [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]