wenzhenghu commented on code in PR #65126:
URL: https://github.com/apache/doris/pull/65126#discussion_r3579575803


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -570,17 +671,15 @@ public void unregisterTable(String tableName) {
             LOG.debug("unregister table {}.{}", this.name, tableName);
         }
         setLastUpdateTime(System.currentTimeMillis());
-        // check if the table exists in cache, it not, does return
-        ExternalTable dorisTable = getTableForReplay(tableName).orElse(null);
+        String localTableName = toLocalTableName(tableName);
+        ExternalTable dorisTable = 
getTableForReplay(localTableName).orElse(null);
+        // Always clean local names/object/ID state, even when the object 
entry is cold or already evicted.
+        if (isInitialized()) {
+            invalidateTableCache(localTableName);
+        }

Review Comment:
   You were right to flag this. After tracing the complete drop/replay path 
again, I found that my previous conclusion was incorrect.
   
   In mode 2, `toLocalTableName()` only preserves the input spelling; it does 
not guarantee that the input is already the canonical/original-case cache key. 
Replay and rename paths may pass the raw name recorded in the edit log, for 
example `"foo"`, while `tableNames`, `tables`, and `tableIdToName` use `"Foo"`. 
Invalidating with the raw spelling can therefore leave stale entries behind.
   
   I am correcting this by resolving a canonical cache-only key from the hot 
names snapshot, object-cache keys, or ID map before invalidation. The 
table-level external metadata cache is also invalidated by 
catalog/database/table names so cleanup does not depend on the object entry 
being hot. The added tests cover both fully hot cache state and cold 
names/object entries with only the ID mapping present.
   
   Thank you again for identifying this earlier, and apologies for dismissing 
the finding in the previous reply.



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