This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch elasticity in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/elasticity by this push: new 3bdecc2fe7 Fix ConcurrentModificationException in QueueMetrics (#4150) 3bdecc2fe7 is described below commit 3bdecc2fe7c1993a9ff8c88ea0cc943859a2c108 Author: Dave Marion <dlmar...@apache.org> AuthorDate: Thu Jan 11 15:13:10 2024 -0500 Fix ConcurrentModificationException in QueueMetrics (#4150) The metricsWithoutQueues variable is a SetView which is sensitive to changes in the underlying sets. The loop was modifying one of the underlying objects. To prevent the CME from being raised I copied the objects into a new set. Closes #4144 --- .../apache/accumulo/manager/compaction/coordinator/QueueMetrics.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java index cb24ddd2d0..f12135ba74 100644 --- a/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/compaction/coordinator/QueueMetrics.java @@ -21,6 +21,7 @@ package org.apache.accumulo.manager.compaction.coordinator; import static org.apache.accumulo.core.metrics.MetricsUtil.getCommonTags; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ScheduledExecutorService; @@ -127,7 +128,9 @@ public class QueueMetrics implements MetricsProducer { Set<CompactorGroupId> definedQueues = compactionJobQueues.getQueueIds(); LOG.debug("update - defined queues: {}", definedQueues); - Set<CompactorGroupId> queuesWithMetrics = perQueueMetrics.keySet(); + // Copy the keySet into a new Set so that changes to perQueueMetrics + // don't affect the collection + Set<CompactorGroupId> queuesWithMetrics = new HashSet<>(perQueueMetrics.keySet()); LOG.debug("update - queues with metrics: {}", queuesWithMetrics); SetView<CompactorGroupId> queuesWithoutMetrics =