Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.elasticsearch.index.engine;

import java.nio.file.Path;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.index.IndexSettings;
Expand Down Expand Up @@ -191,13 +192,12 @@ public void testDedupByPrimaryTerm() throws Exception {
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/33344")
public void testUpdateAndReadChangesConcurrently() throws Exception {
Follower[] followers = new Follower[between(1, 3)];
CountDownLatch readyLatch = new CountDownLatch(followers.length + 1);
AtomicBoolean isDone = new AtomicBoolean();
for (int i = 0; i < followers.length; i++) {
followers[i] = new Follower(engine, isDone, readyLatch);
followers[i] = new Follower(engine, isDone, readyLatch, createTempDir());
followers[i].start();
}
boolean onPrimary = randomBoolean();
Expand Down Expand Up @@ -236,13 +236,15 @@ class Follower extends Thread {
private final TranslogHandler translogHandler;
private final AtomicBoolean isDone;
private final CountDownLatch readLatch;
private final Path translogPath;

Follower(Engine leader, AtomicBoolean isDone, CountDownLatch readLatch) {
Follower(Engine leader, AtomicBoolean isDone, CountDownLatch readLatch, Path translogPath) {
this.leader = leader;
this.isDone = isDone;
this.readLatch = readLatch;
this.translogHandler = new TranslogHandler(xContentRegistry(), IndexSettingsModule.newIndexSettings(shardId.getIndexName(),
engine.engineConfig.getIndexSettings().getSettings()));
this.translogPath = translogPath;
}

void pullOperations(Engine follower) throws IOException {
Expand All @@ -261,7 +263,7 @@ void pullOperations(Engine follower) throws IOException {
@Override
public void run() {
try (Store store = createStore();
InternalEngine follower = createEngine(store, createTempDir())) {
InternalEngine follower = createEngine(store, translogPath)) {
readLatch.countDown();
readLatch.await();
while (isDone.get() == false ||
Expand Down