Skip to content

Commit

Permalink
Fix IndexLifecycleRunnerTests.testRunAsyncActionReturningFalseEntersE…
Browse files Browse the repository at this point in the history
…rror (#75125) (#75140)

Avoid ConcurrentModificationException by using a thread safe collection
in the test, as we write to the ILM history store in an async way.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Andrei Dan <andrei.dan@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 8, 2021
1 parent 62fd7a3 commit 3bf2ac2
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import java.util.Objects;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -1252,7 +1253,7 @@ public static MockPolicyStepsRegistry createMultiStepPolicyStepRegistry(String p
private static class NoOpHistoryStore extends ILMHistoryStore {
private static final Logger logger = LogManager.getLogger(NoOpHistoryStore.class);

private final List<ILMHistoryItem> items = new ArrayList<>();
private final List<ILMHistoryItem> items = new CopyOnWriteArrayList<>();

NoOpHistoryStore(Client noopClient) {
super(Settings.EMPTY, noopClient, null, null);
Expand Down

0 comments on commit 3bf2ac2

Please sign in to comment.