|
44 | 44 | import java.util.Optional;
|
45 | 45 | import java.util.concurrent.BrokenBarrierException;
|
46 | 46 | import java.util.concurrent.CyclicBarrier;
|
| 47 | +import java.util.concurrent.TimeUnit; |
47 | 48 | import java.util.function.Consumer;
|
48 | 49 | import java.util.stream.Collectors;
|
49 | 50 | import java.util.stream.Stream;
|
@@ -83,8 +84,14 @@ public void testGlobalCheckpointSyncWithAsyncDurability() throws Exception {
|
83 | 84 | }
|
84 | 85 |
|
85 | 86 | public void testPostOperationGlobalCheckpointSync() throws Exception {
|
86 |
| - // set the sync interval high so it does not execute during this test |
87 |
| - runGlobalCheckpointSyncTest(TimeValue.timeValueHours(24), client -> {}, client -> {}); |
| 87 | + // set the sync interval high so it does not execute during this test. This only allows the the global checkpoint to catch up |
| 88 | + // on a post-operation background sync if translog durability is set to sync. Async durability relies on a scheduled global |
| 89 | + // checkpoint sync to allow the information about persisted local checkpoints to be transferred to the primary. |
| 90 | + runGlobalCheckpointSyncTest(TimeValue.timeValueHours(24), |
| 91 | + client -> |
| 92 | + client.admin().indices().prepareUpdateSettings("test").setSettings(Settings.builder() |
| 93 | + .put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), Translog.Durability.REQUEST)).get(), |
| 94 | + client -> {}); |
88 | 95 | }
|
89 | 96 |
|
90 | 97 | /*
|
@@ -212,7 +219,7 @@ private void runGlobalCheckpointSyncTest(
|
212 | 219 | assertThat(seqNoStats.getGlobalCheckpoint(), equalTo(primarySeqNoStats.getGlobalCheckpoint()));
|
213 | 220 | }
|
214 | 221 | }
|
215 |
| - }); |
| 222 | + }, 30, TimeUnit.SECONDS); |
216 | 223 |
|
217 | 224 | for (final Thread thread : threads) {
|
218 | 225 | thread.join();
|
|
0 commit comments