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/05/05 21:45:54 UTC

[1/2] cassandra git commit: cqlsh: Add (LOCAL_)SERIAL consistency levels

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 233ef3403 -> 22527730d


cqlsh: Add (LOCAL_)SERIAL consistency levels

Patch by Carl Yeksigian; reviewed by Stefania Alborghetti for
CASSANDRA-8051


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

Branch: refs/heads/cassandra-2.1
Commit: afe541a4829ac7c6d1ece5a1a034d638eadac921
Parents: 9b77cde
Author: Carl Yeksigian <ca...@apache.org>
Authored: Tue May 5 14:43:56 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue May 5 14:43:56 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                     |   1 +
 lib/cql-internal-only-1.4.1.zip | Bin 92738 -> 0 bytes
 lib/cql-internal-only-1.4.2.zip | Bin 0 -> 95650 bytes
 3 files changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/afe541a4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e9287ec..45c0238 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.15:
+ * (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
  * Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
  * Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
  * Allow scrub to handle corrupted compressed chunks (CASSANDRA-9140)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/afe541a4/lib/cql-internal-only-1.4.1.zip
----------------------------------------------------------------------
diff --git a/lib/cql-internal-only-1.4.1.zip b/lib/cql-internal-only-1.4.1.zip
deleted file mode 100644
index fa33a3a..0000000
Binary files a/lib/cql-internal-only-1.4.1.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/afe541a4/lib/cql-internal-only-1.4.2.zip
----------------------------------------------------------------------
diff --git a/lib/cql-internal-only-1.4.2.zip b/lib/cql-internal-only-1.4.2.zip
new file mode 100644
index 0000000..b4addd6
Binary files /dev/null and b/lib/cql-internal-only-1.4.2.zip differ


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

Posted by ty...@apache.org.
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/22527730
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/22527730
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/22527730

Branch: refs/heads/cassandra-2.1
Commit: 22527730d3da6d8c17c645aa1cd9929be9431326
Parents: 233ef34 afe541a
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Tue May 5 14:45:40 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Tue May 5 14:45:40 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                  |   1 +
 bin/cqlsh                                    |  42 ++++++++++++++++++++--
 lib/cassandra-driver-internal-only-2.5.0.zip | Bin 189224 -> 0 bytes
 lib/cassandra-driver-internal-only-2.5.1.zip | Bin 0 -> 192609 bytes
 4 files changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/22527730/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index da14ca3,45c0238..05728d8
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,18 -1,5 +1,19 @@@
 -2.0.15:
 +2.1.6
 + * Add support for top-k custom 2i queries (CASSANDRA-8717)
 + * Fix error when dropping table during compaction (CASSANDRA-9251)
 + * cassandra-stress supports validation operations over user profiles (CASSANDRA-8773)
 + * Add support for rate limiting log messages (CASSANDRA-9029)
 + * Log the partition key with tombstone warnings (CASSANDRA-8561)
 + * Reduce runWithCompactionsDisabled poll interval to 1ms (CASSANDRA-9271)
 + * Fix PITR commitlog replay (CASSANDRA-9195)
 + * GCInspector logs very different times (CASSANDRA-9124)
 + * Fix deleting from an empty list (CASSANDRA-9198)
 + * Update tuple and collection types that use a user-defined type when that UDT
 +   is modified (CASSANDRA-9148, CASSANDRA-9192)
 + * Use higher timeout for prepair and snapshot in repair (CASSANDRA-9261)
 + * Fix anticompaction blocking ANTI_ENTROPY stage (CASSANDRA-9151)
 +Merged from 2.0:
+  * (cqlsh) Add SERIAL and LOCAL_SERIAL consistency levels (CASSANDRA-8051)
   * Fix index selection during rebuild with certain table layouts (CASSANDRA-9281)
   * Fix partition-level-delete-only workload accounting (CASSANDRA-9194)
   * Allow scrub to handle corrupted compressed chunks (CASSANDRA-9140)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/22527730/bin/cqlsh
----------------------------------------------------------------------
diff --cc bin/cqlsh
index 903cb72,a165dca..9a6504a
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@@ -216,6 -192,6 +216,7 @@@ my_commands_ending_with_newline = 
      'help',
      '?',
      'consistency',
++    'serial',
      'describe',
      'desc',
      'show',
@@@ -247,6 -218,6 +248,7 @@@ cqlsh_extra_syntax_rules = r''
  
  <specialCommand> ::= <describeCommand>
                     | <consistencyCommand>
++                   | <serialConsistencyCommand>
                     | <showCommand>
                     | <sourceCommand>
                     | <captureCommand>
@@@ -286,6 -254,6 +288,13 @@@
                       | "LOCAL_ONE"
                       ;
  
++<serialConsistencyCommand> ::= "SERIAL" "CONSISTENCY" ( level=<serialConsistencyLevel> )?
++                             ;
++
++<serialConsistencyLevel> ::= "SERIAL"
++                           | "LOCAL_SERIAL"
++                           ;
++
  <showCommand> ::= "SHOW" what=( "VERSION" | "HOST" | "SESSION" sessionid=<uuid> )
                  ;
  
@@@ -642,13 -520,6 +651,14 @@@ class Shell(cmd.Cmd)
              self.show_line_nums = True
          self.stdin = stdin
          self.query_out = sys.stdout
 +        self.consistency_level = cassandra.ConsistencyLevel.ONE
++        self.serial_consistency_level = cassandra.ConsistencyLevel.SERIAL;
 +        # the python driver returns BLOBs as string, but we expect them as bytearrays
 +        cassandra.cqltypes.BytesType.deserialize = staticmethod(lambda byts, protocol_version: bytearray(byts))
 +        cassandra.cqltypes.CassandraType.support_empty_values = True
 +
 +        auto_format_udts()
 +
          self.empty_lines = 0
          self.statement_error = False
          self.single_statement = single_statement
@@@ -993,41 -900,57 +1003,41 @@@
          stop_tracing = ksname == 'system_traces' or (ksname is None and self.current_keyspace == 'system_traces')
          self.tracing_enabled = self.tracing_enabled and not stop_tracing
          statement = parsed.extract_orig()
 -        with_default_limit = parsed.get_binding('limit') is None
 -        if with_default_limit:
 -            statement = "%s LIMIT %d;" % (statement[:-1], DEFAULT_SELECT_LIMIT)
 -        self.perform_statement(statement,
 -                               decoder=ErrorHandlingSchemaDecoder,
 -                               with_default_limit=with_default_limit)
 +        self.perform_statement(statement)
          self.tracing_enabled = tracing_was_enabled
  
 -    def perform_statement(self, statement, decoder=None, with_default_limit=False):
 +    def perform_statement(self, statement):
-         stmt = SimpleStatement(statement, consistency_level=self.consistency_level, fetch_size=self.default_page_size if self.use_paging else None)
++        stmt = SimpleStatement(statement, consistency_level=self.consistency_level, serial_consistency_level=self.serial_consistency_level, fetch_size=self.default_page_size if self.use_paging else None)
 +        result = self.perform_simple_statement(stmt)
          if self.tracing_enabled:
 -            session_id = UUID(bytes=self.trace_next_query())
 -            result = self.perform_statement_untraced(statement,
 -                                                     decoder=decoder,
 -                                                     with_default_limit=with_default_limit)
 -            print_trace_session(self, self.cursor, session_id)
 -            return result
 -        else:
 -            return self.perform_statement_untraced(statement,
 -                                                   decoder=decoder,
 -                                                   with_default_limit=with_default_limit)
 +            if stmt.trace:
 +                print_trace(self, stmt.trace)
 +            else:
 +                msg = "Statement trace did not complete within %d seconds" % (self.session.max_trace_wait)
 +                self.writeresult(msg, color=RED)
 +
 +        return result
 +
 +    def parse_for_table_meta(self, query_string):
 +        try:
 +            parsed = cqlruleset.cql_parse(query_string)[1]
 +        except IndexError:
 +            return None
 +        ks = self.cql_unprotect_name(parsed.get_binding('ksname', None))
 +        cf = self.cql_unprotect_name(parsed.get_binding('cfname'))
 +        return self.get_table_meta(ks, cf)
  
 -    def perform_statement_untraced(self, statement, decoder=None, with_default_limit=False):
 +    def perform_simple_statement(self, statement):
          if not statement:
              return False
 -        trynum = 1
 +        rows = None
          while True:
              try:
 -                self.cursor.execute(statement, decoder=decoder)
 +                rows = self.session.execute(statement, trace=self.tracing_enabled)
                  break
 -            except cql.IntegrityError, err:
 -                self.printerr("Attempt #%d: %s" % (trynum, str(err)))
 -                trynum += 1
 -                if trynum > self.num_retries:
 -                    return False
 -                time.sleep(1*trynum)
 -            except cql.ProgrammingError, err:
 -                self.printerr(str(err))
 -                return False
              except CQL_ERRORS, err:
 -                self.printerr(str(err))
 +                self.printerr(str(err.__class__.__name__) + ": " + str(err))
                  return False
 -            except KeyboardInterrupt:
 -                self.cursor.close()
 -                self.conn.terminate_connection()
 -                transport = self.transport_factory(self.hostname, self.port,
 -                                                   os.environ, CONFIG_FILE)
 -                self.conn = cql.connect(self.hostname, self.port, keyspace=self.keyspace,
 -                                        user=self.username, password=self.password,
 -                                        cql_version=self.cql_version, transport=transport)
 -                self.cursor = self.conn.cursor()
 -                return False                
              except Exception, err:
                  import traceback
                  self.printerr(traceback.format_exc())
@@@ -1921,7 -1811,7 +1931,9 @@@
  
             Valid consistency levels:
  
--           ANY, ONE, TWO, THREE, QUORUM, ALL, LOCAL_ONE, LOCAL_QUORUM and EACH_QUORUM.
++           ANY, ONE, TWO, THREE, QUORUM, ALL, LOCAL_ONE, LOCAL_QUORUM, EACH_QUORUM, SERIAL and LOCAL_SERIAL.
++
++           SERIAL and LOCAL_SERIAL may be used only for SELECTs; will be rejected with updates.
  
          CONSISTENCY
  
@@@ -1929,12 -1819,12 +1941,38 @@@
          """
          level = parsed.get_binding('level')
          if level is None:
 -            print 'Current consistency level is %s.' % (self.cursor.consistency_level,)
 +            print 'Current consistency level is %s.' % (cassandra.ConsistencyLevel.value_to_name[self.consistency_level])
              return
  
 -        self.cursor.consistency_level = level.upper()
 +        self.consistency_level = cassandra.ConsistencyLevel.name_to_value[level.upper()]
          print 'Consistency level set to %s.' % (level.upper(),)
  
++    def do_serial(self, parsed):
++        """
++        SERIAL CONSISTENCY [cqlsh only]
++
++           Overrides serial consistency level (default level is SERIAL).
++
++        SERIAL CONSISTENCY <level>
++
++           Sets consistency level for future conditional updates.
++
++           Valid consistency levels:
++
++           SERIAL, LOCAL_SERIAL.
++
++        SERIAL CONSISTENCY
++
++           SERIAL CONSISTENCY with no arguments shows the current consistency level.
++        """
++        level = parsed.get_binding('level')
++        if level is None:
++            print 'Current serial consistency level is %s.' % (cassandra.ConsistencyLevel.value_to_name[self.serial_consistency_level])
++            return
++
++        self.serial_consistency_level = cassandra.ConsistencyLevel.name_to_value[level.upper()]
++        print 'Serial consistency level set to %s.' % (level.upper(),)
++
      def do_exit(self, parsed=None):
          """
          EXIT/QUIT [cqlsh only]

http://git-wip-us.apache.org/repos/asf/cassandra/blob/22527730/lib/cassandra-driver-internal-only-2.5.1.zip
----------------------------------------------------------------------
diff --cc lib/cassandra-driver-internal-only-2.5.1.zip
index 0000000,0000000..ee6ace0
new file mode 100644
Binary files differ