use of org.elasticsearch.cluster.node.DiscoveryNodes.Builder in project elasticsearch by elastic.
the class PrimaryTermsTests method initPrimaries.
/**
* puts primary shard routings into initializing state
*/
private void initPrimaries() {
logger.info("adding {} nodes and performing rerouting", this.numberOfReplicas + 1);
Builder discoBuilder = DiscoveryNodes.builder();
for (int i = 0; i < this.numberOfReplicas + 1; i++) {
discoBuilder = discoBuilder.add(newNode("node" + i));
}
this.clusterState = ClusterState.builder(clusterState).nodes(discoBuilder).build();
ClusterState rerouteResult = allocationService.reroute(clusterState, "reroute");
assertThat(rerouteResult, not(equalTo(this.clusterState)));
applyRerouteResult(rerouteResult);
primaryTermsPerIndex.keySet().forEach(this::incrementPrimaryTerm);
}
use of org.elasticsearch.cluster.node.DiscoveryNodes.Builder in project crate by crate.
the class PeerFinderTests method updateLastAcceptedNodes.
private void updateLastAcceptedNodes(Consumer<DiscoveryNodes.Builder> onBuilder) {
final Builder builder = DiscoveryNodes.builder(lastAcceptedNodes);
onBuilder.accept(builder);
lastAcceptedNodes = builder.build();
}
Aggregations