You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2014/02/19 20:22:26 UTC
git commit: Avoid NPEs when receiving table changes for an unknown
keyspace
Repository: cassandra
Updated Branches:
refs/heads/cassandra-1.2 c92b20b30 -> 5e40a3b7c
Avoid NPEs when receiving table changes for an unknown keyspace
patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for CASSANDRA-5631
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/5e40a3b7
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/5e40a3b7
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/5e40a3b7
Branch: refs/heads/cassandra-1.2
Commit: 5e40a3b7c120f430d73ab34db68b361c0313b2eb
Parents: c92b20b
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Feb 19 22:20:25 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Feb 19 22:22:04 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/5e40a3b7/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ffda82c..51dec14 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -15,6 +15,7 @@
* Fix SecondaryIndexManager#deleteFromIndexes() (CASSANDRA-6711)
* Fix snapshot repair not snapshotting coordinator itself (CASSANDRA-6713)
* Support negative timestamps for CQL3 dates in query string (CASSANDRA-6718)
+ * Avoid NPEs when receiving table changes for an unknown keyspace (CASSANDRA-5631)
1.2.15
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5e40a3b7/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/MigrationManager.java b/src/java/org/apache/cassandra/service/MigrationManager.java
index 584415d..9f6113c 100644
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@ -210,7 +210,7 @@ public class MigrationManager
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 announceKeyspaceUpdate(KSMetaData ksm) throws ConfigurationException
@@ -236,7 +236,7 @@ public class MigrationManager
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()));
+ announce(addSerializedKeyspace(oldCfm.toSchemaUpdate(cfm, FBUtilities.timestampMicros()), cfm.ksName));
}
public static void announceKeyspaceDrop(String ksName) throws ConfigurationException
@@ -256,7 +256,14 @@ public class MigrationManager
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)
+ {
+ migration.add(SystemTable.readSchemaRow(ksName).cf);
+ return migration;
}
/**