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.
|
initializedReplicaReinitialized, relocationSourceRemoved, relocationStarted, replicaPromoted, startedPrimaryReinitialized, unassignedInfoUpdated
public void shardInitialized(ShardRouting unassignedShard, ShardRouting initializedShard)
RoutingChangesObserver
shardInitialized
in interface RoutingChangesObserver
shardInitialized
in class RoutingChangesObserver.AbstractRoutingChangesObserver
public void shardStarted(ShardRouting initializingShard, ShardRouting startedShard)
RoutingChangesObserver
shardStarted
in interface RoutingChangesObserver
shardStarted
in class RoutingChangesObserver.AbstractRoutingChangesObserver
public void shardFailed(ShardRouting failedShard, UnassignedInfo unassignedInfo)
RoutingChangesObserver
shardFailed
in interface RoutingChangesObserver
shardFailed
in class RoutingChangesObserver.AbstractRoutingChangesObserver
public void relocationCompleted(ShardRouting removedRelocationSource)
RoutingChangesObserver
relocationCompleted
in interface RoutingChangesObserver
relocationCompleted
in class RoutingChangesObserver.AbstractRoutingChangesObserver
public 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)