924060929 commented on code in PR #68238:
URL: https://github.com/apache/doris/pull/68238#discussion_r4069877120


##########
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:
   Fixed in 1234492a99ccfba44b24efbc32fbb5e57854b2d9. 
PaimonMetadataOps.afterDropDb now also calls 
ExternalCatalog.retireAllDatabaseObjectsWithoutEngineInvalidation() on the 
unresolved replay path. That retires every cached legacy ExternalDatabase 
(suppressing per-database engine callbacks because the catalog-wide Paimon 
engine flush follows immediately), so a mode-2 mapping lost to a names refresh 
can no longer leave a stale canonical object whose nested table-name cache a 
same-name recreation would reuse. Added 
testMode2UnresolvedReplayDropRetiresCanonicalLegacyDatabase (seeds then clears 
the mode-2 mapping and asserts the canonical object is retired). Also rebased 
onto the latest branch-4.1 (85c9e0aab94) and resolved the IcebergMetadataOps 
conflict; 135 affected tests pass.



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