parent
abe35fb99b
commit
de852765d6
|
@ -563,9 +563,11 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
|||
clusterService.submitStateUpdateTask("remove-ccr-related-metadata", new ClusterStateUpdateTask() {
|
||||
@Override
|
||||
public ClusterState execute(ClusterState currentState) throws Exception {
|
||||
AutoFollowMetadata empty =
|
||||
new AutoFollowMetadata(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap());
|
||||
ClusterState.Builder newState = ClusterState.builder(currentState);
|
||||
newState.metaData(MetaData.builder(currentState.getMetaData())
|
||||
.removeCustom(AutoFollowMetadata.TYPE)
|
||||
.putCustom(AutoFollowMetadata.TYPE, empty)
|
||||
.removeCustom(PersistentTasksCustomMetaData.TYPE)
|
||||
.build());
|
||||
return newState.build();
|
||||
|
|
|
@ -18,7 +18,9 @@ import org.elasticsearch.transport.TransportService;
|
|||
import org.elasticsearch.xpack.ccr.CcrSettings;
|
||||
import org.elasticsearch.xpack.ccr.LocalStateCcr;
|
||||
import org.elasticsearch.xpack.core.XPackSettings;
|
||||
import org.elasticsearch.xpack.core.ccr.AutoFollowStats;
|
||||
import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus;
|
||||
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;
|
||||
import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction;
|
||||
import org.elasticsearch.xpack.core.ccr.action.PutFollowAction;
|
||||
import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction;
|
||||
|
@ -79,6 +81,10 @@ public abstract class CcrSingleNodeTestCase extends ESSingleNodeTestCase {
|
|||
assertAcked(client().admin().cluster().updateSettings(updateSettingsRequest).actionGet());
|
||||
}
|
||||
|
||||
protected AutoFollowStats getAutoFollowStats() {
|
||||
return client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet().getAutoFollowStats();
|
||||
}
|
||||
|
||||
protected ResumeFollowAction.Request getResumeFollowRequest(String followerIndex) {
|
||||
ResumeFollowAction.Request request = new ResumeFollowAction.Request();
|
||||
request.setFollowerIndex(followerIndex);
|
||||
|
|
|
@ -92,7 +92,6 @@ public class LocalIndexFollowingIT extends CcrSingleNodeTestCase {
|
|||
assertThat(client().admin().indices().prepareExists("follower-index").get().isExists(), equalTo(false));
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/37014")
|
||||
public void testRemoveRemoteConnection() throws Exception {
|
||||
PutAutoFollowPatternAction.Request request = new PutAutoFollowPatternAction.Request();
|
||||
request.setName("my_pattern");
|
||||
|
@ -101,6 +100,7 @@ public class LocalIndexFollowingIT extends CcrSingleNodeTestCase {
|
|||
request.setFollowIndexNamePattern("copy-{{leader_index}}");
|
||||
request.setReadPollTimeout(TimeValue.timeValueMillis(10));
|
||||
assertTrue(client().execute(PutAutoFollowPatternAction.INSTANCE, request).actionGet().isAcknowledged());
|
||||
long previousNumberOfSuccessfulFollowedIndices = getAutoFollowStats().getNumberOfSuccessfulFollowIndices();
|
||||
|
||||
Settings leaderIndexSettings = Settings.builder()
|
||||
.put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), true)
|
||||
|
@ -111,7 +111,8 @@ public class LocalIndexFollowingIT extends CcrSingleNodeTestCase {
|
|||
client().prepareIndex("logs-20200101", "doc").setSource("{}", XContentType.JSON).get();
|
||||
assertBusy(() -> {
|
||||
CcrStatsAction.Response response = client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet();
|
||||
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(), equalTo(1L));
|
||||
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(),
|
||||
equalTo(previousNumberOfSuccessfulFollowedIndices + 1));
|
||||
assertThat(response.getFollowStats().getStatsResponses().size(), equalTo(1));
|
||||
assertThat(response.getFollowStats().getStatsResponses().get(0).status().followerGlobalCheckpoint(), equalTo(0L));
|
||||
});
|
||||
|
@ -127,7 +128,8 @@ public class LocalIndexFollowingIT extends CcrSingleNodeTestCase {
|
|||
client().prepareIndex("logs-20200101", "doc").setSource("{}", XContentType.JSON).get();
|
||||
assertBusy(() -> {
|
||||
CcrStatsAction.Response response = client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.Request()).actionGet();
|
||||
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(), equalTo(2L));
|
||||
assertThat(response.getAutoFollowStats().getNumberOfSuccessfulFollowIndices(),
|
||||
equalTo(previousNumberOfSuccessfulFollowedIndices + 2));
|
||||
|
||||
FollowStatsAction.StatsRequest statsRequest = new FollowStatsAction.StatsRequest();
|
||||
statsRequest.setIndices(new String[]{"copy-logs-20200101"});
|
||||
|
|
Loading…
Reference in New Issue