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
- import java .util .Locale ;
55
53
import java .util .Map ;
56
54
import java .util .concurrent .CopyOnWriteArrayList ;
57
55
import java .util .concurrent .CountDownLatch ;
58
- import java .util .concurrent .ExecutionException ;
59
56
import java .util .concurrent .atomic .AtomicBoolean ;
60
57
import java .util .concurrent .atomic .AtomicInteger ;
61
58
import java .util .stream .Collectors ;
@@ -103,7 +100,7 @@ public void onFailure(Exception e) {
103
100
}
104
101
}
105
102
106
- public void testSyncedFlush () throws ExecutionException , InterruptedException , IOException {
103
+ public void testSyncedFlush () throws Exception {
107
104
internalCluster ().ensureAtLeastNumDataNodes (2 );
108
105
prepareCreate ("test" ).setSettings (Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )).get ();
109
106
ensureGreen ();
@@ -246,16 +243,6 @@ private void indexDoc(Engine engine, String id) throws IOException {
246
243
assertThat (indexResult .getFailure (), nullValue ());
247
244
}
248
245
249
- private String syncedFlushDescription (ShardsSyncedFlushResult result ) {
250
- String detail = result .shardResponses ().entrySet ().stream ()
251
- .map (e -> "Shard [" + e .getKey () + "], result [" + e .getValue () + "]" )
252
- .collect (Collectors .joining ("," ));
253
- return String .format (Locale .ROOT , "Total shards: [%d], failed: [%s], reason: [%s], detail: [%s]" ,
254
- result .totalShards (), result .failed (), result .failureReason (), detail );
255
- }
256
-
257
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/29392" )
258
- @ TestLogging ("_root:DEBUG,org.elasticsearch.indices.flush:TRACE" )
259
246
public void testSyncedFlushSkipOutOfSyncReplicas () throws Exception {
260
247
internalCluster ().ensureAtLeastNumDataNodes (between (2 , 3 ));
261
248
final int numberOfReplicas = internalCluster ().numDataNodes () - 1 ;
@@ -281,7 +268,6 @@ public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
281
268
indexDoc (IndexShardTestCase .getEngine (outOfSyncReplica ), "extra_" + i );
282
269
}
283
270
final ShardsSyncedFlushResult partialResult = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
284
- logger .info ("Partial seal: {}" , syncedFlushDescription (partialResult ));
285
271
assertThat (partialResult .totalShards (), equalTo (numberOfReplicas + 1 ));
286
272
assertThat (partialResult .successfulShards (), equalTo (numberOfReplicas ));
287
273
assertThat (partialResult .shardResponses ().get (outOfSyncReplica .routingEntry ()).failureReason , equalTo (
@@ -297,8 +283,6 @@ public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
297
283
assertThat (fullResult .successfulShards (), equalTo (numberOfReplicas + 1 ));
298
284
}
299
285
300
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/29392" )
301
- @ TestLogging ("_root:DEBUG,org.elasticsearch.indices.flush:TRACE" )
302
286
public void testDoNotRenewSyncedFlushWhenAllSealed () throws Exception {
303
287
internalCluster ().ensureAtLeastNumDataNodes (between (2 , 3 ));
304
288
final int numberOfReplicas = internalCluster ().numDataNodes () - 1 ;
@@ -315,11 +299,9 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
315
299
index ("test" , "doc" , Integer .toString (i ));
316
300
}
317
301
final ShardsSyncedFlushResult firstSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
318
- logger .info ("First seal: {}" , syncedFlushDescription (firstSeal ));
319
302
assertThat (firstSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
320
303
// Do not renew synced-flush
321
304
final ShardsSyncedFlushResult secondSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
322
- logger .info ("Second seal: {}" , syncedFlushDescription (secondSeal ));
323
305
assertThat (secondSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
324
306
assertThat (secondSeal .syncId (), equalTo (firstSeal .syncId ()));
325
307
// Shards were updated, renew synced flush.
@@ -328,7 +310,6 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
328
310
index ("test" , "doc" , Integer .toString (i ));
329
311
}
330
312
final ShardsSyncedFlushResult thirdSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
331
- logger .info ("Third seal: {}" , syncedFlushDescription (thirdSeal ));
332
313
assertThat (thirdSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
333
314
assertThat (thirdSeal .syncId (), not (equalTo (firstSeal .syncId ())));
334
315
// Manually remove or change sync-id, renew synced flush.
@@ -344,7 +325,6 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
344
325
assertThat (shard .commitStats ().syncId (), nullValue ());
345
326
}
346
327
final ShardsSyncedFlushResult forthSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
347
- logger .info ("Forth seal: {}" , syncedFlushDescription (forthSeal ));
348
328
assertThat (forthSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
349
329
assertThat (forthSeal .syncId (), not (equalTo (thirdSeal .syncId ())));
350
330
}
0 commit comments