org.apache.cassandra.db.migration
Class Migration

java.lang.Object
  extended by org.apache.cassandra.db.migration.Migration
Direct Known Subclasses:
AddColumnFamily, AddKeyspace, DropColumnFamily, DropKeyspace, UpdateColumnFamily, UpdateKeyspace

public abstract class Migration
extends java.lang.Object

A migration represents a single metadata mutation (cf dropped, added, etc.). There are two parts to a migration (think of it as a schema update): 1. data is written to the schema cf (SCHEMA_KEYSPACES_CF). 2. updated models are applied to the cassandra instance. Since all steps 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.


Field Summary
static java.nio.ByteBuffer LAST_MIGRATION_KEY
           
protected static org.slf4j.Logger logger
           
static java.lang.String MIGRATIONS_CF
           
static java.lang.String NAME_VALIDATOR_REGEX
           
static java.lang.String SCHEMA_CF
           
protected  long timestamp
           
 
Method Summary
 void announce()
          Send schema update (in form of row mutations) to alive nodes in the cluster.
 void apply()
           
protected abstract  void applyImpl()
          Class specific apply implementation where schema migration logic should be put
static java.util.UUID getLastMigrationId()
          Deprecated. 
static boolean isLegalName(java.lang.String s)
           
 void passiveAnnounce()
          Announce new schema version over Gossip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.slf4j.Logger logger

NAME_VALIDATOR_REGEX

public static final java.lang.String NAME_VALIDATOR_REGEX
See Also:
Constant Field Values

MIGRATIONS_CF

public static final java.lang.String MIGRATIONS_CF
See Also:
Constant Field Values

SCHEMA_CF

public static final java.lang.String SCHEMA_CF
See Also:
Constant Field Values

LAST_MIGRATION_KEY

public static final java.nio.ByteBuffer LAST_MIGRATION_KEY

timestamp

protected final long timestamp
Method Detail

apply

public final void apply()
                 throws ConfigurationException,
                        java.io.IOException
Throws:
ConfigurationException
java.io.IOException

applyImpl

protected abstract void applyImpl()
                           throws ConfigurationException,
                                  java.io.IOException
Class specific apply implementation where schema migration logic should be put

Throws:
java.io.IOException - on any I/O related error.
ConfigurationException - if there is object misconfiguration.

announce

public final void announce()
Send schema update (in form of row mutations) to alive nodes in the cluster. apply() must be called first.


passiveAnnounce

public final void passiveAnnounce()
Announce new schema version over Gossip


getLastMigrationId

@Deprecated
public static java.util.UUID getLastMigrationId()
Deprecated. 

Used only in case node has old style migration schema (newly updated)

Returns:
the UUID identifying version of the last applied migration

isLegalName

public static boolean isLegalName(java.lang.String s)


Copyright © 2012 The Apache Software Foundation