|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.db.migration.Migration
public abstract class Migration
A migration represents a single metadata mutation (cf dropped, added, etc.). Migrations can be applied locally, or serialized and sent to another machine where it can be applied there. Each migration has a version represented by a TimeUUID that can be used to look up both the Migration itself (see getLocalMigrations) as well as a serialization of the Keyspace definition that was modified. There are three parts to a migration (think of it as a schema update): 1. data is written to the schema cf. 2. the migration is serialized to the migrations cf. 3. updated models are applied to the cassandra instance. Since steps 1, 2 and 3 are not committed atomically, care should be taken to ensure that a node/cluster is reasonably quiescent with regard to the keyspace or columnfamily whose schema is being modified. Each class that extends Migration is required to implement a no arg constructor, which will be used to inflate the object from it's serialized form.
Field Summary | |
---|---|
static java.nio.ByteBuffer |
LAST_MIGRATION_KEY
|
protected java.util.UUID |
lastVersion
|
protected static org.slf4j.Logger |
logger
|
static java.lang.String |
MIGRATIONS_CF
|
static java.nio.ByteBuffer |
MIGRATIONS_KEY
|
static java.lang.String |
NAME_VALIDATOR_REGEX
|
protected java.util.UUID |
newVersion
|
protected RowMutation |
rm
|
protected Schema |
schema
|
static java.lang.String |
SCHEMA_CF
|
Constructor Summary | |
---|---|
protected |
Migration()
Subclasses must have a matching constructor |
Method Summary | |
---|---|
void |
announce()
send this migration immediately to existing nodes in the cluster. |
void |
apply()
apply changes |
static Migration |
deserialize(java.nio.ByteBuffer bytes,
int version)
|
static java.util.UUID |
getLastMigrationId()
|
static java.util.Collection<IColumn> |
getLocalMigrations(java.util.UUID start,
java.util.UUID end)
load serialized migrations. |
java.util.UUID |
getVersion()
|
static boolean |
isLegalName(java.lang.String s)
|
void |
passiveAnnounce()
|
java.nio.ByteBuffer |
serialize()
|
abstract void |
subdeflate(Migration mi)
Deflate this Migration into an Avro object. |
abstract void |
subinflate(Migration mi)
Inflate this Migration from an Avro object: called after the required no-arg constructor. |
static java.nio.ByteBuffer |
toUTF8Bytes(java.util.UUID version)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.slf4j.Logger logger
public static final java.lang.String NAME_VALIDATOR_REGEX
public static final java.lang.String MIGRATIONS_CF
public static final java.lang.String SCHEMA_CF
public static final java.nio.ByteBuffer MIGRATIONS_KEY
public static final java.nio.ByteBuffer LAST_MIGRATION_KEY
protected RowMutation rm
protected java.util.UUID newVersion
protected java.util.UUID lastVersion
protected final Schema schema
Constructor Detail |
---|
protected Migration()
Method Detail |
---|
public final void apply() throws java.io.IOException, ConfigurationException
java.io.IOException
ConfigurationException
public final void announce()
public final void passiveAnnounce()
public static java.util.UUID getLastMigrationId()
public abstract void subdeflate(Migration mi)
public abstract void subinflate(Migration mi)
public java.util.UUID getVersion()
public java.nio.ByteBuffer serialize() throws java.io.IOException
java.io.IOException
public static Migration deserialize(java.nio.ByteBuffer bytes, int version) throws java.io.IOException
java.io.IOException
public static java.util.Collection<IColumn> getLocalMigrations(java.util.UUID start, java.util.UUID end)
public static java.nio.ByteBuffer toUTF8Bytes(java.util.UUID version)
public static boolean isLegalName(java.lang.String s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |