From c92dd28a883e67137142089d39cc1bf9024b1df7 Mon Sep 17 00:00:00 2001 From: Pankaj Date: Fri, 10 Apr 2020 05:10:15 +0530 Subject: [PATCH] HBASE-24074 ConcurrentModificationException occured in ReplicationSourceManager while refreshing the peer (#1471) Signed-off-by: Huaxiang Sun Signed-off-by: stack --- .../replication/regionserver/ReplicationSourceManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java index 6a4e863c5bfd..1a012bd5db42 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java @@ -496,11 +496,13 @@ public void refreshSources(String peerId) throws IOException { // synchronized on oldsources to avoid race with NodeFailoverWorker synchronized (this.oldsources) { List previousQueueIds = new ArrayList<>(); - for (ReplicationSourceInterface oldSource : this.oldsources) { + for (Iterator iter = this.oldsources.iterator(); iter + .hasNext();) { + ReplicationSourceInterface oldSource = iter.next(); if (oldSource.getPeerId().equals(peerId)) { previousQueueIds.add(oldSource.getQueueId()); oldSource.terminate(terminateMessage); - this.oldsources.remove(oldSource); + iter.remove(); } } for (String queueId : previousQueueIds) {