[CCR] Always remove persistent tasks metadata between tests and
better handle assertion errors between tests.
@@ -32,6 +32,7 @@ import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.index.Index;
import org.elasticsearch.indices.store.IndicesStore;
import org.elasticsearch.license.LicenseService;
+import org.elasticsearch.persistent.PersistentTasksCustomMetaData;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.test.ESIntegTestCase;
@@ -110,12 +111,13 @@ public abstract class CCRIntegTestCase extends ESTestCase {
ClusterService clusterService = clusterGroup.followerCluster.getInstance(ClusterService.class, masterNode);
CountDownLatch latch = new CountDownLatch(1);
- clusterService.submitStateUpdateTask("", new ClusterStateUpdateTask() {
+ clusterService.submitStateUpdateTask("purge-cluster-state", new ClusterStateUpdateTask() {
@Override
public ClusterState execute(ClusterState currentState) throws Exception {
ClusterState.Builder newState = ClusterState.builder(currentState);
newState.metaData(MetaData.builder(currentState.getMetaData())
.removeCustom(AutoFollowMetadata.TYPE)
+ .removeCustom(PersistentTasksCustomMetaData.TYPE)
.build());
return newState.build();
}
@@ -132,18 +134,21 @@ public abstract class CCRIntegTestCase extends ESTestCase {
});
latch.await();
+ try {
clusterGroup.leaderCluster.beforeIndexDeletion();
clusterGroup.leaderCluster.assertSeqNos();
clusterGroup.leaderCluster.assertSameDocIdsOnShards();
clusterGroup.leaderCluster.assertConsistentHistoryBetweenTranslogAndLuceneIndex();
- clusterGroup.leaderCluster.wipe(Collections.emptySet());
clusterGroup.followerCluster.beforeIndexDeletion();
clusterGroup.followerCluster.assertSeqNos();
clusterGroup.followerCluster.assertSameDocIdsOnShards();
clusterGroup.followerCluster.assertConsistentHistoryBetweenTranslogAndLuceneIndex();
+ } finally {
+ clusterGroup.leaderCluster.wipe(Collections.emptySet());
clusterGroup.followerCluster.wipe(Collections.emptySet());
}
+ }
private NodeConfigurationSource createNodeConfigurationSource() {
Settings.Builder builder = Settings.builder();
