public class IndexMetaDataUpdater extends RoutingChangesObserver.AbstractRoutingChangesObserver
IndexMetaData once the allocation round has completed.
Primary terms are updated on primary initialization or when an active primary fails.
Allocation ids are added for shards that become active and removed for shards that stop being active.RoutingChangesObserver.AbstractRoutingChangesObserver, RoutingChangesObserver.DelegatingRoutingChangesObserver| Constructor and Description |
|---|
IndexMetaDataUpdater() |
| Modifier and Type | Method and Description |
|---|---|
MetaData |
applyChanges(MetaData oldMetaData,
RoutingTable newRoutingTable)
Updates the current
MetaData based on the changes of this RoutingChangesObserver. |
void |
relocationCompleted(ShardRouting removedRelocationSource)
Called on relocation source when relocation completes after relocation target is started.
|
static ClusterState |
removeStaleIdsWithoutRoutings(ClusterState clusterState,
java.util.List<StaleShard> staleShards)
Removes allocation ids from the in-sync set for shard copies for which there is no routing entries in the routing table.
|
void |
shardFailed(ShardRouting failedShard,
UnassignedInfo unassignedInfo)
Called when a shard is failed or cancelled.
|
void |
shardInitialized(ShardRouting unassignedShard,
ShardRouting initializedShard)
Called when unassigned shard is initialized.
|
void |
shardStarted(ShardRouting initializingShard,
ShardRouting startedShard)
Called when an initializing shard is started.
|
relocationSourceRemoved, relocationStarted, replicaPromoted, startedPrimaryReinitialized, unassignedInfoUpdatedpublic void shardInitialized(ShardRouting unassignedShard, ShardRouting initializedShard)
RoutingChangesObservershardInitialized in interface RoutingChangesObservershardInitialized in class RoutingChangesObserver.AbstractRoutingChangesObserverpublic void shardStarted(ShardRouting initializingShard, ShardRouting startedShard)
RoutingChangesObservershardStarted in interface RoutingChangesObservershardStarted in class RoutingChangesObserver.AbstractRoutingChangesObserverpublic void shardFailed(ShardRouting failedShard, UnassignedInfo unassignedInfo)
RoutingChangesObservershardFailed in interface RoutingChangesObservershardFailed in class RoutingChangesObserver.AbstractRoutingChangesObserverpublic void relocationCompleted(ShardRouting removedRelocationSource)
RoutingChangesObserverrelocationCompleted in interface RoutingChangesObserverrelocationCompleted in class RoutingChangesObserver.AbstractRoutingChangesObserverpublic MetaData applyChanges(MetaData oldMetaData, RoutingTable newRoutingTable)
MetaData based on the changes of this RoutingChangesObserver. Specifically
we update IndexMetaData.getInSyncAllocationIds() and IndexMetaData.primaryTerm(int) based on
the changes made during this allocation.oldMetaData - MetaData object from before the routing nodes was changed.newRoutingTable - RoutingTable object after routing changes were applied.MetaData, potentially the original one if no change was needed.public static ClusterState removeStaleIdsWithoutRoutings(ClusterState clusterState, java.util.List<StaleShard> staleShards)