46
46
import org .elasticsearch .index .shard .ShardId ;
47
47
import org .elasticsearch .indices .IndicesService ;
48
48
import org .elasticsearch .test .ESIntegTestCase ;
49
- import org .elasticsearch .test .junit .annotations .TestLogging ;
50
49
51
50
import java .io .IOException ;
52
51
import java .util .Arrays ;
53
52
import java .util .List ;
54
53
import java .util .Map ;
55
54
import java .util .concurrent .CopyOnWriteArrayList ;
56
55
import java .util .concurrent .CountDownLatch ;
57
- import java .util .concurrent .ExecutionException ;
58
56
import java .util .concurrent .atomic .AtomicBoolean ;
59
57
import java .util .concurrent .atomic .AtomicInteger ;
60
58
import java .util .stream .Collectors ;
@@ -102,7 +100,7 @@ public void onFailure(Exception e) {
102
100
}
103
101
}
104
102
105
- public void testSyncedFlush () throws ExecutionException , InterruptedException , IOException {
103
+ public void testSyncedFlush () throws Exception {
106
104
internalCluster ().ensureAtLeastNumDataNodes (2 );
107
105
prepareCreate ("test" ).setSettings (Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )).get ();
108
106
ensureGreen ();
@@ -245,13 +243,6 @@ private void indexDoc(Engine engine, String id) throws IOException {
245
243
assertThat (indexResult .getFailure (), nullValue ());
246
244
}
247
245
248
- private String syncedFlushDescription (ShardsSyncedFlushResult result ) {
249
- return result .shardResponses ().entrySet ().stream ()
250
- .map (e -> "Shard [" + e .getKey () + "], result [" + e .getValue () + "]" )
251
- .collect (Collectors .joining ("," ));
252
- }
253
-
254
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/29392" )
255
246
public void testSyncedFlushSkipOutOfSyncReplicas () throws Exception {
256
247
internalCluster ().ensureAtLeastNumDataNodes (between (2 , 3 ));
257
248
final int numberOfReplicas = internalCluster ().numDataNodes () - 1 ;
@@ -277,7 +268,6 @@ public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
277
268
indexDoc (IndexShardTestCase .getEngine (outOfSyncReplica ), "extra_" + i );
278
269
}
279
270
final ShardsSyncedFlushResult partialResult = SyncedFlushUtil .attemptSyncedFlush (internalCluster (), shardId );
280
- logger .info ("Partial seal: {}" , syncedFlushDescription (partialResult ));
281
271
assertThat (partialResult .totalShards (), equalTo (numberOfReplicas + 1 ));
282
272
assertThat (partialResult .successfulShards (), equalTo (numberOfReplicas ));
283
273
assertThat (partialResult .shardResponses ().get (outOfSyncReplica .routingEntry ()).failureReason , equalTo (
@@ -293,8 +283,6 @@ public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
293
283
assertThat (fullResult .successfulShards (), equalTo (numberOfReplicas + 1 ));
294
284
}
295
285
296
- @ TestLogging ("_root:DEBUG" )
297
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/29392" )
298
286
public void testDoNotRenewSyncedFlushWhenAllSealed () throws Exception {
299
287
internalCluster ().ensureAtLeastNumDataNodes (between (2 , 3 ));
300
288
final int numberOfReplicas = internalCluster ().numDataNodes () - 1 ;
@@ -311,11 +299,9 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
311
299
index ("test" , "doc" , Integer .toString (i ));
312
300
}
313
301
final ShardsSyncedFlushResult firstSeal = SyncedFlushUtil .attemptSyncedFlush (internalCluster (), shardId );
314
- logger .info ("First seal: {}" , syncedFlushDescription (firstSeal ));
315
302
assertThat (firstSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
316
303
// Do not renew synced-flush
317
304
final ShardsSyncedFlushResult secondSeal = SyncedFlushUtil .attemptSyncedFlush (internalCluster (), shardId );
318
- logger .info ("Second seal: {}" , syncedFlushDescription (secondSeal ));
319
305
assertThat (secondSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
320
306
assertThat (secondSeal .syncId (), equalTo (firstSeal .syncId ()));
321
307
// Shards were updated, renew synced flush.
@@ -324,7 +310,6 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
324
310
index ("test" , "doc" , Integer .toString (i ));
325
311
}
326
312
final ShardsSyncedFlushResult thirdSeal = SyncedFlushUtil .attemptSyncedFlush (internalCluster (), shardId );
327
- logger .info ("Third seal: {}" , syncedFlushDescription (thirdSeal ));
328
313
assertThat (thirdSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
329
314
assertThat (thirdSeal .syncId (), not (equalTo (firstSeal .syncId ())));
330
315
// Manually remove or change sync-id, renew synced flush.
@@ -340,7 +325,6 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
340
325
assertThat (shard .commitStats ().syncId (), nullValue ());
341
326
}
342
327
final ShardsSyncedFlushResult forthSeal = SyncedFlushUtil .attemptSyncedFlush (internalCluster (), shardId );
343
- logger .info ("Forth seal: {}" , syncedFlushDescription (forthSeal ));
344
328
assertThat (forthSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
345
329
assertThat (forthSeal .syncId (), not (equalTo (thirdSeal .syncId ())));
346
330
}
0 commit comments