You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mi...@apache.org on 2014/05/09 00:35:03 UTC
[6/8] git commit: Merge branch 'cassandra-2.0' into cassandra-2.1
Merge branch 'cassandra-2.0' into cassandra-2.1
Conflicts:
CHANGES.txt
bin/cqlsh
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/56136946
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/56136946
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/56136946
Branch: refs/heads/trunk
Commit: 56136946a7bdc7fe4374661174afb05150c11f05
Parents: 7502359 d48c797
Author: Mikhail Stepura <mi...@apache.org>
Authored: Thu May 8 15:22:17 2014 -0700
Committer: Mikhail Stepura <mi...@apache.org>
Committed: Thu May 8 15:22:17 2014 -0700
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/56136946/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 1ebc050,9e6f173..622d381
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -18,6 -7,25 +18,7 @@@ Merged from 2.0
* Fix disabling autocompaction (CASSANDRA-7187)
* Fix potential NumberFormatException when deserializing IntegerType (CASSANDRA-7088)
* cqlsh can't tab-complete disabling compaction (CASSANDRA-7185)
+ * cqlsh: Accept and execute CQL statement(s) from command-line parameter (CASSANDRA-7172)
-
-
-2.0.8
- * Correctly delete scheduled range xfers (CASSANDRA-7143)
- * Make batchlog replica selection rack-aware (CASSANDRA-6551)
- * Allow overriding cassandra-rackdc.properties file (CASSANDRA-7072)
- * Set JMX RMI port to 7199 (CASSANDRA-7087)
- * Use LOCAL_QUORUM for data reads at LOCAL_SERIAL (CASSANDRA-6939)
- * Log a warning for large batches (CASSANDRA-6487)
- * Queries on compact tables can return more rows that requested (CASSANDRA-7052)
- * USING TIMESTAMP for batches does not work (CASSANDRA-7053)
- * Fix performance regression from CASSANDRA-5614 (CASSANDRA-6949)
- * Merge groupable mutations in TriggerExecutor#execute() (CASSANDRA-7047)
- * Fix CFMetaData#getColumnDefinitionFromColumnName() (CASSANDRA-7074)
- * Plug holes in resource release when wiring up StreamSession (CASSANDRA-7073)
- * Re-add parameter columns to tracing session (CASSANDRA-6942)
- * Fix writetime/ttl functions for static columns (CASSANDRA-7081)
- * Suggest CTRL-C or semicolon after three blank lines in cqlsh (CASSANDRA-7142)
Merged from 1.2:
* Add Cloudstack snitch (CASSANDRA-7147)
* Update system.peers correctly when relocating tokens (CASSANDRA-7126)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/56136946/bin/cqlsh
----------------------------------------------------------------------
diff --cc bin/cqlsh
index ade2f21,6575387..f9b433d
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@@ -168,14 -170,15 +168,15 @@@ parser.add_option('--debug', action='st
parser.add_option('--cqlversion', default=DEFAULT_CQLVER,
help='Specify a particular CQL version (default: %default).'
' Examples: "3.0.3", "3.1.0"')
+ parser.add_option("-e", "--execute", help='Execute the statement and quit.')
-CQL_ERRORS = (cql.Error,)
-try:
- from thrift.Thrift import TException
-except ImportError:
- pass
-else:
- CQL_ERRORS += (TException,)
+CQL_ERRORS = (
+ cassandra.AlreadyExists, cassandra.AuthenticationFailed, cassandra.InvalidRequest,
+ cassandra.Timeout, cassandra.Unauthorized, cassandra.OperationTimedOut,
+ cassandra.cluster.NoHostAvailable,
+ cassandra.connection.ConnectionBusy, cassandra.connection.ProtocolError, cassandra.connection.ConnectionException,
+ cassandra.decoder.ErrorMessage, cassandra.decoder.InternalError, cassandra.query.TraceUnavailable
+)
debug_completion = bool(os.environ.get('CQLSH_DEBUG_COMPLETION', '') == 'YES')
@@@ -461,7 -465,7 +462,8 @@@ class Shell(cmd.Cmd)
tracing_enabled=False, expand_enabled=False,
display_time_format=DEFAULT_TIME_FORMAT,
display_float_precision=DEFAULT_FLOAT_PRECISION,
- ssl=False):
++ ssl=False,
+ single_statement=None):
cmd.Cmd.__init__(self, completekey=completekey)
self.hostname = hostname
self.port = port
@@@ -515,12 -521,9 +517,13 @@@
self.show_line_nums = True
self.stdin = stdin
self.query_out = sys.stdout
+ self.consistency_level = cassandra.ConsistencyLevel.ONE
+ #Python driver returns BLOBs as string, but we expect them as buffer()
+ cassandra.cqltypes.BytesType.deserialize = staticmethod(cassandra.cqltypes.BytesType.validate)
+ cassandra.cqltypes.CassandraType.support_empty_values = True
self.empty_lines = 0
self.statement_error = False
+ self.single_statement = single_statement
def set_expanded_cql_version(self, ver):
ver, vertuple = full_cql_version(ver)
@@@ -1746,10 -1949,9 +1753,11 @@@ def read_options(cmdlineargs, environme
DEFAULT_FLOAT_PRECISION)
optvalues.debug = False
optvalues.file = None
+ optvalues.ssl = False
+
optvalues.tty = sys.stdin.isatty()
optvalues.cqlversion = option_with_default(configs.get, 'cql', 'version', DEFAULT_CQLVER)
+ optvalues.execute = None
(options, arguments) = parser.parse_args(cmdlineargs, values=optvalues)
@@@ -1764,9 -1966,14 +1772,12 @@@
if len(arguments) > 1:
port = arguments[1]
- if options.file is not None:
+ if options.file or options.execute:
options.tty = False
+ if options.execute and not options.execute.endswith(';'):
+ options.execute += ';'
+
- options.transport_factory = load_factory(options.transport_factory)
-
if optvalues.color in (True, False):
options.color = optvalues.color
else:
@@@ -1847,7 -2057,7 +1858,8 @@@ def main(options, hostname, port)
keyspace=options.keyspace,
display_time_format=options.time_format,
display_float_precision=options.float_precision,
- ssl=options.ssl)
++ ssl=options.ssl,
+ single_statement=options.execute)
except KeyboardInterrupt:
sys.exit('Connection aborted.')
except CQL_ERRORS, e: