Skip to content

Commit 38a1d4f

Browse files
committed
re-enabled test with added logging to have more info when it fails.
1 parent ca916f7 commit 38a1d4f

File tree

1 file changed

+29
-16
lines changed
  • client/rest-high-level/src/test/java/org/elasticsearch/client

1 file changed

+29
-16
lines changed

client/rest-high-level/src/test/java/org/elasticsearch/client/CCRIT.java

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.client;
2121

2222
import org.apache.http.util.EntityUtils;
23+
import org.apache.logging.log4j.message.ParameterizedMessage;
2324
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
2425
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
2526
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
@@ -36,6 +37,7 @@
3637
import org.elasticsearch.client.ccr.FollowStatsResponse;
3738
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
3839
import org.elasticsearch.client.ccr.GetAutoFollowPatternResponse;
40+
import org.elasticsearch.client.ccr.IndicesFollowStats;
3941
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
4042
import org.elasticsearch.client.ccr.PauseFollowRequest;
4143
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
@@ -85,7 +87,6 @@ public void setupRemoteClusterConfig() throws Exception {
8587
});
8688
}
8789

88-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/36339")
8990
public void testIndexFollowing() throws Exception {
9091
CcrClient ccrClient = highLevelClient().ccr();
9192

@@ -109,21 +110,33 @@ public void testIndexFollowing() throws Exception {
109110
SearchResponse leaderSearchResponse = highLevelClient().search(leaderSearchRequest, RequestOptions.DEFAULT);
110111
assertThat(leaderSearchResponse.getHits().getTotalHits().value, equalTo(1L));
111112

112-
assertBusy(() -> {
113-
FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
114-
FollowStatsResponse followStatsResponse =
115-
execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
116-
List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
117-
long followerGlobalCheckpoint = shardFollowStats.stream()
118-
.mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
119-
.max()
120-
.getAsLong();
121-
assertThat(followerGlobalCheckpoint, equalTo(0L));
122-
123-
SearchRequest followerSearchRequest = new SearchRequest("follower");
124-
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
125-
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
126-
});
113+
try {
114+
assertBusy(() -> {
115+
FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
116+
FollowStatsResponse followStatsResponse =
117+
execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
118+
List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
119+
long followerGlobalCheckpoint = shardFollowStats.stream()
120+
.mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
121+
.max()
122+
.getAsLong();
123+
assertThat(followerGlobalCheckpoint, equalTo(0L));
124+
125+
SearchRequest followerSearchRequest = new SearchRequest("follower");
126+
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
127+
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
128+
});
129+
} catch (Exception e) {
130+
IndicesFollowStats followStats = ccrClient.getCcrStats(new CcrStatsRequest(), RequestOptions.DEFAULT).getIndicesFollowStats();
131+
for (Map.Entry<String, List<ShardFollowStats>> entry : followStats.getShardFollowStats().entrySet()) {
132+
for (ShardFollowStats shardFollowStats : entry.getValue()) {
133+
if (shardFollowStats.getFatalException() != null) {
134+
logger.warn(new ParameterizedMessage("fatal shard follow exception {}", shardFollowStats.getShardId()),
135+
shardFollowStats.getFatalException());
136+
}
137+
}
138+
}
139+
}
127140

128141
PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
129142
AcknowledgedResponse pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);

0 commit comments

Comments
 (0)