Lchangliang commented on code in PR #37293:
URL: https://github.com/apache/doris/pull/37293#discussion_r1694752702


##########
fe/fe-core/src/main/java/org/apache/doris/alter/CloudSchemaChangeJobV2.java:
##########
@@ -106,14 +110,39 @@ protected void commitShadowIndex() throws 
AlterCancelException {
     }
 
     @Override
-    protected void postProcessShadowIndex() {
+    protected void onCancel() {
         if (Config.enable_check_compatibility_mode) {
             LOG.info("skip drop shadown indexes in checking compatibility 
mode");
             return;
         }
 
         List<Long> shadowIdxList = 
indexIdMap.keySet().stream().collect(Collectors.toList());
         dropIndex(shadowIdxList);
+
+        long tryTimes = 1;
+        while (true) {
+            try {
+                Set<Table.Cell<Long, Long, Map<Long, Long>>> tableSet = 
partitionIndexTabletMap.cellSet();
+                Iterator<Cell<Long, Long, Map<Long, Long>>> it = 
tableSet.iterator();
+                while (it.hasNext()) {
+                    Table.Cell<Long, Long, Map<Long, Long>> data = it.next();
+                    Long partitionId = data.getRowKey();
+                    Long shadowIndexId = data.getColumnKey();
+                    Long originIndexId = indexIdMap.get(shadowIndexId);
+                    Map<Long, Long> shadowTabletIdToOriginTabletId = 
data.getValue();
+                    for (Map.Entry<Long, Long> entry : 
shadowTabletIdToOriginTabletId.entrySet()) {
+                        Long originTabletId = entry.getValue();
+                        ((CloudInternalCatalog) 
Env.getCurrentInternalCatalog())
+                            .removeSchemaChangeJob(dbId, tableId, 
originIndexId, partitionId, originTabletId);
+                    }
+                }
+                break;
+            } catch (Exception e) {
+                LOG.warn("tryTimes:{}, onCancel exception:", tryTimes, e);
+            }
+            sleepSeveralSeconds();
+            tryTimes++;

Review Comment:
   Ms will check the message <origin_idx, shadow_idx, origin_tablet, 
shadow_tablet>. If it's not match, skip the request.



-- 
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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to