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


##########
fe/fe-core/src/main/java/org/apache/doris/cloud/datasource/CloudInternalCatalog.java:
##########
@@ -1033,6 +1033,11 @@ public void removeSchemaChangeJob(long jobId, long dbId, 
long tableId, long inde
         }
     }
 
+    @Override
+    public void onCreateTableConflict(long dbId, OlapTable table) throws 
DdlException {
+        dropMaterializedIndex(dbId, table.getId(), table.getIndexIdList(), 
true);

Review Comment:
   [P2] Recycle the table version for a losing table with no partitions. `AUTO 
PARTITION BY RANGE (...) ()` can enter this race with an empty partition list, 
but `commit_index` still creates the loser's table-version key. This hook 
queues only its indexes for recycling. Both cloud version cleanup paths 
discover tables through partition keys, so after a successful drop there is no 
partition key from which to find and remove that version key. Each such 
conflict leaves permanent cloud metadata; explicitly clean up the empty table's 
version or give the recycler another discovery path.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -3322,6 +3328,11 @@ private boolean createOlapTable(Database db, 
CreateTableInfo createTableInfo) th
                 db.writeUnlock();
             }
             try {
+                if (result.second) {
+                    // Cloud indexes have already been committed. Recycle them 
outside the DB lock,
+                    // including when a CREATE without IF NOT EXISTS must 
report a duplicate error.
+                    onCreateTableConflict(db.getId(), olapTable);

Review Comment:
   [P2] Preserve a cleanup path when dropping the losing cloud indexes fails. 
In this registration race, `commit_index` has already removed the prepared 
recycle keys. If `onCreateTableConflict` gets a non-OK `dropIndex` response or 
exhausts RPC retries, the catch below calls `dropTable(db, loserId, ...)`, but 
that table was never registered, so the lookup fails and the recycler never 
sees a dropped-index marker. The loser's committed index/tablet metadata can 
remain indefinitely. Persist the loser IDs for retry or otherwise make the 
cleanup recoverable after a failed RPC.



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