public class ZenDiscovery extends AbstractLifecycleComponent implements Discovery, PingContextProvider
Modifier and Type | Class and Description |
---|---|
static class |
ZenDiscovery.RejoinClusterRequest |
Discovery.AckListener, Discovery.FailedToCommitClusterStateException
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DISCOVERY_REJOIN_ACTION_NAME |
static Setting<java.lang.Integer> |
JOIN_RETRY_ATTEMPTS_SETTING |
static Setting<TimeValue> |
JOIN_RETRY_DELAY_SETTING |
static Setting<TimeValue> |
JOIN_TIMEOUT_SETTING |
static Setting<java.lang.Boolean> |
MASTER_ELECTION_IGNORE_NON_MASTER_PINGS_SETTING |
static Setting<TimeValue> |
MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING |
static Setting<java.lang.Integer> |
MAX_PINGS_FROM_ANOTHER_MASTER_SETTING |
static Setting<TimeValue> |
PING_TIMEOUT_SETTING |
static Setting<java.lang.Boolean> |
SEND_LEAVE_REQUEST_SETTING |
protected ZenPing |
zenPing |
lifecycle
deprecationLogger, logger, settings
Constructor and Description |
---|
ZenDiscovery(Settings settings,
ThreadPool threadPool,
TransportService transportService,
NamedWriteableRegistry namedWriteableRegistry,
ClusterService clusterService,
UnicastHostsProvider hostsProvider) |
Modifier and Type | Method and Description |
---|---|
ClusterState |
clusterState()
return the current cluster state of the node
|
protected void |
doClose() |
protected void |
doStart() |
protected void |
doStop() |
DiscoverySettings |
getDiscoverySettings() |
java.util.Set<DiscoveryNode> |
getFaultDetectionNodes()
Gets the current set of nodes involved in the node fault detection.
|
int |
getMinimumMasterNodes() |
boolean |
joiningCluster()
returns true if zen discovery is started and there is a currently a background thread active for (re)joining
the cluster used for testing.
|
DiscoveryNode |
localNode() |
protected ZenPing |
newZenPing(Settings settings,
ThreadPool threadPool,
TransportService transportService,
UnicastHostsProvider hostsProvider) |
java.lang.String |
nodeDescription() |
ClusterState[] |
pendingClusterStates() |
void |
publish(ClusterChangedEvent clusterChangedEvent,
Discovery.AckListener ackListener)
Publish all the changes to the cluster from the master (can be called just by the master).
|
protected ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask> |
rejoin(ClusterState clusterState,
java.lang.String reason) |
void |
setAllocationService(AllocationService allocationService)
Another hack to solve dep injection problem..., note, this will be called before
any start is called.
|
static boolean |
shouldIgnoreOrRejectNewClusterState(org.apache.logging.log4j.Logger logger,
ClusterState currentState,
ClusterState newClusterState)
In the case we follow an elected master the new cluster state needs to have the same elected master and
the new cluster state version needs to be equal or higher than our cluster state version.
|
void |
startInitialJoin()
Triggers the first join cycle
|
DiscoveryStats |
stats() |
static void |
validateStateIsFromCurrentMaster(org.apache.logging.log4j.Logger logger,
DiscoveryNodes currentNodes,
ClusterState newClusterState)
In the case we follow an elected master the new cluster state needs to have the same elected master
This method checks for this and throws an exception if needed
|
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
logDeprecatedSetting, logRemovedSetting, nodeName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
close
public static final Setting<java.lang.Integer> JOIN_RETRY_ATTEMPTS_SETTING
public static final Setting<java.lang.Integer> MAX_PINGS_FROM_ANOTHER_MASTER_SETTING
public static final Setting<java.lang.Boolean> SEND_LEAVE_REQUEST_SETTING
public static final Setting<TimeValue> MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING
public static final Setting<java.lang.Boolean> MASTER_ELECTION_IGNORE_NON_MASTER_PINGS_SETTING
public static final java.lang.String DISCOVERY_REJOIN_ACTION_NAME
protected final ZenPing zenPing
public ZenDiscovery(Settings settings, ThreadPool threadPool, TransportService transportService, NamedWriteableRegistry namedWriteableRegistry, ClusterService clusterService, UnicastHostsProvider hostsProvider)
protected ZenPing newZenPing(Settings settings, ThreadPool threadPool, TransportService transportService, UnicastHostsProvider hostsProvider)
public void setAllocationService(AllocationService allocationService)
Discovery
setAllocationService
in interface Discovery
protected void doStart()
doStart
in class AbstractLifecycleComponent
public void startInitialJoin()
Discovery
startInitialJoin
in interface Discovery
protected void doStop()
doStop
in class AbstractLifecycleComponent
protected void doClose() throws java.io.IOException
doClose
in class AbstractLifecycleComponent
java.io.IOException
public DiscoveryNode localNode()
public java.lang.String nodeDescription()
nodeDescription
in interface Discovery
public ClusterState clusterState()
PingContextProvider
clusterState
in interface PingContextProvider
public void publish(ClusterChangedEvent clusterChangedEvent, Discovery.AckListener ackListener)
Discovery
Discovery.AckListener
allows to keep track of the ack received from nodes, and verify whether
they updated their own cluster state or not.
The method is guaranteed to throw a Discovery.FailedToCommitClusterStateException
if the change is not committed and should be rejected.
Any other exception signals the something wrong happened but the change is committed.public java.util.Set<DiscoveryNode> getFaultDetectionNodes()
public DiscoveryStats stats()
public DiscoverySettings getDiscoverySettings()
getDiscoverySettings
in interface Discovery
public int getMinimumMasterNodes()
getMinimumMasterNodes
in interface Discovery
public boolean joiningCluster()
public ClusterState[] pendingClusterStates()
public static boolean shouldIgnoreOrRejectNewClusterState(org.apache.logging.log4j.Logger logger, ClusterState currentState, ClusterState newClusterState)
public static void validateStateIsFromCurrentMaster(org.apache.logging.log4j.Logger logger, DiscoveryNodes currentNodes, ClusterState newClusterState)
protected ClusterStateTaskExecutor.ClusterTasksResult<LocalClusterUpdateTask> rejoin(ClusterState clusterState, java.lang.String reason)