Class MigrationCoordinator


  • public class MigrationCoordinator
    extends java.lang.Object
    Migration 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.
    • Constructor Detail

      • MigrationCoordinator

        public MigrationCoordinator()
    • 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()
      • 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)
      • removeAndIgnoreEndpoint

        public void removeAndIgnoreEndpoint​(InetAddressAndPort endpoint)
      • 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