Package org.apache.cassandra.schema
Class MigrationCoordinator
- java.lang.Object
-
- org.apache.cassandra.schema.MigrationCoordinator
-
public class MigrationCoordinator extends java.lang.ObjectMigration coordinator is responsible for tracking schema versions on various nodes and, if needed, synchronize the schema. It performs periodic checks and if there is a schema version mismatch between the current node and the other node, it pulls the schema and applies the changes locally through the callback. In particular the Migration Coordinator keeps track of all schema versions reported from each node in the cluster. As long as a certain version is advertised by some node, it is being tracked. As long as a version is tracked, the migration coordinator tries to fetch it by its periodic job.
-
-
Field Summary
Fields Modifier and Type Field Description static MigrationCoordinatorinstance
-
Constructor Summary
Constructors Constructor Description MigrationCoordinator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitSchemaRequests(long waitMillis)Wait until we've received schema responses for all versions we're aware ofintgetInflightTasks()protected intgetMaxOutstandingVersionRequests()protected org.apache.cassandra.schema.MigrationCoordinator.VersionInfogetVersionInfoUnsafe(java.util.UUID version)protected booleanisAlive(InetAddressAndPort endpoint)protected booleanisLocalVersion(java.util.UUID version)protected voidmergeSchemaFrom(InetAddressAndPort endpoint, java.util.Collection<Mutation> mutations)java.util.Map<java.util.UUID,java.util.Set<InetAddressAndPort>>outstandingVersions()voidremoveAndIgnoreEndpoint(InetAddressAndPort endpoint)java.util.concurrent.Future<java.lang.Void>reportEndpointVersion(InetAddressAndPort endpoint, java.util.UUID version)java.util.concurrent.Future<java.lang.Void>reportEndpointVersion(InetAddressAndPort endpoint, EndpointState state)voidreset()Resets the migration coordinator by notifying all waiting threads and removing all the existing version info.protected voidsendMigrationMessage(org.apache.cassandra.schema.MigrationCoordinator.Callback callback)static voidsetUptimeFn(java.util.function.LongSupplier supplier)protected booleanshouldPullFromEndpoint(InetAddressAndPort endpoint)protected booleanshouldPullImmediately(InetAddressAndPort endpoint, java.util.UUID version)protected booleanshouldPullSchema(java.util.UUID version)voidstart()
-
-
-
Field Detail
-
instance
public static final MigrationCoordinator instance
-
-
Method Detail
-
setUptimeFn
public static void setUptimeFn(java.util.function.LongSupplier supplier)
-
start
public void start()
-
reset
public void reset()
Resets the migration coordinator by notifying all waiting threads and removing all the existing version info.
-
outstandingVersions
public java.util.Map<java.util.UUID,java.util.Set<InetAddressAndPort>> outstandingVersions()
-
getVersionInfoUnsafe
protected org.apache.cassandra.schema.MigrationCoordinator.VersionInfo getVersionInfoUnsafe(java.util.UUID version)
-
getMaxOutstandingVersionRequests
protected int getMaxOutstandingVersionRequests()
-
isAlive
protected boolean isAlive(InetAddressAndPort endpoint)
-
shouldPullSchema
protected boolean shouldPullSchema(java.util.UUID version)
-
shouldPullFromEndpoint
protected boolean shouldPullFromEndpoint(InetAddressAndPort endpoint)
-
shouldPullImmediately
protected boolean shouldPullImmediately(InetAddressAndPort endpoint, java.util.UUID version)
-
isLocalVersion
protected boolean isLocalVersion(java.util.UUID version)
-
reportEndpointVersion
public java.util.concurrent.Future<java.lang.Void> reportEndpointVersion(InetAddressAndPort endpoint, java.util.UUID version)
-
reportEndpointVersion
public java.util.concurrent.Future<java.lang.Void> reportEndpointVersion(InetAddressAndPort endpoint, EndpointState state)
-
removeAndIgnoreEndpoint
public void removeAndIgnoreEndpoint(InetAddressAndPort endpoint)
-
mergeSchemaFrom
protected void mergeSchemaFrom(InetAddressAndPort endpoint, java.util.Collection<Mutation> mutations)
-
sendMigrationMessage
protected void sendMigrationMessage(org.apache.cassandra.schema.MigrationCoordinator.Callback callback)
-
getInflightTasks
public int getInflightTasks()
-
awaitSchemaRequests
public boolean awaitSchemaRequests(long waitMillis)
Wait until we've received schema responses for all versions we're aware of- Parameters:
waitMillis-- Returns:
- true if response for all schemas were received, false if we timed out waiting
-
-