HBASE-24074 ConcurrentModificationException occured in ReplicationSourceManager while refreshing the peer (#1471)

Signed-off-by: Huaxiang Sun <huaxiangsun@apache.com>
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Pankaj 2020-04-10 05:10:15 +05:30 committed by stack
parent 91aa3ce97c
commit 823cf97495
1 changed files with 4 additions and 2 deletions

View File

@ -400,11 +400,13 @@ public class ReplicationSourceManager implements ReplicationListener {
// synchronized on oldsources to avoid race with NodeFailoverWorker // synchronized on oldsources to avoid race with NodeFailoverWorker
synchronized (this.oldsources) { synchronized (this.oldsources) {
List<String> previousQueueIds = new ArrayList<>(); List<String> previousQueueIds = new ArrayList<>();
for (ReplicationSourceInterface oldSource : this.oldsources) { for (Iterator<ReplicationSourceInterface> iter = this.oldsources.iterator(); iter
.hasNext();) {
ReplicationSourceInterface oldSource = iter.next();
if (oldSource.getPeerId().equals(peerId)) { if (oldSource.getPeerId().equals(peerId)) {
previousQueueIds.add(oldSource.getQueueId()); previousQueueIds.add(oldSource.getQueueId());
oldSource.terminate(terminateMessage); oldSource.terminate(terminateMessage);
this.oldsources.remove(oldSource); iter.remove();
} }
} }
for (String queueId : previousQueueIds) { for (String queueId : previousQueueIds) {