4646import org .elasticsearch .index .shard .ShardId ;
4747import org .elasticsearch .indices .IndicesService ;
4848import org .elasticsearch .test .ESIntegTestCase ;
49- import org .elasticsearch .test .junit .annotations .TestLogging ;
5049
5150import java .io .IOException ;
5251import java .util .Arrays ;
5352import java .util .List ;
54- import java .util .Locale ;
5553import java .util .Map ;
5654import java .util .concurrent .CopyOnWriteArrayList ;
5755import java .util .concurrent .CountDownLatch ;
58- import java .util .concurrent .ExecutionException ;
5956import java .util .concurrent .atomic .AtomicBoolean ;
6057import java .util .concurrent .atomic .AtomicInteger ;
6158import java .util .stream .Collectors ;
@@ -103,7 +100,7 @@ public void onFailure(Exception e) {
103100 }
104101 }
105102
106- public void testSyncedFlush () throws ExecutionException , InterruptedException , IOException {
103+ public void testSyncedFlush () throws Exception {
107104 internalCluster ().ensureAtLeastNumDataNodes (2 );
108105 prepareCreate ("test" ).setSettings (Settings .builder ().put (IndexMetaData .SETTING_NUMBER_OF_SHARDS , 1 )).get ();
109106 ensureGreen ();
@@ -246,16 +243,6 @@ private void indexDoc(Engine engine, String id) throws IOException {
246243 assertThat (indexResult .getFailure (), nullValue ());
247244 }
248245
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" )
259246 public void testSyncedFlushSkipOutOfSyncReplicas () throws Exception {
260247 internalCluster ().ensureAtLeastNumDataNodes (between (2 , 3 ));
261248 final int numberOfReplicas = internalCluster ().numDataNodes () - 1 ;
@@ -281,7 +268,6 @@ public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
281268 indexDoc (IndexShardTestCase .getEngine (outOfSyncReplica ), "extra_" + i );
282269 }
283270 final ShardsSyncedFlushResult partialResult = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
284- logger .info ("Partial seal: {}" , syncedFlushDescription (partialResult ));
285271 assertThat (partialResult .totalShards (), equalTo (numberOfReplicas + 1 ));
286272 assertThat (partialResult .successfulShards (), equalTo (numberOfReplicas ));
287273 assertThat (partialResult .shardResponses ().get (outOfSyncReplica .routingEntry ()).failureReason , equalTo (
@@ -297,8 +283,6 @@ public void testSyncedFlushSkipOutOfSyncReplicas() throws Exception {
297283 assertThat (fullResult .successfulShards (), equalTo (numberOfReplicas + 1 ));
298284 }
299285
300- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/29392" )
301- @ TestLogging ("_root:DEBUG,org.elasticsearch.indices.flush:TRACE" )
302286 public void testDoNotRenewSyncedFlushWhenAllSealed () throws Exception {
303287 internalCluster ().ensureAtLeastNumDataNodes (between (2 , 3 ));
304288 final int numberOfReplicas = internalCluster ().numDataNodes () - 1 ;
@@ -315,11 +299,9 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
315299 index ("test" , "doc" , Integer .toString (i ));
316300 }
317301 final ShardsSyncedFlushResult firstSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
318- logger .info ("First seal: {}" , syncedFlushDescription (firstSeal ));
319302 assertThat (firstSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
320303 // Do not renew synced-flush
321304 final ShardsSyncedFlushResult secondSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
322- logger .info ("Second seal: {}" , syncedFlushDescription (secondSeal ));
323305 assertThat (secondSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
324306 assertThat (secondSeal .syncId (), equalTo (firstSeal .syncId ()));
325307 // Shards were updated, renew synced flush.
@@ -328,7 +310,6 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
328310 index ("test" , "doc" , Integer .toString (i ));
329311 }
330312 final ShardsSyncedFlushResult thirdSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
331- logger .info ("Third seal: {}" , syncedFlushDescription (thirdSeal ));
332313 assertThat (thirdSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
333314 assertThat (thirdSeal .syncId (), not (equalTo (firstSeal .syncId ())));
334315 // Manually remove or change sync-id, renew synced flush.
@@ -344,7 +325,6 @@ public void testDoNotRenewSyncedFlushWhenAllSealed() throws Exception {
344325 assertThat (shard .commitStats ().syncId (), nullValue ());
345326 }
346327 final ShardsSyncedFlushResult forthSeal = SyncedFlushUtil .attemptSyncedFlush (logger , internalCluster (), shardId );
347- logger .info ("Forth seal: {}" , syncedFlushDescription (forthSeal ));
348328 assertThat (forthSeal .successfulShards (), equalTo (numberOfReplicas + 1 ));
349329 assertThat (forthSeal .syncId (), not (equalTo (thirdSeal .syncId ())));
350330 }
0 commit comments