[TEST] Fix testRecoveryAfterPrimaryPromotion
This test was failing from time to time due to a ConcurrentModificationException, which was triggered due to the primary-replica resync running concurrently with shards being removed. Closes #30767
This commit is contained in:
parent
42608881b0
commit
f9e8afd357
|
@ -81,6 +81,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.FutureTask;
|
import java.util.concurrent.FutureTask;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
@ -147,7 +148,7 @@ public abstract class ESIndexLevelReplicationTestCase extends IndexShardTestCase
|
||||||
ReplicationGroup(final IndexMetaData indexMetaData) throws IOException {
|
ReplicationGroup(final IndexMetaData indexMetaData) throws IOException {
|
||||||
final ShardRouting primaryRouting = this.createShardRouting("s0", true);
|
final ShardRouting primaryRouting = this.createShardRouting("s0", true);
|
||||||
primary = newShard(primaryRouting, indexMetaData, null, getEngineFactory(primaryRouting), () -> {});
|
primary = newShard(primaryRouting, indexMetaData, null, getEngineFactory(primaryRouting), () -> {});
|
||||||
replicas = new ArrayList<>();
|
replicas = new CopyOnWriteArrayList<>();
|
||||||
this.indexMetaData = indexMetaData;
|
this.indexMetaData = indexMetaData;
|
||||||
updateAllocationIDsOnPrimary();
|
updateAllocationIDsOnPrimary();
|
||||||
for (int i = 0; i < indexMetaData.getNumberOfReplicas(); i++) {
|
for (int i = 0; i < indexMetaData.getNumberOfReplicas(); i++) {
|
||||||
|
|
Loading…
Reference in New Issue