You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2015/09/29 11:54:07 UTC

[1/2] cassandra git commit: Configurable page size in cqlsh

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 5d918b8fc -> c38235d7c


Configurable page size in cqlsh

patch by enigmacurry; reviewed by philipthompson for CASSANDRA-9855


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

Branch: refs/heads/cassandra-3.0
Commit: 4595ec03f0a30b510d5b5667b537f226563c1da1
Parents: 5fe40a1
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Sep 29 11:52:22 2015 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Sep 29 11:52:22 2015 +0200

----------------------------------------------------------------------
 CHANGES.txt  |  1 +
 bin/cqlsh.py | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4595ec03/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index a83fd53..7e6f1e0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.2
+ * Configurable page size in cqlsh (CASSANDRA-9855)
  * Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761)
  * Cancel transaction for sstables we wont redistribute index summary
    for (CASSANDRA-10270)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4595ec03/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 81c998c..6ff3a96 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -356,7 +356,7 @@ cqlsh_extra_syntax_rules = r'''
 <expandCommand> ::= "EXPAND" ( switch=( "ON" | "OFF" ) )?
                    ;
 
-<pagingCommand> ::= "PAGING" ( switch=( "ON" | "OFF" ) )?
+<pagingCommand> ::= "PAGING" ( switch=( "ON" | "OFF" | /[0-9]+/) )?
                   ;
 
 <loginCommand> ::= "LOGIN" username=<username> (password=<stringLiteral>)?
@@ -637,6 +637,7 @@ class Shell(cmd.Cmd):
         self.keyspace = keyspace
         self.ssl = ssl
         self.tracing_enabled = tracing_enabled
+        self.page_size = self.default_page_size
         self.expand_enabled = expand_enabled
         if use_conn:
             self.conn = use_conn
@@ -1131,7 +1132,7 @@ class Shell(cmd.Cmd):
         self.tracing_enabled = tracing_was_enabled
 
     def perform_statement(self, statement):
-        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)
+        stmt = SimpleStatement(statement, consistency_level=self.consistency_level, serial_consistency_level=self.serial_consistency_level, fetch_size=self.page_size if self.use_paging else None)
         result, future = self.perform_simple_statement(stmt)
 
         if future:
@@ -2248,7 +2249,14 @@ class Shell(cmd.Cmd):
 
           PAGING with no arguments shows the current query paging status.
         """
-        self.use_paging = SwitchCommand("PAGING", "Query paging").execute(self.use_paging, parsed, self.printerr)
+        (self.use_paging, requested_page_size) = SwitchCommandWithValue(
+            "PAGING", "Query paging", value_type=int).execute(self.use_paging, parsed, self.printerr)
+        if self.use_paging and requested_page_size is not None:
+            self.page_size = requested_page_size
+        if self.use_paging:
+            print("Page size: {}".format(self.page_size))
+        else:
+            self.page_size = self.default_page_size
 
     def applycolor(self, text, color=None):
         if not color or not self.color:
@@ -2481,6 +2489,29 @@ class SwitchCommand(object):
             print 'Disabled %s.' % (self.description,)
             return False
 
+class SwitchCommandWithValue(SwitchCommand):
+    """The same as SwitchCommand except it also accepts a value in place of ON.
+    
+    This returns a tuple of the form: (SWITCH_VALUE, PASSED_VALUE)
+    eg: PAGING 50 returns (True, 50)
+        PAGING OFF returns (False, None)
+        PAGING ON returns (True, None)
+
+    The value_type must match for the PASSED_VALUE, otherwise it will return None.
+    """
+    def __init__(self, command, desc, value_type=int):
+        SwitchCommand.__init__(self, command, desc)
+        self.value_type = value_type
+        
+    def execute(self, state, parsed, printerr):
+        binary_switch_value = SwitchCommand.execute(self, state, parsed, printerr)
+        switch = parsed.get_binding('switch')
+        try:
+            value = self.value_type(switch)
+            binary_switch_value = True
+        except (ValueError, TypeError):
+            value = None
+        return (binary_switch_value, value)
 
 def option_with_default(cparser_getter, section, option, default=None):
     try:


[2/2] cassandra git commit: Merge branch 'cassandra-2.2' into cassandra-3.0

Posted by sl...@apache.org.
Merge branch 'cassandra-2.2' into cassandra-3.0

Conflicts:
	CHANGES.txt


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

Branch: refs/heads/cassandra-3.0
Commit: c38235d7cf3dc9cf325e1db762ef589346c9f459
Parents: 5d918b8 4595ec0
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Sep 29 11:54:00 2015 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Sep 29 11:54:00 2015 +0200

----------------------------------------------------------------------
 CHANGES.txt  |  1 +
 bin/cqlsh.py | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 35 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c38235d7/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 851a19b,7e6f1e0..14651fe
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,29 -1,14 +1,30 @@@
 -2.2.2
 +3.0.0-rc1
 + * Fix mixed version read request compatibility for compact static tables
 +   (CASSANDRA-10373)
 + * Fix paging of DISTINCT with static and IN (CASSANDRA-10354)
 + * Allow MATERIALIZED VIEW's SELECT statement to restrict primary key
 +   columns (CASSANDRA-9664)
 + * Move crc_check_chance out of compression options (CASSANDRA-9839)
 + * Fix descending iteration past end of BTreeSearchIterator (CASSANDRA-10301)
 + * Transfer hints to a different node on decommission (CASSANDRA-10198)
 + * Check partition keys for CAS operations during stmt validation (CASSANDRA-10338)
 + * Add custom query expressions to SELECT (CASSANDRA-10217)
 + * Fix minor bugs in MV handling (CASSANDRA-10362)
 + * Allow custom indexes with 0,1 or multiple target columns (CASSANDRA-10124)
 + * Improve MV schema representation (CASSANDRA-9921)
 + * Add flag to enable/disable coordinator batchlog for MV writes (CASSANDRA-10230)
 + * Update cqlsh COPY for new internal driver serialization interface (CASSANDRA-10318)
 + * Give index implementations more control over rebuild operations (CASSANDRA-10312)
 + * Update index file format (CASSANDRA-10314)
 + * Add "shadowable" row tombstones to deal with mv timestamp issues (CASSANDRA-10261)
 + * CFS.loadNewSSTables() broken for pre-3.0 sstables
 + * Cache selected index in read command to reduce lookups (CASSANDRA-10215)
 + * Small optimizations of sstable index serialization (CASSANDRA-10232)
 + * Support for both encrypted and unencrypted native transport connections (CASSANDRA-9590)
 +Merged from 2.2:
+  * Configurable page size in cqlsh (CASSANDRA-9855)
   * Defer default role manager setup until all nodes are on 2.2+ (CASSANDRA-9761)
 - * Cancel transaction for sstables we wont redistribute index summary
 -   for (CASSANDRA-10270)
 - * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209) 
 - * Retry snapshot deletion after compaction and gc on Windows (CASSANDRA-10222)
 - * Fix failure to start with space in directory path on Windows (CASSANDRA-10239)
 - * Fix repair hang when snapshot failed (CASSANDRA-10057)
 - * Fall back to 1/4 commitlog volume for commitlog_total_space on small disks
 -   (CASSANDRA-10199)
 + * Handle missing RoleManager in config after upgrade to 2.2 (CASSANDRA-10209)
  Merged from 2.1:
   * Fix potential ClassCastException during paging (CASSANDRA-10352)
   * Prevent ALTER TYPE from creating circular references (CASSANDRA-10339)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c38235d7/bin/cqlsh.py
----------------------------------------------------------------------