adapt testDoubleDeliveryReplicaAppendingOnly to #25827
This commit is contained in:
parent
d21ad9b652
commit
c72fc55283
|
@ -3177,16 +3177,19 @@ public class InternalEngineTests extends ESTestCase {
|
|||
public void testDoubleDeliveryReplicaAppendingOnly() throws IOException {
|
||||
final ParsedDocument doc = testParsedDocument("1", null, testDocumentWithTextField(),
|
||||
new BytesArray("{}".getBytes(Charset.defaultCharset())), null);
|
||||
Engine.Index operation = appendOnlyReplica(doc, false, 1, randomIntBetween(0, 20));
|
||||
Engine.Index retry = appendOnlyReplica(doc, true, 1, operation.seqNo());
|
||||
Engine.Index operation = appendOnlyReplica(doc, false, 1, randomIntBetween(0, 5));
|
||||
Engine.Index retry = appendOnlyReplica(doc, true, 1, randomIntBetween(0, 5));
|
||||
// operations with a seq# equal or lower to the local checkpoint are not indexed to lucene
|
||||
// and the version lookup is skipped
|
||||
final boolean belowLckp = operation.seqNo() == 0 && retry.seqNo() == 0;
|
||||
if (randomBoolean()) {
|
||||
Engine.IndexResult indexResult = engine.index(operation);
|
||||
assertFalse(engine.indexWriterHasDeletions());
|
||||
assertEquals(0, engine.getNumVersionLookups());
|
||||
assertNotNull(indexResult.getTranslogLocation());
|
||||
Engine.IndexResult retryResult = engine.index(retry);
|
||||
assertFalse(engine.indexWriterHasDeletions());
|
||||
assertEquals(1, engine.getNumVersionLookups());
|
||||
assertEquals(retry.seqNo() > operation.seqNo(), engine.indexWriterHasDeletions());
|
||||
assertEquals(belowLckp ? 0 : 1, engine.getNumVersionLookups());
|
||||
assertNotNull(retryResult.getTranslogLocation());
|
||||
assertTrue(retryResult.getTranslogLocation().compareTo(indexResult.getTranslogLocation()) > 0);
|
||||
} else {
|
||||
|
@ -3195,8 +3198,8 @@ public class InternalEngineTests extends ESTestCase {
|
|||
assertEquals(1, engine.getNumVersionLookups());
|
||||
assertNotNull(retryResult.getTranslogLocation());
|
||||
Engine.IndexResult indexResult = engine.index(operation);
|
||||
assertFalse(engine.indexWriterHasDeletions());
|
||||
assertEquals(2, engine.getNumVersionLookups());
|
||||
assertEquals(operation.seqNo() > retry.seqNo(), engine.indexWriterHasDeletions());
|
||||
assertEquals(belowLckp ? 1 : 2, engine.getNumVersionLookups());
|
||||
assertNotNull(retryResult.getTranslogLocation());
|
||||
assertTrue(retryResult.getTranslogLocation().compareTo(indexResult.getTranslogLocation()) < 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue