http://git-wip-us.apache.org/repos/asf/cassandra/blob/503aec74/pylib/cqlshlib/copyutil.py
--
diff --cc pylib/cqlshlib/copyutil.py
index b72b517,85e2678..c9c5829
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@@ -150,37 -129,28 +150,37 @@@ class SendingChannel(object)
def num_pending(self):
return self.pending_messages.qsize() if self.pending_messages else 0
-def recv(self):
-with self.rlock:
-return self.reader.recv()
+def close(self):
+self.pipe.close()
+
+
+class SendingChannels(object):
+"""
+A group of one way channels for sending messages.
+"""
+def __init__(self, num_channels):
+self.pipes = [OneWayPipe() for _ in xrange(num_channels)]
+self.channels = [SendingChannel(p) for p in self.pipes]
+self.num_channels = num_channels
def close(self):
-self.reader.close()
-self.writer.close()
+for ch in self.channels:
+try:
+ch.close()
- except:
++except Exception:
+pass
-class OneWayChannels(object):
+class ReceivingChannels(object):
"""
-A group of one way channels.
+A group of one way channels for receiving messages.
"""
def __init__(self, num_channels):
-self.channels = [OneWayChannel() for _ in xrange(num_channels)]
-self._readers = [ch.reader for ch in self.channels]
-self._rlocks = [ch.rlock for ch in self.channels]
-self._rlocks_by_readers = dict([(ch.reader, ch.rlock) for ch in
self.channels])
+self.pipes = [OneWayPipe() for _ in xrange(num_channels)]
+self.channels = [ReceivingChannel(p) for p in self.pipes]
+self._readers = [p.reader for p in self.pipes]
+self._rlocks = [p.rlock for p in self.pipes]
+self._rlocks_by_readers = dict([(p.reader, p.rlock) for p in
self.pipes])
self.num_channels = num_channels
self.recv = self.recv_select if IS_LINUX else self.recv_polling
http://git-wip-us.apache.org/repos/asf/cassandra/blob/503aec74/pylib/cqlshlib/cql3handling.py
--
diff --cc pylib/cqlshlib/cql3handling.py
index 897ee16,012e383..8224ad9
--- a/pylib/cqlshlib/cql3handling.py
+++ b/pylib/cqlshlib/cql3handling.py
@@@ -34,7 -34,8 +34,8 @@@ class UnexpectedTableStructure(UserWarn
def __str__(self):
return 'Unexpected table structure; may not translate correctly to
CQL. ' + self.msg
+
-SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth')
+SYSTEM_KEYSPACES = ('system', 'system_traces', 'system_auth',
'system_distributed')
NONALTERBALE_KEYSPACES = ('system')
@@@ -785,10 -691,17 +792,11 @@@ def select_relation_lhs_completer(ctxt
filterable.add(layout.clustering_key[num].name)
else:
break
-for cd in layout.columns.values():
-if cd.index:
-filterable.add(cd.name)
+for idx in layout.indexes.itervalues():
+filterable.add(idx.index_options["target"])
return map(maybe_escape_name, filterable)
+
-@completer_for('selectClause', 'star')
-def select_count_star_completer(ctxt, cass):
-return ['*']
-
-
explain_completion('selector', 'colname')
syntax_rules += r'''
@@@ -1178,12 -1076,11 +1193,13 @@@ explain_completion('createUserTypeState
@completer_for('createIndexStatement', 'col')
def create_index_col_completer(ctxt, cass):
+""" Return the columns for which an index doesn't exist yet. """
layout = get_table_meta(ctxt, cass)
-colnames = [cd.name for cd in layout.columns.values() if not cd.index]
+idx_targets = [idx.index_options["target"] for idx in
layout.indexes.itervalues()]
+colnames = [cd.name for cd in layout.columns.values() if cd.name not in
idx_targets]
return map(maybe_escape_name, colnames)
+
syntax_rules += r'''
::= "DROP" "KEYSPACE" ("IF" "EXISTS")?
ksname=
;
@@@ -1403,20 -1246,6 +1421,21 @@@ def username_name_completer(ctxt, cass)
return [maybe_quote(row.values()[0].replace("'", "''")) for row in
session.execute("LIST USERS")]
+@completer_for('rolename', 'role')
+def rolename_completer(ctxt, cass):
+def maybe_quote(name):
+if CqlRuleSet.is_valid_cql3_name(name):
+return name
+return "'%s'" % name
+
+# disable completion for CREATE ROLE.
+if ctxt.matched[0][1].upper() == 'CREATE':
+return [Hint('')]
+
+session = cass.session
+return [maybe_quote(row[0].replace("'", "''")) for row in
session.execute("LIST ROLES")]
+
++
syntax_rules += r'''
::= "CREATE" "TRIGGER" ( "IF" "NOT" "EXISTS" )?
"ON" cf= "USING"
class=
http://git-wip-us.apache.org/repos/asf/cassandra/bl