Rename static DiscoveryNode#masterNode(Settings) to isMasterNode
This commit is contained in:
parent
3942c9e4df
commit
2230fec9ea
|
@ -68,7 +68,7 @@ public class DiscoveryNode implements Writeable<DiscoveryNode>, ToXContent {
|
||||||
return Node.NODE_DATA_SETTING.get(settings) || Node.NODE_MASTER_SETTING.get(settings);
|
return Node.NODE_DATA_SETTING.get(settings) || Node.NODE_MASTER_SETTING.get(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean masterNode(Settings settings) {
|
public static boolean isMasterNode(Settings settings) {
|
||||||
return Node.NODE_MASTER_SETTING.get(settings);
|
return Node.NODE_MASTER_SETTING.get(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,10 +80,10 @@ public class GatewayMetaState extends AbstractComponent implements ClusterStateL
|
||||||
ensureNoPre019ShardState(nodeEnv);
|
ensureNoPre019ShardState(nodeEnv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DiscoveryNode.masterNode(settings) || DiscoveryNode.dataNode(settings)) {
|
if (DiscoveryNode.isMasterNode(settings) || DiscoveryNode.dataNode(settings)) {
|
||||||
nodeEnv.ensureAtomicMoveSupported();
|
nodeEnv.ensureAtomicMoveSupported();
|
||||||
}
|
}
|
||||||
if (DiscoveryNode.masterNode(settings) || DiscoveryNode.dataNode(settings)) {
|
if (DiscoveryNode.isMasterNode(settings) || DiscoveryNode.dataNode(settings)) {
|
||||||
try {
|
try {
|
||||||
ensureNoPre019State();
|
ensureNoPre019State();
|
||||||
IndexFolderUpgrader.upgradeIndicesIfNeeded(settings, nodeEnv);
|
IndexFolderUpgrader.upgradeIndicesIfNeeded(settings, nodeEnv);
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class RepositoriesService extends AbstractComponent implements ClusterSta
|
||||||
this.clusterService = clusterService;
|
this.clusterService = clusterService;
|
||||||
// Doesn't make sense to maintain repositories on non-master and non-data nodes
|
// Doesn't make sense to maintain repositories on non-master and non-data nodes
|
||||||
// Nothing happens there anyway
|
// Nothing happens there anyway
|
||||||
if (DiscoveryNode.dataNode(settings) || DiscoveryNode.masterNode(settings)) {
|
if (DiscoveryNode.dataNode(settings) || DiscoveryNode.isMasterNode(settings)) {
|
||||||
clusterService.add(this);
|
clusterService.add(this);
|
||||||
}
|
}
|
||||||
this.verifyAction = new VerifyNodeRepositoryAction(settings, transportService, clusterService, this);
|
this.verifyAction = new VerifyNodeRepositoryAction(settings, transportService, clusterService, this);
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent<SnapshotSh
|
||||||
clusterService.addLast(this);
|
clusterService.addLast(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DiscoveryNode.masterNode(settings)) {
|
if (DiscoveryNode.isMasterNode(settings)) {
|
||||||
// This needs to run only on nodes that can become masters
|
// This needs to run only on nodes that can become masters
|
||||||
transportService.registerRequestHandler(UPDATE_SNAPSHOT_ACTION_NAME, UpdateIndexShardSnapshotStatusRequest::new, ThreadPool.Names.SAME, new UpdateSnapshotStateRequestHandler());
|
transportService.registerRequestHandler(UPDATE_SNAPSHOT_ACTION_NAME, UpdateIndexShardSnapshotStatusRequest::new, ThreadPool.Names.SAME, new UpdateSnapshotStateRequestHandler());
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class SnapshotsService extends AbstractLifecycleComponent<SnapshotsServic
|
||||||
this.repositoriesService = repositoriesService;
|
this.repositoriesService = repositoriesService;
|
||||||
this.threadPool = threadPool;
|
this.threadPool = threadPool;
|
||||||
|
|
||||||
if (DiscoveryNode.masterNode(settings)) {
|
if (DiscoveryNode.isMasterNode(settings)) {
|
||||||
// addLast to make sure that Repository will be created before snapshot
|
// addLast to make sure that Repository will be created before snapshot
|
||||||
clusterService.addLast(this);
|
clusterService.addLast(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ import java.net.InetSocketAddress;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -98,7 +97,7 @@ public final class ExternalTestCluster extends TestCluster {
|
||||||
if (DiscoveryNode.dataNode(nodeInfo.getSettings())) {
|
if (DiscoveryNode.dataNode(nodeInfo.getSettings())) {
|
||||||
dataNodes++;
|
dataNodes++;
|
||||||
masterAndDataNodes++;
|
masterAndDataNodes++;
|
||||||
} else if (DiscoveryNode.masterNode(nodeInfo.getSettings())) {
|
} else if (DiscoveryNode.isMasterNode(nodeInfo.getSettings())) {
|
||||||
masterAndDataNodes++;
|
masterAndDataNodes++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1651,7 +1651,7 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(NodeAndClient nodeAndClient) {
|
public boolean test(NodeAndClient nodeAndClient) {
|
||||||
return DiscoveryNode.dataNode(nodeAndClient.node.settings()) ||
|
return DiscoveryNode.dataNode(nodeAndClient.node.settings()) ||
|
||||||
DiscoveryNode.masterNode(nodeAndClient.node.settings());
|
DiscoveryNode.isMasterNode(nodeAndClient.node.settings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1671,7 +1671,7 @@ public final class InternalTestCluster extends TestCluster {
|
||||||
private static final class NoDataNoMasterNodePredicate implements Predicate<NodeAndClient> {
|
private static final class NoDataNoMasterNodePredicate implements Predicate<NodeAndClient> {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(NodeAndClient nodeAndClient) {
|
public boolean test(NodeAndClient nodeAndClient) {
|
||||||
return DiscoveryNode.masterNode(nodeAndClient.node.settings()) == false &&
|
return DiscoveryNode.isMasterNode(nodeAndClient.node.settings()) == false &&
|
||||||
DiscoveryNode.dataNode(nodeAndClient.node.settings()) == false;
|
DiscoveryNode.dataNode(nodeAndClient.node.settings()) == false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue