github-actions[bot] commented on code in PR #69764:
URL: https://github.com/apache/doris/pull/69764#discussion_r4420447725


##########
fe/fe-core/src/main/java/org/apache/doris/clone/MovesCacheMap.java:
##########
@@ -110,14 +110,17 @@ public void invalidateTablet(TabletSchedCtx tabletCtx) {
         }
     }
 
-    // For given tablet ctx, find it in cacheMap
+    // Repair tasks do not have a tag, so search all tags for the tablet's 
move.
     public Pair<PartitionRebalancer.TabletMove, Long> 
getTabletMove(TabletSchedCtx tabletCtx) {
         for (Map<TStorageMedium, MovesCache> mediumMap : cacheMap.values()) {
             MovesCache cache = mediumMap.get(tabletCtx.getStorageMedium());
             if (cache == null) {
                 continue;
             }
-            return cache.get().getIfPresent(tabletCtx.getTabletId());
+            Pair<PartitionRebalancer.TabletMove, Long> move = 
cache.get().getIfPresent(tabletCtx.getTabletId());
+            if (move != null) {

Review Comment:
   [P1] Avoid returning an unscheduled duplicate move from the first location 
cache. `selectAlternativeTablets()` inserts each tag's move before 
`addTablet()` deduplicates it, and `selectTabletsForBeBalance()` can break at 
its quota, leaving another cache entry with `pair.second == -1`. A tagless 
repair then reaches this loop and returns whichever medium cache a `HashMap` 
visits first; that pending entry makes `getToDeleteReplicaId()` return `-1`, so 
the completed move's source replica is never deleted. `checkMovesCompleted()` 
skips `second == -1`, and each lookup refreshes the pending entry's TTL, so the 
tablet can remain over-replicated and block balancing. Resolve all matching 
entries for the current move/generation (or enforce global tablet uniqueness) 
and ignore pending duplicates when a scheduled move exists.



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

Reply via email to