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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/HiveInsertExecutor.java:
##########
@@ -91,6 +91,7 @@ protected void doAfterCommit() throws DdlException {
             HiveExternalMetaCache cache = 
Env.getCurrentEnv().getExtMetaCacheMgr()
                     .hive(hmsTable.getCatalog().getId());
             cache.refreshAffectedPartitions(hmsTable, partitionUpdates, 
modifiedPartNames, newPartNames);
+            
Env.getCurrentEnv().getExtMetaCacheMgr().invalidateRowCountCache(hmsTable);

Review Comment:
   [P1] Fence the row count even when post-commit partition refresh fails. The 
HMS transaction is already marked `COMMITTED` before `doAfterCommit`, but 
`refreshAffectedPartitions` can throw while decoding or publishing partition 
metadata. Because `invalidateRowCountCache` is only reached afterward, the 
pre-insert future remains resident, and the exception also skips the edit-log 
write that peers rely on. Put the fence in a commit-safe `finally` or 
immediately after commit, handle refresh errors separately, and add a 
regression with a throwing partition refresh. The replay/drop partition callers 
have the same failure ordering.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalCatalog.java:
##########
@@ -424,7 +425,8 @@ private void buildMetaCache() {
                     localDbName -> Optional.ofNullable(
                             buildDbForInit(null, localDbName, 
Util.genIdByName(name, localDbName), logType,
                                     true)),
-                    (key, value, cause) -> value.ifPresent(v -> 
v.resetMetaToUninitialized()));
+                    (key, value, cause) -> value.ifPresent(
+                            v -> 
v.resetMetaToUninitialized(!invalidatingAllMetaCache)));

Review Comment:
   [P2] Avoid scanning the global row-count cache twice for `REFRESH CATALOG`. 
`onRefreshCache` always calls `refreshMetaCacheOnly`, and this new invalidation 
is immediately followed by `invalidateCatalog` when `invalidCache=true`; the 
manager's `finally` performs the same O(N), write-locked catalog scan again. 
The command default and scheduled refresh both use `invalidCache=true`, so 
every normal refresh doubles the pause for row-count readers. Make one owner 
perform the catalog fence while preserving the single scan for reset-only 
callers.



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