diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 4b4820c3053..011766f2112 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -88,6 +88,7 @@ Bug Fixes * SOLR-11824: Fixed bucket ordering in distributed json.facet type:range when mincount>0 (hossman) +* SOLR-11821: ConcurrentModificationException in SimSolrCloudTestCase.tearDown (shalin) Optimizations ---------------------- diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java index 77ddbc016ac..48d46b65849 100644 --- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java +++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/SimSolrCloudTestCase.java @@ -138,13 +138,17 @@ public class SimSolrCloudTestCase extends SolrTestCaseJ4 { cluster.simGetOpCounts().forEach((k, cnt) -> log.info("##\t\t- " + String.format(Locale.ROOT, "%-14s %4d", k, cnt.get()))); log.info("######### Autoscaling event counts ###########"); TreeMap> counts = new TreeMap<>(); - for (SolrInputDocument d : cluster.simGetSystemCollection()) { - if (!"autoscaling_event".equals(d.getFieldValue("type"))) { - continue; + + List solrInputDocuments = cluster.simGetSystemCollection(); + synchronized (solrInputDocuments) { + for (SolrInputDocument d : solrInputDocuments) { + if (!"autoscaling_event".equals(d.getFieldValue("type"))) { + continue; + } + counts.computeIfAbsent((String)d.getFieldValue("event.source_s"), s -> new TreeMap<>()) + .computeIfAbsent((String)d.getFieldValue("stage_s"), s -> new AtomicInteger()) + .incrementAndGet(); } - counts.computeIfAbsent((String)d.getFieldValue("event.source_s"), s -> new TreeMap<>()) - .computeIfAbsent((String)d.getFieldValue("stage_s"), s -> new AtomicInteger()) - .incrementAndGet(); } counts.forEach((trigger, map) -> { log.info("## * Trigger: " + trigger);