Search in sources :

Example 1 with GatewayAllocator

use of org.elasticsearch.gateway.GatewayAllocator in project elasticsearch by elastic.

the class RareClusterStateIT method testUnassignedShardAndEmptyNodesInRoutingTable.

public void testUnassignedShardAndEmptyNodesInRoutingTable() throws Exception {
    internalCluster().startNode();
    createIndex("a");
    ensureSearchable("a");
    ClusterState current = clusterService().state();
    GatewayAllocator allocator = internalCluster().getInstance(GatewayAllocator.class);
    AllocationDeciders allocationDeciders = new AllocationDeciders(Settings.EMPTY, Collections.emptyList());
    RoutingNodes routingNodes = new RoutingNodes(ClusterState.builder(current).routingTable(RoutingTable.builder(current.routingTable()).remove("a").addAsRecovery(current.metaData().index("a")).build()).nodes(DiscoveryNodes.EMPTY_NODES).build(), false);
    RoutingAllocation routingAllocation = new RoutingAllocation(allocationDeciders, routingNodes, current, ClusterInfo.EMPTY, System.nanoTime(), false);
    allocator.allocateUnassigned(routingAllocation);
}
Also used : ClusterState(org.elasticsearch.cluster.ClusterState) GatewayAllocator(org.elasticsearch.gateway.GatewayAllocator) RoutingNodes(org.elasticsearch.cluster.routing.RoutingNodes) AllocationDeciders(org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders) RoutingAllocation(org.elasticsearch.cluster.routing.allocation.RoutingAllocation)

Aggregations

ClusterState (org.elasticsearch.cluster.ClusterState)1 RoutingNodes (org.elasticsearch.cluster.routing.RoutingNodes)1 RoutingAllocation (org.elasticsearch.cluster.routing.allocation.RoutingAllocation)1 AllocationDeciders (org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders)1 GatewayAllocator (org.elasticsearch.gateway.GatewayAllocator)1