Skip to content

Commit 695d3be

Browse files
authored
[remove datanode] Fix concurrent modification when removing fails and rollback apache#14333
1 parent c789ba8 commit 695d3be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.apache.iotdb.rpc.RpcUtils;
6262
import org.apache.iotdb.rpc.TSStatusCode;
6363

64+
import com.google.common.collect.ImmutableList;
6465
import org.slf4j.Logger;
6566
import org.slf4j.LoggerFactory;
6667

@@ -492,8 +493,9 @@ public void resetPeerList(ConsensusGroupId groupId, List<Peer> correctPeers)
492493
deleteLocalPeer(groupId);
493494
return;
494495
}
495-
String previousPeerListStr = impl.getConfiguration().toString();
496-
for (Peer peer : impl.getConfiguration()) {
496+
ImmutableList<Peer> currentMembers = ImmutableList.copyOf(impl.getConfiguration());
497+
String previousPeerListStr = currentMembers.toString();
498+
for (Peer peer : currentMembers) {
497499
if (!correctPeers.contains(peer)) {
498500
if (!impl.removeSyncLogChannel(peer)) {
499501
logger.error(

0 commit comments

Comments
 (0)