aswinshakil commented on code in PR #6024:
URL: https://github.com/apache/ozone/pull/6024#discussion_r1458135681
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -98,11 +102,11 @@ public void invalidate(String key) throws IOException {
* Immediately invalidate all entries and close their DB instances in cache.
*/
public void invalidateAll() {
- Iterator<Map.Entry<String, ReferenceCounted<IOmMetadataReader,
SnapshotCache>>>
+ Iterator<Map.Entry<String, ReferenceCounted<IOmMetadataReader,
SnapshotCache, String>>>
Review Comment:
`invalidateAll()` and `invalidate()` should also cleanup the if entries
already exist in `pendingEvictionQueue`.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotCache.java:
##########
@@ -237,8 +242,9 @@ private synchronized void cleanup() {
* TODO: [SNAPSHOT] Add new ozone debug CLI command to trigger this directly.
*/
private void cleanupInternal() {
- for (Map.Entry<String, ReferenceCounted<IOmMetadataReader, SnapshotCache>>
entry : dbMap.entrySet()) {
- dbMap.compute(entry.getKey(), (k, v) -> {
+ for (String evictionKey : pendingEvictionQueue) {
+ dbMap.compute(evictionKey, (k, v) -> {
+ pendingEvictionQueue.remove(k);
Review Comment:
I'm not sure about this. Iterating and removing elements, while` get()` is
adding to the same `pendingEvictionQueue` can cause
`ConcurrentModificationException`
--
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]