Skip to content

Commit 13af50a

Browse files
committed
Enable recoveries trace log in CcrRetentionLeaseIT
Tracked #41679
1 parent 5ca06a5 commit 13af50a

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
import static org.hamcrest.Matchers.greaterThan;
8989
import static org.hamcrest.Matchers.hasSize;
9090

91-
@TestLogging(value = "org.elasticsearch.xpack.ccr:trace")
91+
@TestLogging(value = "org.elasticsearch.xpack.ccr:trace,org.elasticsearch.indices.recovery:trace")
9292
public class CcrRetentionLeaseIT extends CcrIntegTestCase {
9393

9494
public static final class RetentionLeaseRenewIntervalSettingPlugin extends Plugin {
@@ -192,7 +192,7 @@ public void testRetentionLeaseIsTakenAtTheStartOfRecovery() throws Exception {
192192
final List<ShardStats> shardsStats = getShardsStats(stats);
193193
for (int i = 0; i < numberOfShards * (1 + numberOfReplicas); i++) {
194194
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));
196196
final RetentionLease retentionLease =
197197
currentRetentionLeases.leases().iterator().next();
198198
assertThat(retentionLease.id(), equalTo(getRetentionLeaseId(followerIndex, leaderIndex)));
@@ -268,7 +268,6 @@ public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
268268

269269
}
270270

271-
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/39331")
272271
public void testRetentionLeasesAreNotBeingRenewedAfterRecoveryCompletes() throws Exception {
273272
final String leaderIndex = "leader";
274273
final int numberOfShards = randomIntBetween(1, 3);
@@ -316,7 +315,7 @@ public void testRetentionLeasesAreNotBeingRenewedAfterRecoveryCompletes() throws
316315
final List<ShardStats> shardsStats = getShardsStats(stats);
317316
for (int i = 0; i < numberOfShards * (1 + numberOfReplicas); i++) {
318317
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));
320319
final ClusterStateResponse followerIndexClusterState =
321320
followerClient().admin().cluster().prepareState().clear().setMetaData(true).setIndices(followerIndex).get();
322321
final String followerUUID = followerIndexClusterState.getState().metaData().index(followerIndex).getIndexUUID();
@@ -354,7 +353,7 @@ public void testRetentionLeasesAreNotBeingRenewedAfterRecoveryCompletes() throws
354353
continue;
355354
}
356355
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));
358357
final ClusterStateResponse followerIndexClusterState =
359358
followerClient().admin().cluster().prepareState().clear().setMetaData(true).setIndices(followerIndex).get();
360359
final String followerUUID = followerIndexClusterState.getState().metaData().index(followerIndex).getIndexUUID();
@@ -392,7 +391,7 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
392391
leaderClient().admin().indices().stats(new IndicesStatsRequest().clear().indices(leaderIndex)).actionGet();
393392
final List<ShardStats> shardsStats = getShardsStats(stats);
394393
for (final ShardStats shardStats : shardsStats) {
395-
assertThat(shardStats.getRetentionLeaseStats().retentionLeases().leases(), hasSize(1));
394+
assertThat(Strings.toString(shardStats), shardStats.getRetentionLeaseStats().retentionLeases().leases(), hasSize(1));
396395
assertThat(
397396
shardStats.getRetentionLeaseStats().retentionLeases().leases().iterator().next().id(),
398397
equalTo(retentionLeaseId));
@@ -454,7 +453,7 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
454453
leaderClient().admin().indices().stats(new IndicesStatsRequest().clear().indices(leaderIndex)).actionGet();
455454
final List<ShardStats> afterUnfollowShardsStats = getShardsStats(afterUnfollowStats);
456455
for (final ShardStats shardStats : afterUnfollowShardsStats) {
457-
assertThat(shardStats.getRetentionLeaseStats().retentionLeases().leases(), empty());
456+
assertThat(Strings.toString(shardStats), shardStats.getRetentionLeaseStats().retentionLeases().leases(), empty());
458457
}
459458
} finally {
460459
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getDataNodes().values()) {
@@ -605,7 +604,7 @@ public void testRetentionLeaseAdvancesWhileFollowing() throws Exception {
605604
final List<ShardStats> shardsStats = getShardsStats(stats);
606605
for (int i = 0; i < numberOfShards * (1 + numberOfReplicas); i++) {
607606
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));
609608
final RetentionLease retentionLease =
610609
currentRetentionLeases.leases().iterator().next();
611610
assertThat(retentionLease.id(), equalTo(getRetentionLeaseId(followerIndex, leaderIndex)));
@@ -668,7 +667,7 @@ public void testRetentionLeaseRenewalIsCancelledWhenFollowingIsPaused() throws E
668667
final List<ShardStats> shardsStats = getShardsStats(stats);
669668
for (int i = 0; i < numberOfShards * (1 + numberOfReplicas); i++) {
670669
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));
672671
final ClusterStateResponse followerIndexClusterState =
673672
followerClient().admin().cluster().prepareState().clear().setMetaData(true).setIndices(followerIndex).get();
674673
final String followerUUID = followerIndexClusterState.getState().metaData().index(followerIndex).getIndexUUID();
@@ -706,7 +705,7 @@ public void testRetentionLeaseRenewalIsCancelledWhenFollowingIsPaused() throws E
706705
continue;
707706
}
708707
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));
710709
final ClusterStateResponse followerIndexClusterState =
711710
followerClient().admin().cluster().prepareState().clear().setMetaData(true).setIndices(followerIndex).get();
712711
final String followerUUID = followerIndexClusterState.getState().metaData().index(followerIndex).getIndexUUID();
@@ -912,7 +911,7 @@ public void onResponseReceived(
912911
leaderClient().admin().indices().stats(new IndicesStatsRequest().clear().indices(leaderIndex)).actionGet();
913912
final List<ShardStats> afterUnfollowShardsStats = getShardsStats(afterUnfollowStats);
914913
for (final ShardStats shardStats : afterUnfollowShardsStats) {
915-
assertThat(shardStats.getRetentionLeaseStats().retentionLeases().leases(), empty());
914+
assertThat(Strings.toString(shardStats), shardStats.getRetentionLeaseStats().retentionLeases().leases(), empty());
916915
}
917916
} finally {
918917
for (final ObjectCursor<DiscoveryNode> senderNode : followerClusterState.getState().nodes().getDataNodes().values()) {
@@ -962,7 +961,7 @@ public void testForgetFollower() throws Exception {
962961
leaderClient().admin().indices().stats(new IndicesStatsRequest().clear().indices(leaderIndex)).actionGet();
963962
final List<ShardStats> afterForgetFollowerShardsStats = getShardsStats(afterForgetFollowerStats);
964963
for (final ShardStats shardStats : afterForgetFollowerShardsStats) {
965-
assertThat(shardStats.getRetentionLeaseStats().retentionLeases().leases(), empty());
964+
assertThat(Strings.toString(shardStats), shardStats.getRetentionLeaseStats().retentionLeases().leases(), empty());
966965
}
967966
}
968967

@@ -982,7 +981,7 @@ private void assertRetentionLeaseRenewal(
982981
final List<ShardStats> shardsStats = getShardsStats(stats);
983982
for (int i = 0; i < numberOfShards * (1 + numberOfReplicas); i++) {
984983
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));
986985
final RetentionLease retentionLease =
987986
currentRetentionLeases.leases().iterator().next();
988987
assertThat(retentionLease.id(), equalTo(getRetentionLeaseId(followerIndex, leaderIndex)));
@@ -999,7 +998,7 @@ private void assertRetentionLeaseRenewal(
999998
final List<ShardStats> shardsStats = getShardsStats(stats);
1000999
for (int i = 0; i < numberOfShards * (1 + numberOfReplicas); i++) {
10011000
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));
10031002
final RetentionLease retentionLease =
10041003
currentRetentionLeases.leases().iterator().next();
10051004
assertThat(retentionLease.id(), equalTo(getRetentionLeaseId(followerIndex, leaderIndex)));

0 commit comments

Comments
 (0)