From 9c7a63214cef04d1f9ecde67056f50658fa76c80 Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Thu, 30 Jan 2020 15:42:48 +0100 Subject: [PATCH] Fix InternalEngineTests.testSeqNoAndCheckpoints (#51630) (#51671) * Fix InternalEngineTests.testSeqNoAndCheckpoints If we force flush while possibly triggering a merge the local checkpoint may change from the expectation from the loop that just increments on every operation. Closes #51604 --- .../org/elasticsearch/index/engine/InternalEngineTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index 58d77a5a3e3..a120a640feb 100644 --- a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -2433,7 +2433,7 @@ public class InternalEngineTests extends EngineTestCase { id = randomFrom(indexedIds); final Engine.Delete delete = new Engine.Delete( "test", id, newUid(id), UNASSIGNED_SEQ_NO, primaryTerm.get(), - rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL, PRIMARY, 0, UNASSIGNED_SEQ_NO, 0); + rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL, PRIMARY, System.nanoTime(), UNASSIGNED_SEQ_NO, 0); final Engine.DeleteResult result = initialEngine.delete(delete); if (result.getResultType() == Engine.Result.Type.SUCCESS) { assertThat(result.getSeqNo(), equalTo(primarySeqNo + 1)); @@ -2451,7 +2451,7 @@ public class InternalEngineTests extends EngineTestCase { final Engine.Index index = new Engine.Index(newUid(doc), doc, UNASSIGNED_SEQ_NO, primaryTerm.get(), rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL, - PRIMARY, 0, -1, false, UNASSIGNED_SEQ_NO, 0); + PRIMARY, System.nanoTime(), -1, false, UNASSIGNED_SEQ_NO, 0); final Engine.IndexResult result = initialEngine.index(index); if (result.getResultType() == Engine.Result.Type.SUCCESS) { assertThat(result.getSeqNo(), equalTo(primarySeqNo + 1));