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 {
|
public void testDoubleDeliveryReplicaAppendingOnly() throws IOException {
|
||||||
final ParsedDocument doc = testParsedDocument("1", null, testDocumentWithTextField(),
|
final ParsedDocument doc = testParsedDocument("1", null, testDocumentWithTextField(),
|
||||||
new BytesArray("{}".getBytes(Charset.defaultCharset())), null);
|
new BytesArray("{}".getBytes(Charset.defaultCharset())), null);
|
||||||
Engine.Index operation = appendOnlyReplica(doc, false, 1, randomIntBetween(0, 20));
|
Engine.Index operation = appendOnlyReplica(doc, false, 1, randomIntBetween(0, 5));
|
||||||
Engine.Index retry = appendOnlyReplica(doc, true, 1, operation.seqNo());
|
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()) {
|
if (randomBoolean()) {
|
||||||
Engine.IndexResult indexResult = engine.index(operation);
|
Engine.IndexResult indexResult = engine.index(operation);
|
||||||
assertFalse(engine.indexWriterHasDeletions());
|
assertFalse(engine.indexWriterHasDeletions());
|
||||||
assertEquals(0, engine.getNumVersionLookups());
|
assertEquals(0, engine.getNumVersionLookups());
|
||||||
assertNotNull(indexResult.getTranslogLocation());
|
assertNotNull(indexResult.getTranslogLocation());
|
||||||
Engine.IndexResult retryResult = engine.index(retry);
|
Engine.IndexResult retryResult = engine.index(retry);
|
||||||
assertFalse(engine.indexWriterHasDeletions());
|
assertEquals(retry.seqNo() > operation.seqNo(), engine.indexWriterHasDeletions());
|
||||||
assertEquals(1, engine.getNumVersionLookups());
|
assertEquals(belowLckp ? 0 : 1, engine.getNumVersionLookups());
|
||||||
assertNotNull(retryResult.getTranslogLocation());
|
assertNotNull(retryResult.getTranslogLocation());
|
||||||
assertTrue(retryResult.getTranslogLocation().compareTo(indexResult.getTranslogLocation()) > 0);
|
assertTrue(retryResult.getTranslogLocation().compareTo(indexResult.getTranslogLocation()) > 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3195,8 +3198,8 @@ public class InternalEngineTests extends ESTestCase {
|
||||||
assertEquals(1, engine.getNumVersionLookups());
|
assertEquals(1, engine.getNumVersionLookups());
|
||||||
assertNotNull(retryResult.getTranslogLocation());
|
assertNotNull(retryResult.getTranslogLocation());
|
||||||
Engine.IndexResult indexResult = engine.index(operation);
|
Engine.IndexResult indexResult = engine.index(operation);
|
||||||
assertFalse(engine.indexWriterHasDeletions());
|
assertEquals(operation.seqNo() > retry.seqNo(), engine.indexWriterHasDeletions());
|
||||||
assertEquals(2, engine.getNumVersionLookups());
|
assertEquals(belowLckp ? 1 : 2, engine.getNumVersionLookups());
|
||||||
assertNotNull(retryResult.getTranslogLocation());
|
assertNotNull(retryResult.getTranslogLocation());
|
||||||
assertTrue(retryResult.getTranslogLocation().compareTo(indexResult.getTranslogLocation()) < 0);
|
assertTrue(retryResult.getTranslogLocation().compareTo(indexResult.getTranslogLocation()) < 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue