Search in sources :

Example 1 with ClearVotingConfigExclusionsRequest

use of org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsRequest in project crate by crate.

the class InternalTestCluster method removeExclusions.

private void removeExclusions(Set<String> excludedNodeIds) {
    assert Thread.holdsLock(this);
    if (excludedNodeIds.isEmpty() == false) {
        logger.info("removing voting config exclusions for {} after restart/shutdown", excludedNodeIds);
        try {
            Client client = getRandomNodeAndClient(node -> excludedNodeIds.contains(node.name) == false).client();
            client.execute(ClearVotingConfigExclusionsAction.INSTANCE, new ClearVotingConfigExclusionsRequest()).get();
        } catch (InterruptedException | ExecutionException e) {
            throw new AssertionError("unexpected", e);
        }
    }
}
Also used : ShardId(org.elasticsearch.index.shard.ShardId) Arrays(java.util.Arrays) ByteSizeUnit(org.elasticsearch.common.unit.ByteSizeUnit) Releasables(org.elasticsearch.common.lease.Releasables) IndexMetadata(org.elasticsearch.cluster.metadata.IndexMetadata) Matchers.not(org.hamcrest.Matchers.not) AlreadyClosedException(org.apache.lucene.store.AlreadyClosedException) ClusterBootstrapService(org.elasticsearch.cluster.coordination.ClusterBootstrapService) TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING(org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService.TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING) NodeValidationException(org.elasticsearch.node.NodeValidationException) SeqNoStats(org.elasticsearch.index.seqno.SeqNoStats) RecoverySettings(org.elasticsearch.indices.recovery.RecoverySettings) AddVotingConfigExclusionsRequest(org.elasticsearch.action.admin.cluster.configuration.AddVotingConfigExclusionsRequest) Future(java.util.concurrent.Future) ClusterState(org.elasticsearch.cluster.ClusterState) RandomNumbers(com.carrotsearch.randomizedtesting.generators.RandomNumbers) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Map(java.util.Map) ObjectLongMap(com.carrotsearch.hppc.ObjectLongMap) Path(java.nio.file.Path) INITIAL_MASTER_NODES_SETTING(org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING) RandomStrings(com.carrotsearch.randomizedtesting.generators.RandomStrings) ServiceDisruptionScheme(org.elasticsearch.test.disruption.ServiceDisruptionScheme) MappingUpdatedAction(org.elasticsearch.cluster.action.index.MappingUpdatedAction) INITIAL_STATE_TIMEOUT_SETTING(org.elasticsearch.node.Node.INITIAL_STATE_TIMEOUT_SETTING) Set(java.util.Set) ESTestCase.assertBusy(org.elasticsearch.test.ESTestCase.assertBusy) PageCacheRecycler(org.elasticsearch.common.util.PageCacheRecycler) RandomizedTest(com.carrotsearch.randomizedtesting.RandomizedTest) Stream(java.util.stream.Stream) Logger(org.apache.logging.log4j.Logger) TransportSettings(org.elasticsearch.transport.TransportSettings) ZEN2_DISCOVERY_TYPE(org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE) Matchers.greaterThan(org.hamcrest.Matchers.greaterThan) DiscoveryNodeRole(org.elasticsearch.cluster.node.DiscoveryNodeRole) IntObjectCursor(com.carrotsearch.hppc.cursors.IntObjectCursor) ThrottlingAllocationDecider(org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider) RandomPicks(com.carrotsearch.randomizedtesting.generators.RandomPicks) DiskThresholdSettings(org.elasticsearch.cluster.routing.allocation.DiskThresholdSettings) ClusterService(org.elasticsearch.cluster.service.ClusterService) ArrayList(java.util.ArrayList) CircuitBreakerService(org.elasticsearch.indices.breaker.CircuitBreakerService) DiscoveryNode(org.elasticsearch.cluster.node.DiscoveryNode) NamedWriteableRegistry(org.elasticsearch.common.io.stream.NamedWriteableRegistry) CircuitBreaker(org.elasticsearch.common.breaker.CircuitBreaker) IndicesService(org.elasticsearch.indices.IndicesService) TransportService(org.elasticsearch.transport.TransportService) Nullable(javax.annotation.Nullable) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) DiscoveryNodes(org.elasticsearch.cluster.node.DiscoveryNodes) FileSystemUtils(org.elasticsearch.common.io.FileSystemUtils) OperationRouting(org.elasticsearch.cluster.routing.OperationRouting) FutureUtils(org.elasticsearch.common.util.concurrent.FutureUtils) SequenceNumbers(org.elasticsearch.index.seqno.SequenceNumbers) Files(java.nio.file.Files) Client(org.elasticsearch.client.Client) IndexService(org.elasticsearch.index.IndexService) IndexShard(org.elasticsearch.index.shard.IndexShard) IOUtils(io.crate.common.io.IOUtils) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) SeedUtils(com.carrotsearch.randomizedtesting.SeedUtils) ExecutionException(java.util.concurrent.ExecutionException) LuceneTestCase.rarely(org.apache.lucene.util.LuceneTestCase.rarely) UNICAST_HOSTS_FILE(org.elasticsearch.discovery.FileBasedSeedHostsProvider.UNICAST_HOSTS_FILE) InternalEngine(org.elasticsearch.index.engine.InternalEngine) HierarchyCircuitBreakerService(org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService) TreeMap(java.util.TreeMap) Randomness(org.elasticsearch.common.Randomness) Assert.assertEquals(org.junit.Assert.assertEquals) Builder(org.elasticsearch.common.settings.Settings.Builder) Environment(org.elasticsearch.env.Environment) Random(java.util.Random) TEST_NIGHTLY(org.apache.lucene.util.LuceneTestCase.TEST_NIGHTLY) Assert.assertThat(org.junit.Assert.assertThat) ObjectObjectCursor(com.carrotsearch.hppc.cursors.ObjectObjectCursor) ClearVotingConfigExclusionsRequest(org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsRequest) Settings(org.elasticsearch.common.settings.Settings) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) LifecycleListener(org.elasticsearch.common.component.LifecycleListener) Assert.fail(org.junit.Assert.fail) ClusterName(org.elasticsearch.cluster.ClusterName) ByteSizeValue(org.elasticsearch.common.unit.ByteSizeValue) AddVotingConfigExclusionsAction(org.elasticsearch.action.admin.cluster.configuration.AddVotingConfigExclusionsAction) Predicate(java.util.function.Predicate) Collection(java.util.Collection) IndexShardRoutingTable(org.elasticsearch.cluster.routing.IndexShardRoutingTable) ShardLockObtainFailedException(org.elasticsearch.env.ShardLockObtainFailedException) NavigableMap(java.util.NavigableMap) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) Engine(org.elasticsearch.index.engine.Engine) Objects(java.util.Objects) ESTestCase.randomFrom(org.elasticsearch.test.ESTestCase.randomFrom) List(java.util.List) IndexRoutingTable(org.elasticsearch.cluster.routing.IndexRoutingTable) Matchers.equalTo(org.hamcrest.Matchers.equalTo) TimeValue(io.crate.common.unit.TimeValue) IntStream(java.util.stream.IntStream) ShardRouting(org.elasticsearch.cluster.routing.ShardRouting) HttpServerTransport(org.elasticsearch.http.HttpServerTransport) CommitStats(org.elasticsearch.index.engine.CommitStats) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) ClearVotingConfigExclusionsAction(org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsAction) Index(org.elasticsearch.index.Index) Strings(org.elasticsearch.common.Strings) HashSet(java.util.HashSet) Node(org.elasticsearch.node.Node) DocIdSeqNoAndSource(org.elasticsearch.index.engine.DocIdSeqNoAndSource) MockTransportService(org.elasticsearch.test.transport.MockTransportService) ExecutorService(java.util.concurrent.ExecutorService) TimeValue.timeValueSeconds(io.crate.common.unit.TimeValue.timeValueSeconds) MockNode(org.elasticsearch.node.MockNode) EsExecutors(org.elasticsearch.common.util.concurrent.EsExecutors) Iterator(java.util.Iterator) Plugin(org.elasticsearch.plugins.Plugin) TimeUnit(java.util.concurrent.TimeUnit) IndexShardTestCase(org.elasticsearch.index.shard.IndexShardTestCase) NodeEnvironment(org.elasticsearch.env.NodeEnvironment) DISCOVERY_TYPE_SETTING(org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING) Closeable(java.io.Closeable) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) ClearVotingConfigExclusionsRequest(org.elasticsearch.action.admin.cluster.configuration.ClearVotingConfigExclusionsRequest) Client(org.elasticsearch.client.Client) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ObjectLongMap (com.carrotsearch.hppc.ObjectLongMap)1 IntObjectCursor (com.carrotsearch.hppc.cursors.IntObjectCursor)1 ObjectObjectCursor (com.carrotsearch.hppc.cursors.ObjectObjectCursor)1 RandomizedTest (com.carrotsearch.randomizedtesting.RandomizedTest)1 SeedUtils (com.carrotsearch.randomizedtesting.SeedUtils)1 RandomNumbers (com.carrotsearch.randomizedtesting.generators.RandomNumbers)1 RandomPicks (com.carrotsearch.randomizedtesting.generators.RandomPicks)1 RandomStrings (com.carrotsearch.randomizedtesting.generators.RandomStrings)1 IOUtils (io.crate.common.io.IOUtils)1 TimeValue (io.crate.common.unit.TimeValue)1 TimeValue.timeValueSeconds (io.crate.common.unit.TimeValue.timeValueSeconds)1 Closeable (java.io.Closeable)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1