Migration (apache-cassandra API)
Date: 2012-05-04

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.db.migration
Class Migration

    java.lang.Object
      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.). 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(org.apache.cassandra.db.migration.avro.Migration mi)` Deflate this Migration into an Avro object.
`abstract void` | `subinflate(org.apache.cassandra.db.migration.avro.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

### 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

### MIGRATIONS_KEY

    public static final java.nio.ByteBuffer MIGRATIONS_KEY

### LAST_MIGRATION_KEY

    public static final java.nio.ByteBuffer LAST_MIGRATION_KEY

### rm

    protected RowMutation rm

### newVersion

    protected java.util.UUID newVersion

### lastVersion

    protected java.util.UUID lastVersion

### schema

    protected final Schema schema

Constructor Detail

### Migration

    protected Migration()

  Subclasses must have a matching constructor

Method Detail

### apply

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

  apply changes

  Throws:
    `java.io.IOException`
    `ConfigurationException`

### announce

    public final void announce()

  send this migration immediately to existing nodes in the cluster. apply() must be called first.

### passiveAnnounce

    public final void passiveAnnounce()

### getLastMigrationId

    public static java.util.UUID getLastMigrationId()

### subdeflate

    public abstract void subdeflate(org.apache.cassandra.db.migration.avro.Migration mi)

  Deflate this Migration into an Avro object.

### subinflate

    public abstract void subinflate(org.apache.cassandra.db.migration.avro.Migration mi)

  Inflate this Migration from an Avro object: called after the required no-arg constructor.

### getVersion

    public java.util.UUID getVersion()

### serialize

    public java.nio.ByteBuffer serialize()
                                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### deserialize

    public static Migration deserialize(java.nio.ByteBuffer bytes,
                                        int version)
                                 throws java.io.IOException

  Throws:
    `java.io.IOException`

### getLocalMigrations

    public static java.util.Collection<IColumn> getLocalMigrations(java.util.UUID start,
                                                                   java.util.UUID end)

  load serialized migrations.

### toUTF8Bytes

    public static java.nio.ByteBuffer toUTF8Bytes(java.util.UUID version)

### isLegalName

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 The Apache Software Foundation