Package org.apache.cassandra.schema
Class MigrationManager
- java.lang.Object
-
- org.apache.cassandra.schema.MigrationManager
-
public class MigrationManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MigrationManager.MigrationsSerializer
-
Field Summary
Fields Modifier and Type Field Description static MigrationManager
instance
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
announce(java.util.Collection<Mutation> schema)
static void
announce(Mutation change)
static Keyspaces.KeyspacesDiff
announce(SchemaTransformation transformation, boolean locally)
static void
announceNewKeyspace(KeyspaceMetadata ksm)
static void
announceNewKeyspace(KeyspaceMetadata ksm, boolean announceLocally)
static void
announceNewKeyspace(KeyspaceMetadata ksm, long timestamp, boolean announceLocally)
static void
announceNewTable(TableMetadata cfm)
static void
announceTableDrop(java.lang.String ksName, java.lang.String cfName, boolean announceLocally)
static void
announceTableUpdate(TableMetadata tm)
static void
announceTableUpdate(TableMetadata updated, boolean announceLocally)
static java.util.concurrent.Future<?>
announceWithoutPush(java.util.Collection<Mutation> schema)
static java.util.Optional<Mutation>
evolveSystemKeyspace(KeyspaceMetadata keyspace, long generation)
We have a set of non-local, distributed system keyspaces, e.g.static void
resetLocalSchema()
Clear all locally stored schema information and reset schema to initial state.static void
setUptimeFn(java.util.function.LongSupplier supplier)
-
-
-
Field Detail
-
instance
public static final MigrationManager instance
-
-
Method Detail
-
setUptimeFn
public static void setUptimeFn(java.util.function.LongSupplier supplier)
-
announceNewKeyspace
public static void announceNewKeyspace(KeyspaceMetadata ksm) throws ConfigurationException
- Throws:
ConfigurationException
-
announceNewKeyspace
public static void announceNewKeyspace(KeyspaceMetadata ksm, boolean announceLocally) throws ConfigurationException
- Throws:
ConfigurationException
-
announceNewKeyspace
public static void announceNewKeyspace(KeyspaceMetadata ksm, long timestamp, boolean announceLocally) throws ConfigurationException
- Throws:
ConfigurationException
-
announceNewTable
public static void announceNewTable(TableMetadata cfm)
-
announceTableUpdate
public static void announceTableUpdate(TableMetadata tm)
-
announceTableUpdate
public static void announceTableUpdate(TableMetadata updated, boolean announceLocally)
-
announceTableDrop
public static void announceTableDrop(java.lang.String ksName, java.lang.String cfName, boolean announceLocally)
-
announce
public static void announce(Mutation change)
-
announce
public static void announce(java.util.Collection<Mutation> schema)
-
announceWithoutPush
public static java.util.concurrent.Future<?> announceWithoutPush(java.util.Collection<Mutation> schema)
-
announce
public static Keyspaces.KeyspacesDiff announce(SchemaTransformation transformation, boolean locally)
-
resetLocalSchema
public static void resetLocalSchema()
Clear all locally stored schema information and reset schema to initial state. Called by user (via JMX) who wants to get rid of schema disagreement.
-
evolveSystemKeyspace
public static java.util.Optional<Mutation> evolveSystemKeyspace(KeyspaceMetadata keyspace, long generation)
We have a set of non-local, distributed system keyspaces, e.g. system_traces, system_auth, etc. (seeSchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES
), that need to be created on cluster initialisation, and later evolved on major upgrades (sometimes minor too). This method compares the current known definitions of the tables (if the keyspace exists) to the expected, most modern ones expected by the running version of C*; if any changes have been detected, a schema Mutation will be created which, when applied, should make cluster's view of that keyspace aligned with the expected modern definition.- Parameters:
keyspace
- the expected modern definition of the keyspacegeneration
- timestamp to use for the table changes in the schema mutation- Returns:
- empty Optional if the current definition is up to date, or an Optional with the Mutation that would bring the schema in line with the expected definition.
-
-