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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -954,6 +967,41 @@ public Optional<ExternalDatabase<? extends ExternalTable>> 
getDbForReplay(String
         return metaCache.tryGetMetaObj(localDbName);
     }
 
+    /** Resolve a replay log's database identity without reloading an evicted 
database object. */
+    public Optional<Pair<String, Long>> getDbIdentityForReplay(String dbName, 
long dbId) {
+        if (!isInitialized() || metaCache == null) {
+            return Optional.empty();
+        }
+        if (dbName != null && !dbName.isEmpty()) {
+            String localName = getLocalDatabaseName(dbName, true);
+            return localName == null ? Optional.empty()
+                    : Optional.of(Pair.of(localName, Util.genIdByName(name, 
localName)));
+        }
+        return metaCache.getNameByIdIfPresent(dbId).map(localName -> 
Pair.of(localName, dbId));
+    }
+
+    /** A DROP must not follow a mode-2 mapping that has rebound to a 
case-only replacement. */
+    private Optional<Pair<String, Long>> getDbIdentityForDrop(String dbName) {
+        if (!isInitialized() || metaCache == null) {
+            return Optional.empty();
+        }
+        String localName = getLocalDatabaseName(dbName, true);
+        if (localName == null) {
+            return Optional.empty();
+        }
+        if (getLowerCaseDatabaseNames() == 2 && !localName.equals(dbName)) {
+            long historicalId = Util.genIdByName(name, dbName);
+            return metaCache.getNameByIdIfPresent(historicalId)

Review Comment:
   Fixed in 3d33dba7ab26. Live DROP TABLE now journals the resolved 
database/table names and an explicit resolvedDb marker; replay uses that target 
instead of the caller alias. Legacy mode-2 records without the marker 
conservatively retire the unresolved database generation. CatalogMgrTest covers 
both Foo/FOO target histories and the old-log fallback; 165 focused FE tests 
and the post-rebase FE build 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