You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/01/02 19:15:21 UTC

[1/2] cassandra git commit: cqlsh: handle schema mismatch on startup

Repository: cassandra
Updated Branches:
  refs/heads/trunk 0ba9c4775 -> 1dcf66b09


cqlsh: handle schema mismatch on startup

Patch by Tyler Hobbs; reviewed by Aleksey Yeschenko for CASSANDRA-8512


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

Branch: refs/heads/trunk
Commit: aeb7d3f2eefcd5aa452012c048341deb814cf0b0
Parents: 4e1e92b
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Fri Jan 2 12:14:24 2015 -0600
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Fri Jan 2 12:14:24 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt |  1 +
 bin/cqlsh   | 25 +++++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aeb7d3f2/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index c222224..1c1bfe2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.1.3
+ * (cqlsh) Handle a schema mismatch being detected on startup (CASSANDRA-8512)
  * Properly calculate expected write size during compaction (CASSANDRA-8532)
  * Invalidate affected prepared statements when a table's columns
    are altered (CASSANDRA-7910)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aeb7d3f2/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index a714f48..363a4f6 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -562,15 +562,32 @@ class Shell(cmd.Cmd):
             self.session = self.conn.connect(keyspace)
         else:
             self.session = self.conn.connect()
+
+        self.color = color
+        self.display_time_format = display_time_format
+        self.display_float_precision = display_float_precision
+
+        # Workaround for CASSANDRA-8521 until PYTHON-205 is resolved.
+        # If there is no schema metadata present (due to a schema mismatch),
+        # get rid of the code that checks for a schema mismatch and force
+        # the schema metadata to be built.
+        if not self.conn.metadata.keyspaces:
+            self.printerr("Warning: schema version mismatch detected; check the schema versions of your "
+                          "nodes in system.local and system.peers.")
+            original_method = self.conn.control_connection._get_schema_mismatches
+            try:
+                self.conn.control_connection._get_schema_mismatches = lambda *args, **kwargs: None
+                future = self.conn.submit_schema_refresh()
+                future.result(timeout=10)
+            finally:
+                self.conn.control_connection._get_schema_mismatches = original_method
+
         self.session.default_timeout = client_timeout
         self.session.row_factory = ordered_dict_factory
         self.get_connection_versions()
 
         self.current_keyspace = keyspace
 
-        self.color = color
-        self.display_time_format = display_time_format
-        self.display_float_precision = display_float_precision
         self.max_trace_wait = max_trace_wait
         self.session.max_trace_wait = max_trace_wait
         if encoding is None:
@@ -980,7 +997,7 @@ class Shell(cmd.Cmd):
                 rows = self.session.execute(statement, trace=self.tracing_enabled)
                 break
             except CQL_ERRORS, err:
-                self.printerr(str(err))
+                self.printerr(str(err.__class__.__name__) + ": " + str(err))
                 return False
             except Exception, err:
                 import traceback


[2/2] cassandra git commit: Merge branch 'cassandra-2.1' into trunk

Posted by ty...@apache.org.
Merge branch 'cassandra-2.1' into trunk


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

Branch: refs/heads/trunk
Commit: 1dcf66b0938a9a73dcb475ea4539ce5f427a95a5
Parents: 0ba9c47 aeb7d3f
Author: Tyler Hobbs <ty...@datastax.com>
Authored: Fri Jan 2 12:15:11 2015 -0600
Committer: Tyler Hobbs <ty...@datastax.com>
Committed: Fri Jan 2 12:15:11 2015 -0600

----------------------------------------------------------------------
 CHANGES.txt |  1 +
 bin/cqlsh   | 25 +++++++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1dcf66b0/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index dbcdcdf,1c1bfe2..6fd55e6
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,48 -1,5 +1,49 @@@
 +3.0
 + * Support index key/value entries on map collections (CASSANDRA-8473)
 + * Modernize schema tables (CASSANDRA-8261)
 + * Support for user-defined aggregation functions (CASSANDRA-8053)
 + * Fix NPE in SelectStatement with empty IN values (CASSANDRA-8419)
 + * Refactor SelectStatement, return IN results in natural order instead
 +   of IN value list order (CASSANDRA-7981)
 + * Support UDTs, tuples, and collections in user-defined
 +   functions (CASSANDRA-7563)
 + * Fix aggregate fn results on empty selection, result column name,
 +   and cqlsh parsing (CASSANDRA-8229)
 + * Mark sstables as repaired after full repair (CASSANDRA-7586)
 + * Extend Descriptor to include a format value and refactor reader/writer
 +   APIs (CASSANDRA-7443)
 + * Integrate JMH for microbenchmarks (CASSANDRA-8151)
 + * Keep sstable levels when bootstrapping (CASSANDRA-7460)
 + * Add Sigar library and perform basic OS settings check on startup (CASSANDRA-7838)
 + * Support for aggregation functions (CASSANDRA-4914)
 + * Remove cassandra-cli (CASSANDRA-7920)
 + * Accept dollar quoted strings in CQL (CASSANDRA-7769)
 + * Make assassinate a first class command (CASSANDRA-7935)
 + * Support IN clause on any clustering column (CASSANDRA-4762)
 + * Improve compaction logging (CASSANDRA-7818)
 + * Remove YamlFileNetworkTopologySnitch (CASSANDRA-7917)
 + * Do anticompaction in groups (CASSANDRA-6851)
 + * Support user-defined functions (CASSANDRA-7395, 7526, 7562, 7740, 7781, 7929,
 +   7924, 7812, 8063, 7813, 7708)
 + * Permit configurable timestamps with cassandra-stress (CASSANDRA-7416)
 + * Move sstable RandomAccessReader to nio2, which allows using the
 +   FILE_SHARE_DELETE flag on Windows (CASSANDRA-4050)
 + * Remove CQL2 (CASSANDRA-5918)
 + * Add Thrift get_multi_slice call (CASSANDRA-6757)
 + * Optimize fetching multiple cells by name (CASSANDRA-6933)
 + * Allow compilation in java 8 (CASSANDRA-7028)
 + * Make incremental repair default (CASSANDRA-7250)
 + * Enable code coverage thru JaCoCo (CASSANDRA-7226)
 + * Switch external naming of 'column families' to 'tables' (CASSANDRA-4369) 
 + * Shorten SSTable path (CASSANDRA-6962)
 + * Use unsafe mutations for most unit tests (CASSANDRA-6969)
 + * Fix race condition during calculation of pending ranges (CASSANDRA-7390)
 + * Fail on very large batch sizes (CASSANDRA-8011)
 + * Improve concurrency of repair (CASSANDRA-6455, 8208)
 +
 +
  2.1.3
+  * (cqlsh) Handle a schema mismatch being detected on startup (CASSANDRA-8512)
   * Properly calculate expected write size during compaction (CASSANDRA-8532)
   * Invalidate affected prepared statements when a table's columns
     are altered (CASSANDRA-7910)