Copilot commented on code in PR #6198:
URL: https://github.com/apache/hive/pull/6198#discussion_r2986208934
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java:
##########
@@ -2169,15 +2169,23 @@ private static void
updateTableColumnsStatsInternal(Configuration conf, ColumnSt
throw new RuntimeException("CachedStore can only be enabled for Hive
engine");
}
boolean succ = rawStore.deleteTableColumnStatistics(catName, dbName,
tblName, colNames, engine);
+ catName = normalizeIdentifier(catName);
+ dbName = normalizeIdentifier(dbName);
+ tblName = normalizeIdentifier(tblName);
+ if (!shouldCacheTable(catName, dbName, tblName)) {
+ return succ;
+ }
+ Table cachedTable = sharedCache.getTableFromCache(catName, dbName,
tblName);
+ if (cachedTable != null) {
+ if (colNames == null || colNames.isEmpty()) {
+ StatsSetupConst.clearColumnStatsState(cachedTable.getParameters());
+ } else {
+ StatsSetupConst.removeColumnStatsState(cachedTable.getParameters(),
colNames);
+ }
+ sharedCache.alterTableInCache(catName, dbName, tblName, cachedTable);
+ }
Review Comment:
`cachedTable`'s `COLUMN_STATS_ACCURATE` is updated unconditionally, even if
`rawStore.deleteTableColumnStatistics(...)` failed (`succ == false`). This can
make the cache diverge from the backing store. Only mutate and re-store the
cached table parameters when `succ` is true (or otherwise ensure cache update
happens only when the delete operation actually succeeded).
--
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]