Merge branch 'cassandra-2.0' into cassandra-2.1
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ce7bc6a8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ce7bc6a8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ce7bc6a8 Branch: refs/heads/cassandra-2.1 Commit: ce7bc6a847a448815b243f0a92db0a36eee01100 Parents: 657e160 a212516 Author: Aleksey Yeschenko <[email protected]> Authored: Wed Feb 19 22:26:21 2014 +0300 Committer: Aleksey Yeschenko <[email protected]> Committed: Wed Feb 19 22:26:54 2014 +0300 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../org/apache/cassandra/service/MigrationManager.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce7bc6a8/CHANGES.txt ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce7bc6a8/src/java/org/apache/cassandra/service/MigrationManager.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/service/MigrationManager.java index ee2d178,0e36234..3f535a0 --- a/src/java/org/apache/cassandra/service/MigrationManager.java +++ b/src/java/org/apache/cassandra/service/MigrationManager.java @@@ -208,14 -210,9 +208,14 @@@ public class MigrationManage throw new AlreadyExistsException(cfm.ksName, cfm.cfName); logger.info(String.format("Create new ColumnFamily: %s", cfm)); - announce(cfm.toSchema(FBUtilities.timestampMicros())); + announce(addSerializedKeyspace(cfm.toSchema(FBUtilities.timestampMicros()), cfm.ksName)); } + public static void announceNewType(UserType newType) + { + announce(UTMetaData.toSchema(newType, FBUtilities.timestampMicros())); + } + public static void announceKeyspaceUpdate(KSMetaData ksm) throws ConfigurationException { ksm.validate(); @@@ -239,14 -236,9 +239,14 @@@ oldCfm.validateCompatility(cfm); logger.info(String.format("Update ColumnFamily '%s/%s' From %s To %s", cfm.ksName, cfm.cfName, oldCfm, cfm)); - announce(oldCfm.toSchemaUpdate(cfm, FBUtilities.timestampMicros(), fromThrift)); + announce(addSerializedKeyspace(oldCfm.toSchemaUpdate(cfm, FBUtilities.timestampMicros(), fromThrift), cfm.ksName)); } + public static void announceTypeUpdate(UserType updatedType) + { + announceNewType(updatedType); + } + public static void announceKeyspaceDrop(String ksName) throws ConfigurationException { KSMetaData oldKsm = Schema.instance.getKSMetaData(ksName); @@@ -264,14 -256,16 +264,21 @@@ throw new ConfigurationException(String.format("Cannot drop non existing column family '%s' in keyspace '%s'.", cfName, ksName)); logger.info(String.format("Drop ColumnFamily '%s/%s'", oldCfm.ksName, oldCfm.cfName)); - announce(oldCfm.dropFromSchema(FBUtilities.timestampMicros())); + announce(addSerializedKeyspace(oldCfm.dropFromSchema(FBUtilities.timestampMicros()), ksName)); + } + + // Include the serialized keyspace for when a target node missed the CREATE KEYSPACE migration (see #5631). - private static RowMutation addSerializedKeyspace(RowMutation migration, String ksName) ++ private static Mutation addSerializedKeyspace(Mutation migration, String ksName) + { + migration.add(SystemKeyspace.readSchemaRow(ksName).cf); + return migration; } + public static void announceTypeDrop(UserType droppedType) + { + announce(UTMetaData.dropFromSchema(droppedType, FBUtilities.timestampMicros())); + } + /** * actively announce a new version to active hosts via rpc * @param schema The schema mutation to be applied
