88
88
import static org .hamcrest .Matchers .greaterThan ;
89
89
import static org .hamcrest .Matchers .hasSize ;
90
90
91
- @ TestLogging (value = "org.elasticsearch.xpack.ccr:trace" )
91
+ @ TestLogging (value = "org.elasticsearch.xpack.ccr:trace,org.elasticsearch.indices.recovery:trace " )
92
92
public class CcrRetentionLeaseIT extends CcrIntegTestCase {
93
93
94
94
public static final class RetentionLeaseRenewIntervalSettingPlugin extends Plugin {
@@ -192,7 +192,7 @@ public void testRetentionLeaseIsTakenAtTheStartOfRecovery() throws Exception {
192
192
final List <ShardStats > shardsStats = getShardsStats (stats );
193
193
for (int i = 0 ; i < numberOfShards * (1 + numberOfReplicas ); i ++) {
194
194
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
195
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
195
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
196
196
final RetentionLease retentionLease =
197
197
currentRetentionLeases .leases ().iterator ().next ();
198
198
assertThat (retentionLease .id (), equalTo (getRetentionLeaseId (followerIndex , leaderIndex )));
@@ -268,7 +268,6 @@ public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
268
268
269
269
}
270
270
271
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/39331" )
272
271
public void testRetentionLeasesAreNotBeingRenewedAfterRecoveryCompletes () throws Exception {
273
272
final String leaderIndex = "leader" ;
274
273
final int numberOfShards = randomIntBetween (1 , 3 );
@@ -316,7 +315,7 @@ public void testRetentionLeasesAreNotBeingRenewedAfterRecoveryCompletes() throws
316
315
final List <ShardStats > shardsStats = getShardsStats (stats );
317
316
for (int i = 0 ; i < numberOfShards * (1 + numberOfReplicas ); i ++) {
318
317
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
319
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
318
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
320
319
final ClusterStateResponse followerIndexClusterState =
321
320
followerClient ().admin ().cluster ().prepareState ().clear ().setMetaData (true ).setIndices (followerIndex ).get ();
322
321
final String followerUUID = followerIndexClusterState .getState ().metaData ().index (followerIndex ).getIndexUUID ();
@@ -354,7 +353,7 @@ public void testRetentionLeasesAreNotBeingRenewedAfterRecoveryCompletes() throws
354
353
continue ;
355
354
}
356
355
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
357
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
356
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
358
357
final ClusterStateResponse followerIndexClusterState =
359
358
followerClient ().admin ().cluster ().prepareState ().clear ().setMetaData (true ).setIndices (followerIndex ).get ();
360
359
final String followerUUID = followerIndexClusterState .getState ().metaData ().index (followerIndex ).getIndexUUID ();
@@ -392,7 +391,7 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
392
391
leaderClient ().admin ().indices ().stats (new IndicesStatsRequest ().clear ().indices (leaderIndex )).actionGet ();
393
392
final List <ShardStats > shardsStats = getShardsStats (stats );
394
393
for (final ShardStats shardStats : shardsStats ) {
395
- assertThat (shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), hasSize (1 ));
394
+ assertThat (Strings . toString ( shardStats ), shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), hasSize (1 ));
396
395
assertThat (
397
396
shardStats .getRetentionLeaseStats ().retentionLeases ().leases ().iterator ().next ().id (),
398
397
equalTo (retentionLeaseId ));
@@ -454,7 +453,7 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
454
453
leaderClient ().admin ().indices ().stats (new IndicesStatsRequest ().clear ().indices (leaderIndex )).actionGet ();
455
454
final List <ShardStats > afterUnfollowShardsStats = getShardsStats (afterUnfollowStats );
456
455
for (final ShardStats shardStats : afterUnfollowShardsStats ) {
457
- assertThat (shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), empty ());
456
+ assertThat (Strings . toString ( shardStats ), shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), empty ());
458
457
}
459
458
} finally {
460
459
for (final ObjectCursor <DiscoveryNode > senderNode : followerClusterState .getState ().nodes ().getDataNodes ().values ()) {
@@ -605,7 +604,7 @@ public void testRetentionLeaseAdvancesWhileFollowing() throws Exception {
605
604
final List <ShardStats > shardsStats = getShardsStats (stats );
606
605
for (int i = 0 ; i < numberOfShards * (1 + numberOfReplicas ); i ++) {
607
606
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
608
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
607
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
609
608
final RetentionLease retentionLease =
610
609
currentRetentionLeases .leases ().iterator ().next ();
611
610
assertThat (retentionLease .id (), equalTo (getRetentionLeaseId (followerIndex , leaderIndex )));
@@ -668,7 +667,7 @@ public void testRetentionLeaseRenewalIsCancelledWhenFollowingIsPaused() throws E
668
667
final List <ShardStats > shardsStats = getShardsStats (stats );
669
668
for (int i = 0 ; i < numberOfShards * (1 + numberOfReplicas ); i ++) {
670
669
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
671
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
670
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
672
671
final ClusterStateResponse followerIndexClusterState =
673
672
followerClient ().admin ().cluster ().prepareState ().clear ().setMetaData (true ).setIndices (followerIndex ).get ();
674
673
final String followerUUID = followerIndexClusterState .getState ().metaData ().index (followerIndex ).getIndexUUID ();
@@ -706,7 +705,7 @@ public void testRetentionLeaseRenewalIsCancelledWhenFollowingIsPaused() throws E
706
705
continue ;
707
706
}
708
707
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
709
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
708
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
710
709
final ClusterStateResponse followerIndexClusterState =
711
710
followerClient ().admin ().cluster ().prepareState ().clear ().setMetaData (true ).setIndices (followerIndex ).get ();
712
711
final String followerUUID = followerIndexClusterState .getState ().metaData ().index (followerIndex ).getIndexUUID ();
@@ -912,7 +911,7 @@ public void onResponseReceived(
912
911
leaderClient ().admin ().indices ().stats (new IndicesStatsRequest ().clear ().indices (leaderIndex )).actionGet ();
913
912
final List <ShardStats > afterUnfollowShardsStats = getShardsStats (afterUnfollowStats );
914
913
for (final ShardStats shardStats : afterUnfollowShardsStats ) {
915
- assertThat (shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), empty ());
914
+ assertThat (Strings . toString ( shardStats ), shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), empty ());
916
915
}
917
916
} finally {
918
917
for (final ObjectCursor <DiscoveryNode > senderNode : followerClusterState .getState ().nodes ().getDataNodes ().values ()) {
@@ -962,7 +961,7 @@ public void testForgetFollower() throws Exception {
962
961
leaderClient ().admin ().indices ().stats (new IndicesStatsRequest ().clear ().indices (leaderIndex )).actionGet ();
963
962
final List <ShardStats > afterForgetFollowerShardsStats = getShardsStats (afterForgetFollowerStats );
964
963
for (final ShardStats shardStats : afterForgetFollowerShardsStats ) {
965
- assertThat (shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), empty ());
964
+ assertThat (Strings . toString ( shardStats ), shardStats .getRetentionLeaseStats ().retentionLeases ().leases (), empty ());
966
965
}
967
966
}
968
967
@@ -982,7 +981,7 @@ private void assertRetentionLeaseRenewal(
982
981
final List <ShardStats > shardsStats = getShardsStats (stats );
983
982
for (int i = 0 ; i < numberOfShards * (1 + numberOfReplicas ); i ++) {
984
983
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
985
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
984
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
986
985
final RetentionLease retentionLease =
987
986
currentRetentionLeases .leases ().iterator ().next ();
988
987
assertThat (retentionLease .id (), equalTo (getRetentionLeaseId (followerIndex , leaderIndex )));
@@ -999,7 +998,7 @@ private void assertRetentionLeaseRenewal(
999
998
final List <ShardStats > shardsStats = getShardsStats (stats );
1000
999
for (int i = 0 ; i < numberOfShards * (1 + numberOfReplicas ); i ++) {
1001
1000
final RetentionLeases currentRetentionLeases = shardsStats .get (i ).getRetentionLeaseStats ().retentionLeases ();
1002
- assertThat (currentRetentionLeases .leases (), hasSize (1 ));
1001
+ assertThat (Strings . toString ( shardsStats . get ( i )), currentRetentionLeases .leases (), hasSize (1 ));
1003
1002
final RetentionLease retentionLease =
1004
1003
currentRetentionLeases .leases ().iterator ().next ();
1005
1004
assertThat (retentionLease .id (), equalTo (getRetentionLeaseId (followerIndex , leaderIndex )));
0 commit comments