[Zen2] Hide not recovered state (#36224)

This commit hides ClusterStates that have a STATE_NOT_RECOVERED_BLOCK from
ClusterStateAppliers. This is needed, because some appliers, such as IngestService, rely on
the fact, that cluster states with STATE_NOT_RECOVERED_BLOCK won't contain anything useful.
Once the state is recovered it's fully available for the appliers. This commit also switches many of
the remaining tests that require state persistence/recovery from Zen1 to Zen2.
This commit is contained in:
Andrey Ershov 2018-12-05 23:11:20 +01:00 committed by Yannick Welsch
parent cc11953724
commit 5d6602120f
16 changed files with 101 additions and 95 deletions

View File

@ -30,7 +30,6 @@ import org.elasticsearch.script.MockScriptEngine;
import org.elasticsearch.script.MockScriptPlugin; import org.elasticsearch.script.MockScriptPlugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -46,13 +45,6 @@ import static org.hamcrest.Matchers.equalTo;
@ESIntegTestCase.ClusterScope(numDataNodes = 0, numClientNodes = 0, scope = ESIntegTestCase.Scope.TEST) @ESIntegTestCase.ClusterScope(numDataNodes = 0, numClientNodes = 0, scope = ESIntegTestCase.Scope.TEST)
public class IngestRestartIT extends ESIntegTestCase { public class IngestRestartIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence yet
.build();
}
@Override @Override
protected Collection<Class<? extends Plugin>> nodePlugins() { protected Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(IngestCommonPlugin.class, CustomScriptPlugin.class); return Arrays.asList(IngestCommonPlugin.class, CustomScriptPlugin.class);

View File

@ -81,6 +81,7 @@ import java.util.stream.StreamSupport;
import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentSet; import static org.elasticsearch.common.util.concurrent.ConcurrentCollections.newConcurrentSet;
import static org.elasticsearch.discovery.DiscoverySettings.NO_MASTER_BLOCK_WRITES; import static org.elasticsearch.discovery.DiscoverySettings.NO_MASTER_BLOCK_WRITES;
import static org.elasticsearch.gateway.ClusterStateUpdaters.hideStateIfNotRecovered;
import static org.elasticsearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK; import static org.elasticsearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
public class Coordinator extends AbstractLifecycleComponent implements Discovery { public class Coordinator extends AbstractLifecycleComponent implements Discovery {
@ -209,7 +210,7 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
logger.trace("handleApplyCommit: applying commit {}", applyCommitRequest); logger.trace("handleApplyCommit: applying commit {}", applyCommitRequest);
coordinationState.get().handleCommit(applyCommitRequest); coordinationState.get().handleCommit(applyCommitRequest);
final ClusterState committedState = coordinationState.get().getLastAcceptedState(); final ClusterState committedState = hideStateIfNotRecovered(coordinationState.get().getLastAcceptedState());
applierState = mode == Mode.CANDIDATE ? clusterStateWithNoMasterBlock(committedState) : committedState; applierState = mode == Mode.CANDIDATE ? clusterStateWithNoMasterBlock(committedState) : committedState;
if (applyCommitRequest.getSourceNode().equals(getLocalNode())) { if (applyCommitRequest.getSourceNode().equals(getLocalNode())) {
// master node applies the committed state at the end of the publication process, not here. // master node applies the committed state at the end of the publication process, not here.

View File

@ -36,7 +36,9 @@ import org.elasticsearch.indices.IndicesService;
import java.util.Map; import java.util.Map;
class ClusterStateUpdaters { import static org.elasticsearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
public class ClusterStateUpdaters {
private static final Logger logger = LogManager.getLogger(ClusterStateUpdaters.class); private static final Logger logger = LogManager.getLogger(ClusterStateUpdaters.class);
static ClusterState setLocalNode(final ClusterState clusterState, DiscoveryNode localNode) { static ClusterState setLocalNode(final ClusterState clusterState, DiscoveryNode localNode) {
@ -149,4 +151,25 @@ class ClusterStateUpdaters {
.build(); .build();
} }
public static ClusterState hideStateIfNotRecovered(ClusterState state) {
if (state.blocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK)) {
final ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(state.blocks());
blocks.removeGlobalBlock(MetaData.CLUSTER_READ_ONLY_BLOCK);
blocks.removeGlobalBlock(MetaData.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK);
for (IndexMetaData indexMetaData: state.metaData()) {
blocks.removeIndexBlocks(indexMetaData.getIndex().getName());
}
final MetaData metaData = MetaData.builder()
.clusterUUID(state.metaData().clusterUUID())
.coordinationMetaData(state.metaData().coordinationMetaData())
.build();
return ClusterState.builder(state)
.metaData(metaData)
.blocks(blocks.build())
.build();
}
return state;
}
} }

View File

@ -34,7 +34,6 @@ import org.elasticsearch.node.Node;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import java.io.IOException; import java.io.IOException;
@ -212,15 +211,14 @@ public class ClusterStatsIT extends ESIntegTestCase {
} }
public void testClusterStatusWhenStateNotRecovered() throws Exception { public void testClusterStatusWhenStateNotRecovered() throws Exception {
internalCluster().startMasterOnlyNode(Settings.builder().put("gateway.recover_after_nodes", 2) internalCluster().startMasterOnlyNode(Settings.builder().put("gateway.recover_after_nodes", 2).build());
.put(TestZenDiscovery.USE_ZEN2.getKey(), false).build());
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get(); ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED)); assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED));
if (randomBoolean()) { if (randomBoolean()) {
internalCluster().startMasterOnlyNode(Settings.builder().put(TestZenDiscovery.USE_ZEN2.getKey(), false).build()); internalCluster().startMasterOnlyNode();
} else { } else {
internalCluster().startDataOnlyNode(Settings.builder().put(TestZenDiscovery.USE_ZEN2.getKey(), false).build()); internalCluster().startDataOnlyNode();
} }
// wait for the cluster status to settle // wait for the cluster status to settle
ensureGreen(); ensureGreen();

View File

@ -42,7 +42,6 @@ import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -67,14 +66,6 @@ import static org.hamcrest.core.IsNull.notNullValue;
@ClusterScope(scope = Scope.TEST) @ClusterScope(scope = Scope.TEST)
public class CreateIndexIT extends ESIntegTestCase { public class CreateIndexIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
// testIndexWithUnknownSetting and testRestartIndexCreationAfterFullClusterRestart fail with Zen2
.put(TestZenDiscovery.USE_ZEN2.getKey(), false)
.build();
}
public void testCreationDateGivenFails() { public void testCreationDateGivenFails() {
try { try {
prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_CREATION_DATE, 4L)).get(); prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_CREATION_DATE, 4L)).get();

View File

@ -341,7 +341,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
public void testNotWaitForQuorumCopies() throws Exception { public void testNotWaitForQuorumCopies() throws Exception {
logger.info("--> starting 3 nodes"); logger.info("--> starting 3 nodes");
internalCluster().startNodes(3, Settings.builder().put(TestZenDiscovery.USE_ZEN2.getKey(), false).build()); // needs state recovery List<String> nodes = internalCluster().startNodes(3);
logger.info("--> creating index with 1 primary and 2 replicas"); logger.info("--> creating index with 1 primary and 2 replicas");
assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder() assertAcked(client().admin().indices().prepareCreate("test").setSettings(Settings.builder()
.put("index.number_of_shards", randomIntBetween(1, 3)).put("index.number_of_replicas", 2)).get()); .put("index.number_of_shards", randomIntBetween(1, 3)).put("index.number_of_replicas", 2)).get());
@ -349,9 +349,9 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
client().prepareIndex("test", "type1").setSource(jsonBuilder() client().prepareIndex("test", "type1").setSource(jsonBuilder()
.startObject().field("field", "value1").endObject()).get(); .startObject().field("field", "value1").endObject()).get();
logger.info("--> removing 2 nodes from cluster"); logger.info("--> removing 2 nodes from cluster");
internalCluster().stopRandomDataNode(); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(nodes.get(1), nodes.get(2)));
internalCluster().stopRandomDataNode(); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(nodes.get(1), nodes.get(2)));
internalCluster().fullRestart(); internalCluster().restartRandomDataNode();
logger.info("--> checking that index still gets allocated with only 1 shard copy being available"); logger.info("--> checking that index still gets allocated with only 1 shard copy being available");
ensureYellow("test"); ensureYellow("test");
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 1L); assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 1L);

View File

@ -21,6 +21,7 @@ package org.elasticsearch.gateway;
import org.elasticsearch.Version; import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlocks; import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.coordination.CoordinationMetaData;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.metadata.MetaData;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
@ -36,6 +37,7 @@ import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
@ -45,6 +47,7 @@ import java.util.stream.Stream;
import static org.elasticsearch.cluster.metadata.MetaData.CLUSTER_READ_ONLY_BLOCK; import static org.elasticsearch.cluster.metadata.MetaData.CLUSTER_READ_ONLY_BLOCK;
import static org.elasticsearch.gateway.ClusterStateUpdaters.closeBadIndices; import static org.elasticsearch.gateway.ClusterStateUpdaters.closeBadIndices;
import static org.elasticsearch.gateway.ClusterStateUpdaters.hideStateIfNotRecovered;
import static org.elasticsearch.gateway.ClusterStateUpdaters.mixCurrentStateAndRecoveredState; import static org.elasticsearch.gateway.ClusterStateUpdaters.mixCurrentStateAndRecoveredState;
import static org.elasticsearch.gateway.ClusterStateUpdaters.recoverClusterBlocks; import static org.elasticsearch.gateway.ClusterStateUpdaters.recoverClusterBlocks;
import static org.elasticsearch.gateway.ClusterStateUpdaters.removeStateNotRecoveredBlock; import static org.elasticsearch.gateway.ClusterStateUpdaters.removeStateNotRecoveredBlock;
@ -271,4 +274,55 @@ public class ClusterStateUpdatersTests extends ESTestCase {
assertThat(updatedState.nodes().getSize(), is(1)); assertThat(updatedState.nodes().getSize(), is(1));
} }
public void testDoNotHideStateIfRecovered() {
final IndexMetaData indexMetaData = createIndexMetaData("test", Settings.EMPTY);
final MetaData metaData = MetaData.builder()
.persistentSettings(Settings.builder().put("test", "test").build())
.put(indexMetaData, false)
.build();
final ClusterState initialState = ClusterState.builder(ClusterState.EMPTY_STATE)
.metaData(metaData)
.build();
assertMetaDataEquals(initialState, hideStateIfNotRecovered(initialState));
}
public void testHideStateIfNotRecovered() {
final IndexMetaData indexMetaData = createIndexMetaData("test",
Settings.builder().put(IndexMetaData.INDEX_READ_ONLY_SETTING.getKey(), true).build());
final String clusterUUID = UUIDs.randomBase64UUID();
final CoordinationMetaData coordinationMetaData = new CoordinationMetaData(randomLong(),
new CoordinationMetaData.VotingConfiguration(Sets.newHashSet(generateRandomStringArray(5, 5, false))),
new CoordinationMetaData.VotingConfiguration(Sets.newHashSet(generateRandomStringArray(5, 5, false))),
Arrays.stream(generateRandomStringArray(5, 5, false))
.map(id -> new CoordinationMetaData.VotingTombstone(id, id))
.collect(Collectors.toSet()));
final MetaData metaData = MetaData.builder()
.persistentSettings(Settings.builder().put(MetaData.SETTING_READ_ONLY_SETTING.getKey(), true).build())
.transientSettings(Settings.builder().put(MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.getKey(), true).build())
.clusterUUID(clusterUUID)
.coordinationMetaData(coordinationMetaData)
.put(indexMetaData, false)
.build();
final ClusterState initialState = ClusterState.builder(ClusterState.EMPTY_STATE)
.metaData(metaData)
.blocks(ClusterBlocks.builder().addGlobalBlock(STATE_NOT_RECOVERED_BLOCK))
.build();
final DiscoveryNode localNode = new DiscoveryNode("node1", buildNewFakeTransportAddress(), Collections.emptyMap(),
Sets.newHashSet(DiscoveryNode.Role.MASTER), Version.CURRENT);
final ClusterState updatedState = Function.<ClusterState>identity()
.andThen(state -> setLocalNode(state, localNode))
.andThen(ClusterStateUpdaters::recoverClusterBlocks)
.apply(initialState);
final ClusterState hiddenState = hideStateIfNotRecovered(updatedState);
assertTrue(MetaData.isGlobalStateEquals(hiddenState.metaData(),
MetaData.builder().coordinationMetaData(coordinationMetaData).clusterUUID(clusterUUID).build()));
assertThat(hiddenState.metaData().indices().size(), is(0));
assertTrue(hiddenState.blocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK));
assertFalse(hiddenState.blocks().hasGlobalBlock(MetaData.CLUSTER_READ_ONLY_BLOCK));
assertFalse(hiddenState.blocks().hasGlobalBlock(MetaData.CLUSTER_READ_ONLY_ALLOW_DELETE_BLOCK));
assertFalse(hiddenState.blocks().hasIndexBlock(indexMetaData.getIndex().getName(), IndexMetaData.INDEX_READ_ONLY_BLOCK));
}
} }

View File

@ -66,14 +66,6 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
private final Logger logger = LogManager.getLogger(GatewayIndexStateIT.class); private final Logger logger = LogManager.getLogger(GatewayIndexStateIT.class);
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
// testRecoverBrokenIndexMetadata, testRecoverMissingAnalyzer, testDanglingIndices and testArchiveBrokenClusterSettings fail
.put(TestZenDiscovery.USE_ZEN2.getKey(), false)
.build();
}
public void testMappingMetaDataParsed() throws Exception { public void testMappingMetaDataParsed() throws Exception {
logger.info("--> starting 1 nodes"); logger.info("--> starting 1 nodes");
internalCluster().startNode(); internalCluster().startNode();
@ -286,7 +278,9 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
public void testDanglingIndices() throws Exception { public void testDanglingIndices() throws Exception {
logger.info("--> starting two nodes"); logger.info("--> starting two nodes");
final String node_1 = internalCluster().startNodes(2).get(0); final String node_1 = internalCluster().startNodes(2,
//TODO fails wih Zen2
Settings.builder().put(TestZenDiscovery.USE_ZEN2.getKey(), false).build()).get(0);
logger.info("--> indexing a simple document"); logger.info("--> indexing a simple document");
client().prepareIndex("test", "type1", "1").setSource("field1", "value1").setRefreshPolicy(IMMEDIATE).get(); client().prepareIndex("test", "type1", "1").setSource("field1", "value1").setRefreshPolicy(IMMEDIATE).get();
@ -339,7 +333,9 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
final List<String> nodes; final List<String> nodes;
logger.info("--> starting a cluster with " + numNodes + " nodes"); logger.info("--> starting a cluster with " + numNodes + " nodes");
nodes = internalCluster().startNodes(numNodes, nodes = internalCluster().startNodes(numNodes,
Settings.builder().put(IndexGraveyard.SETTING_MAX_TOMBSTONES.getKey(), randomIntBetween(10, 100)).build()); Settings.builder().put(IndexGraveyard.SETTING_MAX_TOMBSTONES.getKey(), randomIntBetween(10, 100))
//TODO fails with Zen2
.put(TestZenDiscovery.USE_ZEN2.getKey(), false).build());
logger.info("--> create an index"); logger.info("--> create an index");
createIndex(indexName); createIndex(indexName);

View File

@ -27,7 +27,6 @@ import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.InternalTestCluster.RestartCallback; import org.elasticsearch.test.InternalTestCluster.RestartCallback;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -40,13 +39,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFa
@ClusterScope(numDataNodes = 0, scope = Scope.TEST) @ClusterScope(numDataNodes = 0, scope = Scope.TEST)
public class QuorumGatewayIT extends ESIntegTestCase { public class QuorumGatewayIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence yet
.build();
}
@Override @Override
protected int numberOfReplicas() { protected int numberOfReplicas() {
return 2; return 2;

View File

@ -22,6 +22,7 @@ package org.elasticsearch.gateway;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.block.ClusterBlock; import org.elasticsearch.cluster.block.ClusterBlock;
import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.coordination.ClusterBootstrapService;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.discovery.zen.ElectMasterService; import org.elasticsearch.discovery.zen.ElectMasterService;
@ -29,7 +30,6 @@ import org.elasticsearch.node.Node;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import java.util.Set; import java.util.Set;
@ -40,13 +40,6 @@ import static org.hamcrest.Matchers.hasItem;
public class RecoverAfterNodesIT extends ESIntegTestCase { public class RecoverAfterNodesIT extends ESIntegTestCase {
private static final TimeValue BLOCK_WAIT_TIMEOUT = TimeValue.timeValueSeconds(10); private static final TimeValue BLOCK_WAIT_TIMEOUT = TimeValue.timeValueSeconds(10);
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // recover_after no implemented in Zen2 yet
.build();
}
public Set<ClusterBlock> waitForNoBlocksOnNode(TimeValue timeout, Client nodeClient) throws InterruptedException { public Set<ClusterBlock> waitForNoBlocksOnNode(TimeValue timeout, Client nodeClient) throws InterruptedException {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Set<ClusterBlock> blocks; Set<ClusterBlock> blocks;
@ -67,7 +60,9 @@ public class RecoverAfterNodesIT extends ESIntegTestCase {
public void testRecoverAfterNodes() throws Exception { public void testRecoverAfterNodes() throws Exception {
logger.info("--> start node (1)"); logger.info("--> start node (1)");
Client clientNode1 = startNode(Settings.builder().put("gateway.recover_after_nodes", 3), 1); Client clientNode1 = startNode(Settings.builder()
.put("gateway.recover_after_nodes", 3)
.put(ClusterBootstrapService.INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 1), 1);
assertThat(clientNode1.admin().cluster().prepareState().setLocal(true).execute().actionGet() assertThat(clientNode1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
.getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE),
hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
@ -94,7 +89,8 @@ public class RecoverAfterNodesIT extends ESIntegTestCase {
logger.info("--> start master_node (1)"); logger.info("--> start master_node (1)");
Client master1 = startNode(Settings.builder() Client master1 = startNode(Settings.builder()
.put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false) .put("gateway.recover_after_master_nodes", 2).put(Node.NODE_DATA_SETTING.getKey(), false)
.put(Node.NODE_MASTER_SETTING.getKey(), true), 1); .put(Node.NODE_MASTER_SETTING.getKey(), true)
.put(ClusterBootstrapService.INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 1), 1);
assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
.getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE),
hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));
@ -140,7 +136,8 @@ public class RecoverAfterNodesIT extends ESIntegTestCase {
Client master1 = startNode(Settings.builder() Client master1 = startNode(Settings.builder()
.put("gateway.recover_after_data_nodes", 2) .put("gateway.recover_after_data_nodes", 2)
.put(Node.NODE_DATA_SETTING.getKey(), false) .put(Node.NODE_DATA_SETTING.getKey(), false)
.put(Node.NODE_MASTER_SETTING.getKey(), true), 1); .put(Node.NODE_MASTER_SETTING.getKey(), true)
.put(ClusterBootstrapService.INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 1), 1);
assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet() assertThat(master1.admin().cluster().prepareState().setLocal(true).execute().actionGet()
.getState().blocks().global(ClusterBlockLevel.METADATA_WRITE), .getState().blocks().global(ClusterBlockLevel.METADATA_WRITE),
hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK)); hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK));

View File

@ -68,7 +68,6 @@ import org.elasticsearch.test.CorruptionUtils;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalSettingsPlugin; import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.MockIndexEventListener; import org.elasticsearch.test.MockIndexEventListener;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.elasticsearch.test.store.MockFSIndexStore; import org.elasticsearch.test.store.MockFSIndexStore;
import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportService;
@ -117,7 +116,6 @@ public class CorruptedFileIT extends ESIntegTestCase {
// speed up recoveries // speed up recoveries
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.getKey(), 5) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.getKey(), 5)
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 5) .put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 5)
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence yet
.build(); .build();
} }

View File

@ -56,7 +56,6 @@ import org.elasticsearch.index.shard.IndexShardTestCase;
import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.indices.IndicesService; import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.emptyIterable;
@ -66,14 +65,6 @@ import static org.hamcrest.Matchers.nullValue;
public class FlushIT extends ESIntegTestCase { public class FlushIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
// uses fullClusterRestart
.put(TestZenDiscovery.USE_ZEN2.getKey(), false)
.build();
}
public void testWaitIfOngoing() throws InterruptedException { public void testWaitIfOngoing() throws InterruptedException {
createIndex("test"); createIndex("test");
ensureGreen("test"); ensureGreen("test");

View File

@ -20,13 +20,11 @@ package org.elasticsearch.persistent;
import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.action.support.PlainActionFuture;
import org.elasticsearch.common.UUIDs; import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask; import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask;
import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestParams; import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestParams;
import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestPersistentTasksExecutor; import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestPersistentTasksExecutor;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.test.junit.annotations.TestLogging;
import java.util.ArrayList; import java.util.ArrayList;
@ -41,13 +39,6 @@ import static org.hamcrest.Matchers.greaterThan;
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, minNumDataNodes = 1) @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, minNumDataNodes = 1)
public class PersistentTasksExecutorFullRestartIT extends ESIntegTestCase { public class PersistentTasksExecutorFullRestartIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence yet
.build();
}
@Override @Override
protected Collection<Class<? extends Plugin>> nodePlugins() { protected Collection<Class<? extends Plugin>> nodePlugins() {
return Collections.singletonList(TestPersistentTasksPlugin.class); return Collections.singletonList(TestPersistentTasksPlugin.class);

View File

@ -32,7 +32,6 @@ import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestParams;
import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestPersistentTasksExecutor; import org.elasticsearch.persistent.TestPersistentTasksPlugin.TestPersistentTasksExecutor;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -56,13 +55,6 @@ public class EnableAssignmentDeciderIT extends ESIntegTestCase {
return nodePlugins(); return nodePlugins();
} }
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // state recovery not completed in Zen2
.build();
}
@Override @Override
protected boolean ignoreExternalCluster() { protected boolean ignoreExternalCluster() {
return true; return true;

View File

@ -11,7 +11,6 @@ import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin; import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
import org.elasticsearch.xpack.core.XPackPlugin; import org.elasticsearch.xpack.core.XPackPlugin;
@ -43,7 +42,6 @@ public class LicenseServiceClusterTests extends AbstractLicensesIntegrationTestC
return Settings.builder() return Settings.builder()
.put(super.nodeSettings(nodeOrdinal)) .put(super.nodeSettings(nodeOrdinal))
.put("node.data", true) .put("node.data", true)
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence
.put("resource.reload.interval.high", "500ms"); // for license mode file watcher .put("resource.reload.interval.high", "500ms"); // for license mode file watcher
} }

View File

@ -20,7 +20,6 @@ import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData; import org.elasticsearch.persistent.PersistentTasksCustomMetaData;
import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask; import org.elasticsearch.persistent.PersistentTasksCustomMetaData.PersistentTask;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.elasticsearch.test.junit.annotations.TestLogging; import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction;
@ -47,13 +46,6 @@ import static org.elasticsearch.persistent.PersistentTasksClusterService.needsRe
public class MlDistributedFailureIT extends BaseMlIntegTestCase { public class MlDistributedFailureIT extends BaseMlIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
.put(TestZenDiscovery.USE_ZEN2.getKey(), false) // no state persistence yet
.build();
}
public void testFailOver() throws Exception { public void testFailOver() throws Exception {
internalCluster().ensureAtLeastNumDataNodes(3); internalCluster().ensureAtLeastNumDataNodes(3);
ensureStableClusterOnAllNodes(3); ensureStableClusterOnAllNodes(3);