Copilot commented on code in PR #11894:
URL: https://github.com/apache/ozone/pull/11894#discussion_r4436818339


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -565,6 +565,7 @@ public void stop() throws IOException {
       LOG.error("Error closing hierarchical lock manager", e);
     }
     tableCacheMetricsMap.values().forEach(TableCacheMetrics::unregister);
+    tableMap.values().forEach(Table::closeCache);

Review Comment:
   This iteration is not synchronized with `TableInitializer.get()`, which 
mutates the same `HashMap` while replacing tables. In particular, 
`OzoneManagerServiceProviderImpl.stop()` currently calls 
`omMetadataManager.stop()` before shutting down/awaiting its OM-sync scheduler, 
so a concurrent full snapshot update can modify `tableMap` here and cause a 
`ConcurrentModificationException` (or close a newly installed cache after it is 
created). Stop and await the sync scheduler before closing the metadata 
manager, or otherwise synchronize the replacement and shutdown paths.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/PartialTableCache.java:
##########
@@ -106,6 +106,11 @@ public void cleanup(List<Long> epochs) {
     executorService.execute(() -> evictCache(epochs));
   }
 
+  @Override
+  public void close() {
+    executorService.shutdown();
+  }

Review Comment:
   `cleanup` submits one eviction task per call, so `shutdown()` allows every 
task accepted before this call to drain. During OM shutdown or Recon table 
replacement, queued evictions can therefore run after `close()` returns and 
keep the old cache reachable for an unbounded time, contrary to the new 
`TableCache.close()` contract that no cleanup may follow. Discard pending 
cleanup work (or add an explicit closed guard) instead of draining the executor.



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