Skip to content

Commit 903c359

Browse files
authored
[remove datanode X IoTV2] Fix concurrent modification when removing fails and rollback apache#14336
1 parent 695d3be commit 903c359

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/PipeConsensus.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.apache.iotdb.rpc.RpcUtils;
5959
import org.apache.iotdb.rpc.TSStatusCode;
6060

61+
import com.google.common.collect.ImmutableList;
6162
import com.google.common.collect.ImmutableMap;
6263
import org.slf4j.Logger;
6364
import org.slf4j.LoggerFactory;
@@ -411,8 +412,9 @@ public void resetPeerList(ConsensusGroupId groupId, List<Peer> correctPeers)
411412
deleteLocalPeer(groupId);
412413
return;
413414
}
415+
ImmutableList<Peer> currentPeers = ImmutableList.copyOf(impl.getPeers());
414416
String previousPeerListStr = impl.getPeers().toString();
415-
for (Peer peer : impl.getPeers()) {
417+
for (Peer peer : currentPeers) {
416418
if (!correctPeers.contains(peer)) {
417419
try {
418420
impl.dropConsensusPipeToTargetPeer(peer);

0 commit comments

Comments
 (0)