This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push:
new 7c9204274c Fixes ConcurrentModificationException in RunningCompaction
(#4383)
7c9204274c is described below
commit 7c9204274c195e258c6f45dbfe93e9d720533929
Author: Dave Marion <[email protected]>
AuthorDate: Fri Mar 15 13:21:33 2024 -0400
Fixes ConcurrentModificationException in RunningCompaction (#4383)
While working on #4382 I ran into an issue where a CME was being
raised in a Thrift thread that was trying to serialize the updates
from the RunningCompaction object.
---
.../apache/accumulo/core/util/compaction/RunningCompaction.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompaction.java
b/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompaction.java
index b2e4fd1581..4d666e4962 100644
---
a/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompaction.java
+++
b/core/src/main/java/org/apache/accumulo/core/util/compaction/RunningCompaction.java
@@ -43,11 +43,15 @@ public class RunningCompaction {
}
public Map<Long,TCompactionStatusUpdate> getUpdates() {
- return updates;
+ synchronized (updates) {
+ return new TreeMap<>(updates);
+ }
}
public void addUpdate(Long timestamp, TCompactionStatusUpdate update) {
- this.updates.put(timestamp, update);
+ synchronized (updates) {
+ this.updates.put(timestamp, update);
+ }
}
public TExternalCompactionJob getJob() {