Do not hold writeLock while verifying Lucene/translog

We should not hold Engine#writeLock while executing
assertConsistentHistoryBetweenTranslogAndLuceneIndex
for this check might acquire Engine#readLock.

Relates #45461
This commit is contained in:
Nhat Nguyen 2019-08-13 13:46:36 -04:00
parent 24514275c7
commit 4fcf7bbd07

View File

@ -68,7 +68,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.common.util.concurrent.ReleasableLock;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
@ -1076,8 +1075,6 @@ public abstract class EngineTestCase extends ESTestCase {
|| (engine instanceof InternalEngine) == false) {
return;
}
// hold writeLock during this check so indexing can't happen
try (ReleasableLock ignored = engine.writeLock.acquire()) {
final List<Translog.Operation> translogOps = new ArrayList<>();
try (Translog.Snapshot snapshot = EngineTestCase.getTranslog(engine).newSnapshot()) {
Translog.Operation op;
@ -1119,7 +1116,6 @@ public abstract class EngineTestCase extends ESTestCase {
}
}
}
}
/**
* Asserts that the max_seq_no stored in the commit's user_data is never smaller than seq_no of any document in the commit.