From 3d5e4577aa47713a3a4375279c87832d5e7cb770 Mon Sep 17 00:00:00 2001 From: Yannick Welsch Date: Tue, 25 Jun 2019 12:48:20 +0200 Subject: [PATCH] Fix testPostOperationGlobalCheckpointSync The conditions in this test do not hold true anymore after #43205. Relates to #43205 --- .../index/seqno/GlobalCheckpointSyncIT.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointSyncIT.java b/server/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointSyncIT.java index 8d148a74ea9..31104166346 100644 --- a/server/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointSyncIT.java +++ b/server/src/test/java/org/elasticsearch/index/seqno/GlobalCheckpointSyncIT.java @@ -44,6 +44,7 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -83,8 +84,14 @@ public class GlobalCheckpointSyncIT extends ESIntegTestCase { } public void testPostOperationGlobalCheckpointSync() throws Exception { - // set the sync interval high so it does not execute during this test - runGlobalCheckpointSyncTest(TimeValue.timeValueHours(24), client -> {}, client -> {}); + // set the sync interval high so it does not execute during this test. This only allows the the global checkpoint to catch up + // on a post-operation background sync if translog durability is set to sync. Async durability relies on a scheduled global + // checkpoint sync to allow the information about persisted local checkpoints to be transferred to the primary. + runGlobalCheckpointSyncTest(TimeValue.timeValueHours(24), + client -> + client.admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder() + .put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.REQUEST)).get(), + client -> {}); } /* @@ -212,7 +219,7 @@ public class GlobalCheckpointSyncIT extends ESIntegTestCase { assertThat(seqNoStats.getGlobalCheckpoint(), equalTo(primarySeqNoStats.getGlobalCheckpoint())); } } - }); + }, 30, TimeUnit.SECONDS); for (final Thread thread : threads) { thread.join();