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 2016/03/08 10:26:59 UTC

[20/23] cassandra git commit: Merge commit 'b74ffeafd2e08a7669013d6b4ba87980e1ad5379' into cassandra-3.0

Merge commit 'b74ffeafd2e08a7669013d6b4ba87980e1ad5379' into cassandra-3.0


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

Branch: refs/heads/cassandra-3.0
Commit: 49c616cf0fc9c8d4649e2ec71a07fb9fd7831318
Parents: 34b07a7 b74ffea
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Mar 8 10:23:48 2016 +0100
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Mar 8 10:24:26 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt                |    2 +-
 bin/cqlsh.py               |   33 +-
 pylib/cqlshlib/copyutil.py | 1168 +++++++++++++++++++++++++--------------
 pylib/cqlshlib/util.py     |   35 +-
 pylib/setup.py             |    2 +
 5 files changed, 821 insertions(+), 419 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/49c616cf/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 38bf2ee,7b67cdc..5b92143
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,39 -1,11 +1,39 @@@
 -2.2.6
 +3.0.5
 + * Fix filtering on non-primary key columns for queries without index (CASSANDRA-6377)
 + * Fix sstableloader fail when using materialized view (CASSANDRA-11275)
 +Merged from 2.2:
   * Fix AE in nodetool cfstats (backport CASSANDRA-10859) (CASSANDRA-11297)
   * Unresolved hostname leads to replace being ignored (CASSANDRA-11210)
 - * Fix filtering on non-primary key columns for thrift static column families
 -   (CASSANDRA-6377)
   * Only log yaml config once, at startup (CASSANDRA-11217)
 - * Preserve order for preferred SSL cipher suites (CASSANDRA-11164)
   * Reference leak with parallel repairs on the same table (CASSANDRA-11215)
 +Merged from 2.1:
 + * InvalidateKeys should have a weak ref to key cache (CASSANDRA-11176)
- 
++ * COPY FROM on large datasets: fix progress report and debug performance (CASSANDRA-11053)
 +
 +3.0.4
 + * Preserve order for preferred SSL cipher suites (CASSANDRA-11164)
 + * MV should only query complex columns included in the view (CASSANDRA-11069)
 + * Failed aggregate creation breaks server permanently (CASSANDRA-11064)
 + * Add sstabledump tool (CASSANDRA-7464)
 + * Introduce backpressure for hints (CASSANDRA-10972)
 + * Fix ClusteringPrefix not being able to read tombstone range boundaries (CASSANDRA-11158)
 + * Prevent logging in sandboxed state (CASSANDRA-11033)
 + * Disallow drop/alter operations of UDTs used by UDAs (CASSANDRA-10721)
 + * Add query time validation method on Index (CASSANDRA-11043)
 + * Avoid potential AssertionError in mixed version cluster (CASSANDRA-11128)
 + * Properly handle hinted handoff after topology changes (CASSANDRA-5902)
 + * AssertionError when listing sstable files on inconsistent disk state (CASSANDRA-11156)
 + * Fix wrong rack counting and invalid conditions check for TokenAllocation
 +   (CASSANDRA-11139)
 + * Avoid creating empty hint files (CASSANDRA-11090)
 + * Fix leak detection strong reference loop using weak reference (CASSANDRA-11120)
 + * Configurie BatchlogManager to stop delayed tasks on shutdown (CASSANDRA-11062)
 + * Hadoop integration is incompatible with Cassandra Driver 3.0.0 (CASSANDRA-11001)
 + * Add dropped_columns to the list of schema table so it gets handled
 +   properly (CASSANDRA-11050)
 + * Fix NPE when using forceRepairRangeAsync without DC (CASSANDRA-11239)
 +Merged from 2.2:
 + * Unresolved hostname leads to replace being ignored (CASSANDRA-11210)
   * Range.compareTo() violates the contract of Comparable (CASSANDRA-11216)
   * Avoid NPE when serializing ErrorMessage with null message (CASSANDRA-11167)
   * Replacing an aggregate with a new version doesn't reset INITCOND (CASSANDRA-10840)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/49c616cf/bin/cqlsh.py
----------------------------------------------------------------------
diff --cc bin/cqlsh.py
index 9dd9634,9082d72..83dbeed
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@@ -602,24 -593,25 +602,44 @@@ def insert_driver_hooks()
  
  
  def extend_cql_deserialization():
-     # The python driver returns BLOBs as string, but we expect them as bytearrays
+     """
 -    The python driver returns BLOBs as string, but we expect them as bytearrays; therefore we change
++    The python driver returns BLOBs as string, but we expect them as bytearrays
+     the implementation of cassandra.cqltypes.BytesType.deserialize.
+ 
+     The deserializers package exists only when the driver has been compiled with cython extensions and
+     cassandra.deserializers.DesBytesType replaces cassandra.cqltypes.BytesType.deserialize.
+ 
+     DesBytesTypeByteArray is a fast deserializer that converts blobs into bytearrays but it was
+     only introduced recently (3.1.0). If it is available we use it, otherwise we remove
+     cassandra.deserializers.DesBytesType so that we fall back onto cassandra.cqltypes.BytesType.deserialize
+     just like in the case where no cython extensions are present.
+     """
+     if hasattr(cassandra, 'deserializers'):
+         if hasattr(cassandra.deserializers, 'DesBytesTypeByteArray'):
+             cassandra.deserializers.DesBytesType = cassandra.deserializers.DesBytesTypeByteArray
+         else:
+             del cassandra.deserializers.DesBytesType
+ 
      cassandra.cqltypes.BytesType.deserialize = staticmethod(lambda byts, protocol_version: bytearray(byts))
 +
 +    class DateOverFlowWarning(RuntimeWarning):
 +        pass
 +
 +    # Native datetime types blow up outside of datetime.[MIN|MAX]_YEAR. We will fall back to an int timestamp
 +    def deserialize_date_fallback_int(byts, protocol_version):
 +        timestamp_ms = int64_unpack(byts)
 +        try:
 +            return datetime_from_timestamp(timestamp_ms / 1000.0)
 +        except OverflowError:
 +            warnings.warn(DateOverFlowWarning("Some timestamps are larger than Python datetime can represent. Timestamps are displayed in milliseconds from epoch."))
 +            return timestamp_ms
 +
 +    cassandra.cqltypes.DateType.deserialize = staticmethod(deserialize_date_fallback_int)
 +
++    if hasattr(cassandra, 'deserializers'):
++        del cassandra.deserializers.DesDateType
++
 +    # Return cassandra.cqltypes.EMPTY instead of None for empty values
      cassandra.cqltypes.CassandraType.support_empty_values = True
  
  

http://git-wip-us.apache.org/repos/asf/cassandra/blob/49c616cf/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/copyutil.py
index aeb2d0b,2755dd5..6be990d
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@@ -1484,7 -1714,7 +1714,13 @@@ class ImportConversion(object)
  
              m = p.match(val)
              if not m:
--                raise ValueError("can't interpret %r as a date with this format: %s" % (val, self.date_time_format))
++                try:
++                    # in case of overflow COPY TO prints dates as milliseconds from the epoch, see
++                    # deserialize_date_fallback_int in cqlsh.py
++                    return int(val)
++                except ValueError:
++                    raise ValueError("can't interpret %r as a date with format %s or as int" % (val,
++                                                                                                self.date_time_format))
  
              # https://docs.python.org/2/library/time.html#time.struct_time
              tval = time.struct_time((int(m.group(1)), int(m.group(2)), int(m.group(3)),  # year, month, day