morrySnow commented on code in PR #63863:
URL: https://github.com/apache/doris/pull/63863#discussion_r3427611966


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java:
##########
@@ -442,7 +442,7 @@ public void afterRenameTable(String dbName, String oldName, 
String newName) {
         Optional<ExternalDatabase<?>> db = dorisCatalog.getDbForReplay(dbName);
         if (db.isPresent()) {
             db.get().unregisterTable(oldName);
-            db.get().resetMetaCacheNames();
+            db.get().registerTableFromCreate(newName);

Review Comment:
   **Redundant double registration in Iceberg rename path**: 
`IcebergMetadataOps.afterRenameTable()` now calls 
`registerTableFromCreate(newName)`, BUT `ExternalCatalog.renameTable()` also 
calls `registerTableFromCreate(dbName, newTableName)` (line 48 of this diff). 
This means for Iceberg renames, the table is fetched from the remote system and 
cached **twice**.
   
   The flow:
   1. `ExternalCatalog.renameTable()` → `metadataOps.renameTable()` → 
`IcebergMetadataOps.afterRenameTable()` → `registerTableFromCreate(newName)` 
(1st call)
   2. Back in `ExternalCatalog.renameTable()` → 
`registerTableFromCreate(dbName, newTableName)` (2nd call)
   
   While functionally benign (the method is idempotent — 
`metaCache.updateCache()` just overwrites), it wastes a remote 
`buildTableForInit` call.
   
   **Suggestion**: Revert this change — keep `resetMetaCacheNames()` here. Let 
`ExternalCatalog.renameTable()` handle cache registration centrally. The flow 
would then be: `afterRenameTable()` clears stale names + unregisters old → 
`ExternalCatalog.renameTable()` registers new. This gives a single, consistent 
location for the fix.



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