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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonMetadataOps.java:
##########
@@ -189,11 +186,25 @@ private void performDropDb(String dbName, boolean 
ifExists, boolean force) throw
         } catch (DatabaseNotEmptyException e) {
             throw new RuntimeException("database " + dbName + " is not empty! 
please check!");
         }
+        return true;
     }
 
     @Override
     public void afterDropDb(String dbName) {
+        Optional<ExternalDatabase<? extends ExternalTable>> db = 
dorisCatalog.getDbForReplay(dbName);
+        if (db.isPresent()) {
+            // getDbForReplay normalizes case-insensitive database names 
(lower_case_database_names
+            // mode 1/2), so an alternate-case DROP DATABASE can resolve the 
cached database while
+            // an exact-key eviction with the caller's spelling would miss it. 
Evict by the resolved
+            // canonical local key so the removal listener still performs the 
one typed SDK
+            // invalidation; do not add a second typed scan under the catalog 
write fence.
+            dorisCatalog.unregisterDatabase(db.get().getFullName());
+            return;
+        }
+        // The cached database could not be resolved: best-effort exact-key 
eviction, then
+        // conservatively retire the SDK catalog so no SDK-only handle 
survives the drop.
         dorisCatalog.unregisterDatabase(dbName);
+        invalidatePaimonCatalogForUnresolvedReplay();

Review Comment:
   [P1] Retire the unresolved legacy database object as well. With 
`lower_case_database_names=2`, a follower's names refresh can observe the 
remote drop and remove `lowerCaseToDatabaseName` before replay while 
`MetaCache` still retains the canonical `ExternalDatabase`. An alternate-case 
log then misses `getDbForReplay`; `unregisterDatabase(dbName)` misses the exact 
key, and this fallback clears only Paimon's SDK/engine entries. If that 
database is recreated with the same name, `getDbNullable` reuses the old 
database whose complete nested names cache can make `SHOW TABLES` expose tables 
from the previous incarnation. This is distinct from the resolved-name thread 
because the mode-2 mapping has already disappeared. Carry/journal the canonical 
identity or conservatively retire the legacy database cache on this unresolved 
path, and cover replay after a names refresh followed by an empty same-name 
recreation.
   



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