Package org.elasticsearch.gateway
Class GatewayMetaState
- java.lang.Object
-
- org.elasticsearch.gateway.GatewayMetaState
-
- All Implemented Interfaces:
ClusterStateApplier
public class GatewayMetaState extends java.lang.Object implements ClusterStateApplier
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GatewayMetaState.IndexMetaWriteInfo
-
Constructor Summary
Constructors Constructor Description GatewayMetaState(Settings settings, NodeEnvironment nodeEnv, MetaStateService metaStateService, MetaDataIndexUpgradeService metaDataIndexUpgradeService, MetaDataUpgrader metaDataUpgrader)
-
Method Summary
Modifier and Type Method Description void
applyClusterState(ClusterChangedEvent event)
Called when a new cluster state (ClusterChangedEvent.state()
needs to be appliedstatic java.util.Set<Index>
getRelevantIndices(ClusterState state, ClusterState previousState, java.util.Set<Index> previouslyWrittenIndices)
static java.util.Set<Index>
getRelevantIndicesForMasterEligibleNode(ClusterState state)
static java.util.Set<Index>
getRelevantIndicesOnDataOnlyNode(ClusterState state, ClusterState previousState, java.util.Set<Index> previouslyWrittenIndices)
protected static boolean
isDataOnlyNode(ClusterState state)
MetaData
loadMetaState()
static java.lang.Iterable<GatewayMetaState.IndexMetaWriteInfo>
resolveStatesToBeWritten(java.util.Set<Index> previouslyWrittenIndices, java.util.Set<Index> potentiallyUnwrittenIndices, MetaData previousMetaData, MetaData newMetaData)
Loads the current meta state for each index in the new cluster state and checks if it has to be persisted.
-
-
-
Constructor Detail
-
GatewayMetaState
public GatewayMetaState(Settings settings, NodeEnvironment nodeEnv, MetaStateService metaStateService, MetaDataIndexUpgradeService metaDataIndexUpgradeService, MetaDataUpgrader metaDataUpgrader) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
loadMetaState
public MetaData loadMetaState() throws java.io.IOException
- Throws:
java.io.IOException
-
applyClusterState
public void applyClusterState(ClusterChangedEvent event)
Description copied from interface:ClusterStateApplier
Called when a new cluster state (ClusterChangedEvent.state()
needs to be applied- Specified by:
applyClusterState
in interfaceClusterStateApplier
-
getRelevantIndices
public static java.util.Set<Index> getRelevantIndices(ClusterState state, ClusterState previousState, java.util.Set<Index> previouslyWrittenIndices)
-
isDataOnlyNode
protected static boolean isDataOnlyNode(ClusterState state)
-
resolveStatesToBeWritten
public static java.lang.Iterable<GatewayMetaState.IndexMetaWriteInfo> resolveStatesToBeWritten(java.util.Set<Index> previouslyWrittenIndices, java.util.Set<Index> potentiallyUnwrittenIndices, MetaData previousMetaData, MetaData newMetaData)
Loads the current meta state for each index in the new cluster state and checks if it has to be persisted. Each index state that should be written to disk will be returned. This is only run for data only nodes. It will return only the states for indices that actually have a shard allocated on the current node.- Parameters:
previouslyWrittenIndices
- A list of indices for which the state was already written beforepotentiallyUnwrittenIndices
- The list of indices for which state should potentially be writtenpreviousMetaData
- The last meta data we know of. meta data for all indices in previouslyWrittenIndices list is persisted nownewMetaData
- The new metadata- Returns:
- iterable over all indices states that should be written to disk
-
getRelevantIndicesOnDataOnlyNode
public static java.util.Set<Index> getRelevantIndicesOnDataOnlyNode(ClusterState state, ClusterState previousState, java.util.Set<Index> previouslyWrittenIndices)
-
getRelevantIndicesForMasterEligibleNode
public static java.util.Set<Index> getRelevantIndicesForMasterEligibleNode(ClusterState state)
-
-