org.apache.cassandra.service
Class MigrationManager

java.lang.Object
  extended by org.apache.cassandra.service.MigrationManager
All Implemented Interfaces:
IEndpointStateChangeSubscriber

public class MigrationManager
extends java.lang.Object
implements IEndpointStateChangeSubscriber


Constructor Summary
MigrationManager()
           
 
Method Summary
static void announceColumnFamilyDrop(java.lang.String ksName, java.lang.String cfName)
           
static void announceColumnFamilyUpdate(CFMetaData cfm)
           
static void announceKeyspaceDrop(java.lang.String ksName)
           
static void announceKeyspaceUpdate(KSMetaData ksm)
           
static void announceNewColumnFamily(CFMetaData cfm)
           
static void announceNewKeyspace(KSMetaData ksm)
           
static java.util.Collection<RowMutation> deserializeMigrationMessage(byte[] data, int version)
          Deserialize migration message considering data compatibility starting from version 1.1
static java.util.UUID getLastMigrationId()
          Deprecated. 
static boolean isReadyForBootstrap()
           
 void onAlive(java.net.InetAddress endpoint, EndpointState state)
           
 void onChange(java.net.InetAddress endpoint, ApplicationState state, VersionedValue value)
           
 void onDead(java.net.InetAddress endpoint, EndpointState state)
           
 void onJoin(java.net.InetAddress endpoint, EndpointState epState)
          Use to inform interested parties about the change in the state for specified endpoint
 void onRemove(java.net.InetAddress endpoint)
           
 void onRestart(java.net.InetAddress endpoint, EndpointState state)
          Called whenever a node is restarted.
static void passiveAnnounce(java.util.UUID version)
          Announce my version passively over gossip.
static void resetLocalSchema()
          Clear all locally stored schema information and reset schema to initial state.
static byte[] serializeSchema(java.util.Collection<RowMutation> schema, int version)
          Serialize given row mutations into raw bytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MigrationManager

public MigrationManager()
Method Detail

onJoin

public void onJoin(java.net.InetAddress endpoint,
                   EndpointState epState)
Description copied from interface: IEndpointStateChangeSubscriber
Use to inform interested parties about the change in the state for specified endpoint

Specified by:
onJoin in interface IEndpointStateChangeSubscriber
Parameters:
endpoint - endpoint for which the state change occurred.
epState - state that actually changed for the above endpoint.

onChange

public void onChange(java.net.InetAddress endpoint,
                     ApplicationState state,
                     VersionedValue value)
Specified by:
onChange in interface IEndpointStateChangeSubscriber

onAlive

public void onAlive(java.net.InetAddress endpoint,
                    EndpointState state)
Specified by:
onAlive in interface IEndpointStateChangeSubscriber

onDead

public void onDead(java.net.InetAddress endpoint,
                   EndpointState state)
Specified by:
onDead in interface IEndpointStateChangeSubscriber

onRestart

public void onRestart(java.net.InetAddress endpoint,
                      EndpointState state)
Description copied from interface: IEndpointStateChangeSubscriber
Called whenever a node is restarted. Note that there is no guarantee when that happens that the node was previously marked down. It will have only if state.isAlive() == false as state is from before the restarted node is marked up.

Specified by:
onRestart in interface IEndpointStateChangeSubscriber

onRemove

public void onRemove(java.net.InetAddress endpoint)
Specified by:
onRemove in interface IEndpointStateChangeSubscriber

isReadyForBootstrap

public static boolean isReadyForBootstrap()

announceNewKeyspace

public static void announceNewKeyspace(KSMetaData ksm)
                                throws ConfigurationException
Throws:
ConfigurationException

announceNewColumnFamily

public static void announceNewColumnFamily(CFMetaData cfm)
                                    throws ConfigurationException
Throws:
ConfigurationException

announceKeyspaceUpdate

public static void announceKeyspaceUpdate(KSMetaData ksm)
                                   throws ConfigurationException
Throws:
ConfigurationException

announceColumnFamilyUpdate

public static void announceColumnFamilyUpdate(CFMetaData cfm)
                                       throws ConfigurationException
Throws:
ConfigurationException

announceKeyspaceDrop

public static void announceKeyspaceDrop(java.lang.String ksName)
                                 throws ConfigurationException
Throws:
ConfigurationException

announceColumnFamilyDrop

public static void announceColumnFamilyDrop(java.lang.String ksName,
                                            java.lang.String cfName)
                                     throws ConfigurationException
Throws:
ConfigurationException

passiveAnnounce

public static void passiveAnnounce(java.util.UUID version)
Announce my version passively over gossip. Used to notify nodes as they arrive in the cluster.

Parameters:
version - The schema version to announce

serializeSchema

public static byte[] serializeSchema(java.util.Collection<RowMutation> schema,
                                     int version)
                              throws java.io.IOException
Serialize given row mutations into raw bytes

Parameters:
schema - The row mutations to serialize
version - The version of the message service to use for serialization
Returns:
serialized mutations
Throws:
java.io.IOException - on failed serialization

deserializeMigrationMessage

public static java.util.Collection<RowMutation> deserializeMigrationMessage(byte[] data,
                                                                            int version)
                                                                     throws java.io.IOException
Deserialize migration message considering data compatibility starting from version 1.1

Parameters:
data - The data of the message from coordinator which hold schema mutations to apply
version - The version of the message
Returns:
The collection of the row mutations to apply on the node (aka schema)
Throws:
java.io.IOException - if message is of incompatible version or data is corrupted

resetLocalSchema

public static void resetLocalSchema()
                             throws java.io.IOException
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.

Throws:
java.io.IOException - if schema tables truncation fails

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


Copyright © 2012 The Apache Software Foundation