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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalMetaCacheMgr.java:
##########
@@ -691,15 +792,70 @@ public void invalidateTableCache(ExternalTable 
dorisTable) {
         long catalogId = dorisTable.getCatalog().getId();
         // Typed table invalidation bypasses the name-based invalidateTable() 
entry point, so the
         // Lance access-cache retirement that used to happen there has to be 
repeated here.
-        invalidateLanceTableAccess(catalogId);
-        routeCatalogEngines(catalogId, cache -> safeInvalidate(
-                cache, catalogId, "invalidateTable", () -> 
cache.invalidateTable(dorisTable)));
+        try {
+            invalidateLanceTableAccess(catalogId);
+            routeCatalogEngines(catalogId, cache -> safeInvalidate(

Review Comment:
   Fixed in d2773743764. Typed table invalidation now opens its row-count fence 
before engine entry eviction, including Iceberg snapshot paths, and preserves 
the final fence. A route-level test asserts the fence at engine invalidation 
time.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -619,15 +640,36 @@ public boolean unregisterTableForReplay(String tableName) 
{
         // Check whether the table still exists in the local replay cache.
         ExternalTable dorisTable = getTableForReplay(tableName).orElse(null);
         if (dorisTable == null) {
+            // A mode-2 table-name mapping can disappear while the old object 
stays resident in
+            // MetaCache.metaObjCache; getTableForReplay then misses only 
because the mapping is
+            // absent. Retire the hidden table-object generation so a 
same-name recreation cannot
+            // reuse the prior incarnation, then widen the engine and 
row-count fence.
+            if (!hasLocalTableName(tableName)) {
+                retireAllTableObjectsWithoutEngineInvalidation();
+            }
+            // The table object cache is much smaller than the row-count and 
Hive engine caches. A drop
+            // or rename must still retire stale entries when the table object 
was evicted, and the
+            // event carries the caller spelling, so widen to the canonical 
scope.
+            Env.getCurrentEnv().getExtMetaCacheMgr()
+                    .invalidateTableByNameOrWider(extCatalog.getId(), 
getFullName(), tableName);

Review Comment:
   Fixed in d2773743764. The shared name-based cold-table invalidation now 
opens a row-count fence before routed engine invalidation and retains the 
closing fence. A route-level test asserts the opening fence is already visible 
while invalidation runs.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalMetaCacheMgr.java:
##########
@@ -691,15 +792,70 @@ public void invalidateTableCache(ExternalTable 
dorisTable) {
         long catalogId = dorisTable.getCatalog().getId();
         // Typed table invalidation bypasses the name-based invalidateTable() 
entry point, so the
         // Lance access-cache retirement that used to happen there has to be 
repeated here.
-        invalidateLanceTableAccess(catalogId);
-        routeCatalogEngines(catalogId, cache -> safeInvalidate(
-                cache, catalogId, "invalidateTable", () -> 
cache.invalidateTable(dorisTable)));
+        try {
+            invalidateLanceTableAccess(catalogId);
+            routeCatalogEngines(catalogId, cache -> safeInvalidate(
+                    cache, catalogId, "invalidateTable", () -> 
cache.invalidateTable(dorisTable)));
+        } finally {
+            invalidateRowCountCache(dorisTable);

Review Comment:
   Fixed in d2773743764. Full REFRESH TABLE and follower full-table replay now 
fence the held row count before resetting table metadata; the existing typed 
invalidation retains its completion fence. RefreshManagerTest verifies the 
ordering.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -1247,10 +1273,48 @@ public void unregisterDatabase(String dbName) {
         if (LOG.isDebugEnabled()) {
             LOG.debug("unregister database [{}]", dbName);
         }
-        if (isInitialized()) {
-            metaCache.invalidate(dbName, Util.genIdByName(name, dbName));
+        if (!isInitialized()) {
+            Env.getCurrentEnv().getExtMetaCacheMgr().invalidateDb(getId(), 
dbName);
+            return;
+        }
+        String localDbName = getLocalDatabaseName(dbName, true);

Review Comment:
   Fixed in d2773743764. A mode-2 DROP now prefers the historical database 
ID/name when retained, instead of evicting a case-only replacement selected by 
the current mapping. If that identity is gone, cleanup widens conservatively. 
CatalogMgrTest covers Foo -> FOO rebound.



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