re-enabled test with added logging to have more info when it fails.
This commit is contained in:
parent
ca916f7186
commit
38a1d4fcdb
|
@ -20,6 +20,7 @@
|
||||||
package org.elasticsearch.client;
|
package org.elasticsearch.client;
|
||||||
|
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.apache.logging.log4j.message.ParameterizedMessage;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
|
||||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
|
||||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||||
|
@ -36,6 +37,7 @@ import org.elasticsearch.client.ccr.FollowStatsRequest;
|
||||||
import org.elasticsearch.client.ccr.FollowStatsResponse;
|
import org.elasticsearch.client.ccr.FollowStatsResponse;
|
||||||
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
|
import org.elasticsearch.client.ccr.GetAutoFollowPatternRequest;
|
||||||
import org.elasticsearch.client.ccr.GetAutoFollowPatternResponse;
|
import org.elasticsearch.client.ccr.GetAutoFollowPatternResponse;
|
||||||
|
import org.elasticsearch.client.ccr.IndicesFollowStats;
|
||||||
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
|
import org.elasticsearch.client.ccr.IndicesFollowStats.ShardFollowStats;
|
||||||
import org.elasticsearch.client.ccr.PauseFollowRequest;
|
import org.elasticsearch.client.ccr.PauseFollowRequest;
|
||||||
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
|
import org.elasticsearch.client.ccr.PutAutoFollowPatternRequest;
|
||||||
|
@ -85,7 +87,6 @@ public class CCRIT extends ESRestHighLevelClientTestCase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/36339")
|
|
||||||
public void testIndexFollowing() throws Exception {
|
public void testIndexFollowing() throws Exception {
|
||||||
CcrClient ccrClient = highLevelClient().ccr();
|
CcrClient ccrClient = highLevelClient().ccr();
|
||||||
|
|
||||||
|
@ -109,21 +110,33 @@ public class CCRIT extends ESRestHighLevelClientTestCase {
|
||||||
SearchResponse leaderSearchResponse = highLevelClient().search(leaderSearchRequest, RequestOptions.DEFAULT);
|
SearchResponse leaderSearchResponse = highLevelClient().search(leaderSearchRequest, RequestOptions.DEFAULT);
|
||||||
assertThat(leaderSearchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(leaderSearchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
|
|
||||||
assertBusy(() -> {
|
try {
|
||||||
FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
|
assertBusy(() -> {
|
||||||
FollowStatsResponse followStatsResponse =
|
FollowStatsRequest followStatsRequest = new FollowStatsRequest("follower");
|
||||||
execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
|
FollowStatsResponse followStatsResponse =
|
||||||
List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
|
execute(followStatsRequest, ccrClient::getFollowStats, ccrClient::getFollowStatsAsync);
|
||||||
long followerGlobalCheckpoint = shardFollowStats.stream()
|
List<ShardFollowStats> shardFollowStats = followStatsResponse.getIndicesFollowStats().getShardFollowStats("follower");
|
||||||
.mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
|
long followerGlobalCheckpoint = shardFollowStats.stream()
|
||||||
.max()
|
.mapToLong(ShardFollowStats::getFollowerGlobalCheckpoint)
|
||||||
.getAsLong();
|
.max()
|
||||||
assertThat(followerGlobalCheckpoint, equalTo(0L));
|
.getAsLong();
|
||||||
|
assertThat(followerGlobalCheckpoint, equalTo(0L));
|
||||||
|
|
||||||
SearchRequest followerSearchRequest = new SearchRequest("follower");
|
SearchRequest followerSearchRequest = new SearchRequest("follower");
|
||||||
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
|
SearchResponse followerSearchResponse = highLevelClient().search(followerSearchRequest, RequestOptions.DEFAULT);
|
||||||
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(followerSearchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
});
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
IndicesFollowStats followStats = ccrClient.getCcrStats(new CcrStatsRequest(), RequestOptions.DEFAULT).getIndicesFollowStats();
|
||||||
|
for (Map.Entry<String, List<ShardFollowStats>> entry : followStats.getShardFollowStats().entrySet()) {
|
||||||
|
for (ShardFollowStats shardFollowStats : entry.getValue()) {
|
||||||
|
if (shardFollowStats.getFatalException() != null) {
|
||||||
|
logger.warn(new ParameterizedMessage("fatal shard follow exception {}", shardFollowStats.getShardId()),
|
||||||
|
shardFollowStats.getFatalException());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
|
PauseFollowRequest pauseFollowRequest = new PauseFollowRequest("follower");
|
||||||
AcknowledgedResponse pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);
|
AcknowledgedResponse pauseFollowResponse = execute(pauseFollowRequest, ccrClient::pauseFollow, ccrClient::pauseFollowAsync);
|
||||||
|
|
Loading…
Reference in New Issue