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:25:37 UTC

[1/2] git commit: Avoid NPEs when receiving table changes for an unknown keyspace

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.0 84103bbe2 -> a21251654


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-2.0
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;
     }
 
     /**


[2/2] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0

Posted by al...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0

Conflicts:
	src/java/org/apache/cassandra/service/MigrationManager.java


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a2125165
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a2125165
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a2125165

Branch: refs/heads/cassandra-2.0
Commit: a212516548316c958b9ce034f39d13f1c7169357
Parents: 84103bb 5e40a3b
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Wed Feb 19 22:25:28 2014 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Wed Feb 19 22:25:28 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/a2125165/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 2cacbaa,51dec14..83b03de
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -31,34 -15,24 +31,35 @@@ Merged from 1.2
   * 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
 - * Move handling of migration event source to solve bootstrap race (CASSANDRA-6648)
 - * Make sure compaction throughput value doesn't overflow with int math (CASSANDRA-6647)
 -
 -
 -1.2.14
 - * Reverted code to limit CQL prepared statement cache by size (CASSANDRA-6592)
 - * add cassandra.default_messaging_version property to allow easier
 -   upgrading from 1.1 (CASSANDRA-6619)
 - * Allow executing CREATE statements multiple times (CASSANDRA-6471)
 - * Don't send confusing info with timeouts (CASSANDRA-6491)
 - * Don't resubmit counter mutation runnables internally (CASSANDRA-6427)
 - * Don't drop local mutations without a hint (CASSANDRA-6510)
 - * Don't allow null max_hint_window_in_ms (CASSANDRA-6419)
 - * Validate SliceRange start and finish lengths (CASSANDRA-6521)
 +2.0.5
 + * Reduce garbage generated by bloom filter lookups (CASSANDRA-6609)
 + * Add ks.cf names to tombstone logging (CASSANDRA-6597)
 + * Use LOCAL_QUORUM for LWT operations at LOCAL_SERIAL (CASSANDRA-6495)
 + * Wait for gossip to settle before accepting client connections (CASSANDRA-4288)
 + * Delete unfinished compaction incrementally (CASSANDRA-6086)
 + * Allow specifying custom secondary index options in CQL3 (CASSANDRA-6480)
 + * Improve replica pinning for cache efficiency in DES (CASSANDRA-6485)
 + * Fix LOCAL_SERIAL from thrift (CASSANDRA-6584)
 + * Don't special case received counts in CAS timeout exceptions (CASSANDRA-6595)
 + * Add support for 2.1 global counter shards (CASSANDRA-6505)
 + * Fix NPE when streaming connection is not yet established (CASSANDRA-6210)
 + * Avoid rare duplicate read repair triggering (CASSANDRA-6606)
 + * Fix paging discardFirst (CASSANDRA-6555)
 + * Fix ArrayIndexOutOfBoundsException in 2ndary index query (CASSANDRA-6470)
 + * Release sstables upon rebuilding 2i (CASSANDRA-6635)
 + * Add AbstractCompactionStrategy.startup() method (CASSANDRA-6637)
 + * SSTableScanner may skip rows during cleanup (CASSANDRA-6638)
 + * sstables from stalled repair sessions can resurrect deleted data (CASSANDRA-6503)
 + * Switch stress to use ITransportFactory (CASSANDRA-6641)
 + * Fix IllegalArgumentException during prepare (CASSANDRA-6592)
 + * Fix possible loss of 2ndary index entries during compaction (CASSANDRA-6517)
 + * Fix direct Memory on architectures that do not support unaligned long access
 +   (CASSANDRA-6628)
 + * Let scrub optionally skip broken counter partitions (CASSANDRA-5930)
 +Merged from 1.2:
   * fsync compression metadata (CASSANDRA-6531)
   * Validate CF existence on execution for prepared statement (CASSANDRA-6535)
   * Add ability to throttle batchlog replay (CASSANDRA-6550)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2125165/src/java/org/apache/cassandra/service/MigrationManager.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/service/MigrationManager.java
index 7185813,9f6113c..0e36234
--- a/src/java/org/apache/cassandra/service/MigrationManager.java
+++ b/src/java/org/apache/cassandra/service/MigrationManager.java
@@@ -236,7 -236,7 +236,7 @@@ public class MigrationManage
          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()), cfm.ksName));
++        announce(addSerializedKeyspace(oldCfm.toSchemaUpdate(cfm, FBUtilities.timestampMicros(), fromThrift), cfm.ksName));
      }
  
      public static void announceKeyspaceDrop(String ksName) throws ConfigurationException
@@@ -256,7 -256,14 +256,14 @@@
              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);
++        migration.add(SystemKeyspace.readSchemaRow(ksName).cf);
+         return migration;
      }
  
      /**