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/15 18:42:17 UTC
[1/3] cassandra git commit: cqlsh: Add LOGIN command to switch users
Repository: cassandra
Updated Branches:
refs/heads/trunk 266c5043c -> 22d9de6de
cqlsh: Add LOGIN command to switch users
Patch by Sachin Janani and Carl Yeksigian; reviewed by Tyler Hobbs for
CASSANDRA-7212
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0b92967d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0b92967d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0b92967d
Branch: refs/heads/trunk
Commit: 0b92967d3046ce7893106fd587fc553badc12280
Parents: d475528
Author: Carl Yeksigian <ca...@apache.org>
Authored: Fri May 15 11:36:06 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri May 15 11:36:06 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b92967d/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 00cc335..a9d04d6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.0.16:
+ * (cqlsh) Add LOGIN command to switch users (CASSANDRA-7212)
* Clone SliceQueryFilter in AbstractReadCommand implementations (CASSANDRA-8940)
* Push correct protocol notification for DROP INDEX (CASSANDRA-9310)
* token-generator - generated tokens too long (CASSANDRA-9300)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/0b92967d/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index a165dca..fa0de7f 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -197,6 +197,7 @@ my_commands_ending_with_newline = (
'show',
'source',
'capture',
+ 'login',
'debug',
'tracing',
'expand',
@@ -222,6 +223,7 @@ cqlsh_extra_syntax_rules = r'''
| <sourceCommand>
| <captureCommand>
| <copyCommand>
+ | <loginCommand>
| <debugCommand>
| <helpCommand>
| <tracingCommand>
@@ -290,6 +292,9 @@ cqlsh_extra_syntax_rules = r'''
<expandCommand> ::= "EXPAND" ( switch=( "ON" | "OFF" ) )?
;
+<loginCommand> ::= "LOGIN" username=<username> (password=<stringLiteral>)?
+ ;
+
<exitCommand> ::= "exit" | "quit"
;
@@ -1825,6 +1830,35 @@ class Shell(cmd.Cmd):
self.cursor.consistency_level = level.upper()
print 'Consistency level set to %s.' % (level.upper(),)
+ def do_login(self, parsed):
+ """
+ LOGIN [cqlsh only]
+
+ Changes login information without requiring restart.
+
+ LOGIN <username> (<password>)
+
+ Login using the specified username. If password is specified, it will be used
+ otherwise, you will be prompted to enter.
+ """
+ username = parsed.get_binding('username')
+ password = parsed.get_binding('password')
+ if password is None:
+ password = getpass.getpass()
+ else:
+ password = password[1:-1]
+
+ transport = self.transport_factory(self.hostname, self.port, os.environ, CONFIG_FILE)
+ conn = cql.connect(self.hostname, self.port, keyspace=self.current_keyspace, user=username,
+ password=password, cql_version=self.conn.cql_version,
+ transport=transport)
+
+ self.username = username
+ self.password = password
+ self.conn=conn
+ self.cursor = self.conn.cursor()
+ self.get_connection_versions()
+
def do_exit(self, parsed=None):
"""
EXIT/QUIT [cqlsh only]
[3/3] 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/22d9de6d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/22d9de6d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/22d9de6d
Branch: refs/heads/trunk
Commit: 22d9de6def152dc5fba4a72ecfea61b3f31feab5
Parents: 266c504 9f8c45d
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Fri May 15 11:42:06 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri May 15 11:42:06 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/22d9de6d/CHANGES.txt
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/22d9de6d/bin/cqlsh
----------------------------------------------------------------------
[2/3] 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/9f8c45d6
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9f8c45d6
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9f8c45d6
Branch: refs/heads/trunk
Commit: 9f8c45d6d6b8581bde536475d366b7783f9a7767
Parents: 7d6a60d 0b92967
Author: Tyler Hobbs <ty...@gmail.com>
Authored: Fri May 15 11:41:25 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri May 15 11:41:25 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/9f8c45d6/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 129f6a1,a9d04d6..c85d031
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,30 -1,5 +1,31 @@@
-2.0.16:
+2.1.6
+ * Warn on misuse of unlogged batches (CASSANDRA-9282)
+ * Failure detector detects and ignores local pauses (CASSANDRA-9183)
+ * Add utility class to support for rate limiting a given log statement (CASSANDRA-9029)
+ * Add missing consistency levels to cassandra-stess (CASSANDRA-9361)
+ * Fix commitlog getCompletedTasks to not increment (CASSANDRA-9339)
+ * Fix for harmless exceptions logged as ERROR (CASSANDRA-8564)
+ * Delete processed sstables in sstablesplit/sstableupgrade (CASSANDRA-8606)
+ * Improve sstable exclusion from partition tombstones (CASSANDRA-9298)
+ * Validate the indexed column rather than the cell's contents for 2i (CASSANDRA-9057)
+ * 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)
+ * Repair waits for anticompaction to finish (CASSANDRA-9097)
+ * Fix streaming not holding ref when stream error (CASSANDRA-9295)
+ * Fix canonical view returning early opened SSTables (CASSANDRA-9396)
+Merged from 2.0:
+ * (cqlsh) Add LOGIN command to switch users (CASSANDRA-7212)
* Clone SliceQueryFilter in AbstractReadCommand implementations (CASSANDRA-8940)
* Push correct protocol notification for DROP INDEX (CASSANDRA-9310)
* token-generator - generated tokens too long (CASSANDRA-9300)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/9f8c45d6/bin/cqlsh
----------------------------------------------------------------------
diff --cc bin/cqlsh
index 9a6504a,fa0de7f..a4cc5d4
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@@ -331,9 -292,9 +333,12 @@@ cqlsh_extra_syntax_rules = r''
<expandCommand> ::= "EXPAND" ( switch=( "ON" | "OFF" ) )?
;
+<pagingCommand> ::= "PAGING" ( switch=( "ON" | "OFF" ) )?
+ ;
+
+ <loginCommand> ::= "LOGIN" username=<username> (password=<stringLiteral>)?
+ ;
+
<exitCommand> ::= "exit" | "quit"
;
@@@ -1941,38 -1824,41 +1946,75 @@@ class Shell(cmd.Cmd)
"""
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_login(self, parsed):
+ """
+ LOGIN [cqlsh only]
+
+ Changes login information without requiring restart.
+
+ LOGIN <username> (<password>)
+
+ Login using the specified username. If password is specified, it will be used
+ otherwise, you will be prompted to enter.
+ """
+ username = parsed.get_binding('username')
+ password = parsed.get_binding('password')
+ if password is None:
+ password = getpass.getpass()
+ else:
+ password = password[1:-1]
+
- transport = self.transport_factory(self.hostname, self.port, os.environ, CONFIG_FILE)
- conn = cql.connect(self.hostname, self.port, keyspace=self.current_keyspace, user=username,
- password=password, cql_version=self.conn.cql_version,
- transport=transport)
++ auth_provider = PlainTextAuthProvider(username=username, password=password)
++
++ conn = Cluster(contact_points=(self.hostname,), port=self.port, cql_version=self.conn.cql_version,
++ protocol_version=DEFAULT_PROTOCOL_VERSION,
++ auth_provider=auth_provider,
++ ssl_options=self.conn.ssl_options,
++ load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]))
+
++ if self.current_keyspace:
++ session = conn.connect(self.current_keyspace)
++ else:
++ session = conn.connect()
++
++ # Update after we've connected in case we fail to authenticate
++ self.conn = conn
++ self.auth_provider = auth_provider
+ self.username = username
- self.password = password
- self.conn=conn
- self.cursor = self.conn.cursor()
- self.get_connection_versions()
++ self.session = session
+
def do_exit(self, parsed=None):
"""
EXIT/QUIT [cqlsh only]