public class ZenDiscovery extends AbstractLifecycleComponent implements Discovery, PingContextProvider, PublishClusterStateAction.IncomingClusterStateListener
| 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_PENDING_CLUSTER_STATES_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 |
lifecycledeprecationLogger, logger, settings| Constructor and Description |
|---|
ZenDiscovery(Settings settings,
ThreadPool threadPool,
TransportService transportService,
NamedWriteableRegistry namedWriteableRegistry,
MasterService masterService,
ClusterApplier clusterApplier,
ClusterSettings clusterSettings,
UnicastHostsProvider hostsProvider,
AllocationService allocationService,
java.util.Collection<java.util.function.BiConsumer<DiscoveryNode,ClusterState>> onJoinValidators) |
| 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.Collection<java.util.function.BiConsumer<DiscoveryNode,ClusterState>> |
getOnJoinValidators() |
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.
|
protected ZenPing |
newZenPing(Settings settings,
ThreadPool threadPool,
TransportService transportService,
UnicastHostsProvider hostsProvider) |
void |
onClusterStateCommitted(java.lang.String stateUUID,
ActionListener<java.lang.Void> processedListener)
called when a cluster state has been committed and is ready to be processed
|
void |
onIncomingClusterState(ClusterState incomingState)
called when a new incoming cluster state has been received.
|
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 void |
rejoin(java.lang.String reason) |
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, stoplogDeprecatedSetting, logRemovedSetting, nodeNameclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifecycleListener, lifecycleState, removeLifecycleListener, start, stopclosepublic 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 Setting<java.lang.Integer> MAX_PENDING_CLUSTER_STATES_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, MasterService masterService, ClusterApplier clusterApplier, ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider, AllocationService allocationService, java.util.Collection<java.util.function.BiConsumer<DiscoveryNode,ClusterState>> onJoinValidators)
protected ZenPing newZenPing(Settings settings, ThreadPool threadPool, TransportService transportService, UnicastHostsProvider hostsProvider)
protected void doStart()
doStart in class AbstractLifecycleComponentpublic void startInitialJoin()
DiscoverystartInitialJoin in interface Discoveryprotected void doStop()
doStop in class AbstractLifecycleComponentprotected void doClose()
throws java.io.IOException
doClose in class AbstractLifecycleComponentjava.io.IOExceptionpublic ClusterState clusterState()
PingContextProviderclusterState in interface PingContextProviderpublic void publish(ClusterChangedEvent clusterChangedEvent, Discovery.AckListener ackListener)
DiscoveryDiscovery.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 DiscoveryStats stats()
public DiscoverySettings getDiscoverySettings()
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 void rejoin(java.lang.String reason)
public void onIncomingClusterState(ClusterState incomingState)
PublishClusterStateAction.IncomingClusterStateListeneronIncomingClusterState in interface PublishClusterStateAction.IncomingClusterStateListenerpublic void onClusterStateCommitted(java.lang.String stateUUID,
ActionListener<java.lang.Void> processedListener)
PublishClusterStateAction.IncomingClusterStateListeneronClusterStateCommitted in interface PublishClusterStateAction.IncomingClusterStateListenerpublic final java.util.Collection<java.util.function.BiConsumer<DiscoveryNode,ClusterState>> getOnJoinValidators()