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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -1006,14 +1040,14 @@ public void gsonPostProcess() throws IOException {
         if (tableAutoAnalyzePolicy == null) {
             tableAutoAnalyzePolicy = Maps.newHashMap();
         }
-        if (this.lowerCaseToDatabaseName == null) {
-            this.lowerCaseToDatabaseName = Maps.newConcurrentMap();
-        }
+        this.dbIdToName = Maps.newConcurrentMap();
     }
 
     public void addDatabaseForTest(ExternalDatabase<? extends ExternalTable> 
db) {
         buildMetaCache();
-        metaCache.addObjForTest(db.getId(), db.getFullName(), db);

Review Comment:
   Mode 2 invalidation needs to use the canonical local key, not the raw 
request/log name. `dropDbImpl()` resolves a request like `drop database 
mixeddb` to the hot `MixedDb` object and drops `dorisDb.getRemoteName()`, but 
`ExternalMetadataOps.dropDb()` then calls `afterDropDb(dbName)` and the edit 
log stores that original `dbName`. Here `invalidateDatabaseCache("mixeddb")` 
removes from `databaseNames`, `databases`, and `dbIdToName` by exact key, while 
mode 2 stores the preserved `MixedDb` key. The stale names/object/id entries 
remain hot, so `getDbNullable("mixeddb")` can resolve through the old 
`NameCacheValue` and return the dropped DB without reloading. Please 
canonicalize against the hot name/object cache, or log/pass 
`dorisDb.getFullName()`, before invalidating.
   



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -617,6 +722,7 @@ public void setLastUpdateTime(long lastUpdateTime) {
     public void gsonPostProcess() throws IOException {
         this.initialized = false;
         rwLock = new MonitoredReentrantReadWriteLock(true);

Review Comment:
   Same key mismatch on the table path for replay/rename: this can find the 
canonical object but then invalidate the raw spelling. In mode 2, 
`getTableForReplay("foo")` can resolve the hot `Foo` object via 
`NameCacheValue`, but `localTableName` stays `"foo"` because 
`toLocalTableName()` preserves its input. `invalidateTableCache("foo")` then 
misses the `tableNames`, `tables`, and `tableIdToName` entries keyed by 
`"Foo"`. Leader `DROP TABLE` uses `dorisTable.getName()` in the callback, but 
the edit log records the user spelling and `replayDropTable()`/rename replay 
pass that raw name here, so the old table can remain visible. Use the resolved 
`dorisTable.getName()` or another canonical hot key for invalidation.
   



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