Repository: cassandra Updated Branches: refs/heads/cassandra-3.0 edaa69370 -> 2e4763691 refs/heads/trunk fbbedcee8 -> 48e4d5dae
Ensure new CFS is initialized before adding to schema Patch by Sam Tunnicliffe; reviewed by Aleksey Yeschenko for CASSANDRA-12083 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2e476369 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2e476369 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2e476369 Branch: refs/heads/cassandra-3.0 Commit: 2e4763691c39f1424858fcb70a0a5c2a3aeb7836 Parents: edaa693 Author: Sam Tunnicliffe <[email protected]> Authored: Fri Jun 24 11:47:25 2016 +0100 Committer: Sam Tunnicliffe <[email protected]> Committed: Mon Jun 27 15:55:23 2016 +0100 ---------------------------------------------------------------------- CHANGES.txt | 1 + src/java/org/apache/cassandra/config/Schema.java | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/2e476369/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 488fde3..6b0c4f1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.8 + * Fix potential race in schema during new table creation (CASSANDRA-12083) * cqlsh: fix error handling in rare COPY FROM failure scenario (CASSANDRA-12070) * Disable autocompaction during drain (CASSANDRA-11878) * Add a metrics timer to MemtablePool and use it to track time spent blocked on memory in MemtableAllocator (CASSANDRA-11327) http://git-wip-us.apache.org/repos/asf/cassandra/blob/2e476369/src/java/org/apache/cassandra/config/Schema.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/config/Schema.java b/src/java/org/apache/cassandra/config/Schema.java index 03d8e8b..ee1f137 100644 --- a/src/java/org/apache/cassandra/config/Schema.java +++ b/src/java/org/apache/cassandra/config/Schema.java @@ -644,15 +644,13 @@ public class Schema assert getCFMetaData(cfm.ksName, cfm.cfName) == null; // Make sure the keyspace is initialized - Keyspace.open(cfm.ksName); + // and init the new CF before switching the KSM to the new one + // to avoid races as in CASSANDRA-10761 + Keyspace.open(cfm.ksName).initCf(cfm, true); // Update the keyspaces map with the updated metadata update(cfm.ksName, ks -> ks.withSwapped(ks.tables.with(cfm))); // Update the table ID <-> table name map (cfIdMap) load(cfm); - - // init the new CF before switching the KSM to the new one - // to avoid races as in CASSANDRA-10761 - Keyspace.open(cfm.ksName).initCf(cfm, true); MigrationManager.instance.notifyCreateColumnFamily(cfm); }
