You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2018/01/15 14:07:55 UTC

[21/23] cassandra git commit: Merge branch 'cassandra-3.0' into cassandra-3.11

Merge branch 'cassandra-3.0' into cassandra-3.11


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

Branch: refs/heads/cassandra-3.11
Commit: 02bbdd63422c57efa4ba2356e72d87a28aebaaf8
Parents: 36375f8 685dde1
Author: Jason Brown <ja...@gmail.com>
Authored: Mon Jan 15 06:03:50 2018 -0800
Committer: Jason Brown <ja...@gmail.com>
Committed: Mon Jan 15 06:05:04 2018 -0800

----------------------------------------------------------------------
 CHANGES.txt                    |  2 ++
 bin/cqlsh.py                   |  8 ++++++--
 pylib/cqlshlib/copyutil.py     |  8 ++++----
 pylib/cqlshlib/cql3handling.py | 18 ++++++++++++++++++
 pylib/cqlshlib/displaying.py   |  1 +
 pylib/cqlshlib/formatting.py   | 18 ++++++++++++++++++
 pylib/cqlshlib/pylexotron.py   |  1 +
 pylib/cqlshlib/wcwidth.py      |  3 +++
 8 files changed, 53 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/02bbdd63/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 973939e,8696653..ebb7a66
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -41,23 -25,11 +41,25 @@@ Merged from 2.2
   * Fix the inspectJvmOptions startup check (CASSANDRA-14112)
   * Fix race that prevents submitting compaction for a table when executor is full (CASSANDRA-13801)
   * Rely on the JVM to handle OutOfMemoryErrors (CASSANDRA-13006)
 + * Grab refs during scrub/index redistribution/cleanup (CASSANDRA-13873)
+ Merged from 2.1:
 - * More PEP8 compliance for cqlsh (CASSANDRA-14021)
 -
 -
 -3.0.15
++ * More PEP8 compiance for cqlsh (CASSANDRA-14021)
 +
 +
 +3.11.1
 + * Fix the computation of cdc_total_space_in_mb for exabyte filesystems (CASSANDRA-13808)
 + * AbstractTokenTreeBuilder#serializedSize returns wrong value when there is a single leaf and overflow collisions (CASSANDRA-13869)
 + * Add a compaction option to TWCS to ignore sstables overlapping checks (CASSANDRA-13418)
 + * BTree.Builder memory leak (CASSANDRA-13754)
 + * Revert CASSANDRA-10368 of supporting non-pk column filtering due to correctness (CASSANDRA-13798)
 + * Add a skip read validation flag to cassandra-stress (CASSANDRA-13772)
 + * Fix cassandra-stress hang issues when an error during cluster connection happens (CASSANDRA-12938)
 + * Better bootstrap failure message when blocked by (potential) range movement (CASSANDRA-13744)
 + * "ignore" option is ignored in sstableloader (CASSANDRA-13721)
 + * Deadlock in AbstractCommitLogSegmentManager (CASSANDRA-13652)
 + * Duplicate the buffer before passing it to analyser in SASI operation (CASSANDRA-13512)
 + * Properly evict pstmts from prepared statements cache (CASSANDRA-13641)
 +Merged from 3.0:
   * Improve TRUNCATE performance (CASSANDRA-13909)
   * Implement short read protection on partition boundaries (CASSANDRA-13595)
   * Fix ISE thrown by UPI.Serializer.hasNext() for some SELECT queries (CASSANDRA-13911)

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

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02bbdd63/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02bbdd63/pylib/cqlshlib/cql3handling.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02bbdd63/pylib/cqlshlib/displaying.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/02bbdd63/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/formatting.py
index cf3b32d,dfef609..803ea63
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@@ -100,18 -99,19 +102,19 @@@ def color_text(bval, colormap, displayw
          displaywidth -= bval.count(r'\\')
      return FormattedValue(bval, coloredval, displaywidth)
  
+ 
  DEFAULT_NANOTIME_FORMAT = '%H:%M:%S.%N'
  DEFAULT_DATE_FORMAT = '%Y-%m-%d'
 -DEFAULT_TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S%z'
  
 -if platform.system() == 'Windows':
 -    DEFAULT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'
 +DEFAULT_TIMESTAMP_FORMAT = os.environ.get('CQLSH_DEFAULT_TIMESTAMP_FORMAT', '')
 +if not DEFAULT_TIMESTAMP_FORMAT:
 +    DEFAULT_TIMESTAMP_FORMAT = '%Y-%m-%d %H:%M:%S.%f%z'
  
  
 -class DateTimeFormat():
 +class DateTimeFormat:
  
      def __init__(self, timestamp_format=DEFAULT_TIMESTAMP_FORMAT, date_format=DEFAULT_DATE_FORMAT,
 -                 nanotime_format=DEFAULT_NANOTIME_FORMAT, timezone=None):
 +                 nanotime_format=DEFAULT_NANOTIME_FORMAT, timezone=None, milliseconds_only=False):
          self.timestamp_format = timestamp_format
          self.date_format = date_format
          self.nanotime_format = nanotime_format
@@@ -237,8 -152,9 +241,10 @@@ def formatter_for(typname)
  def format_value_blob(val, colormap, **_):
      bval = '0x' + binascii.hexlify(val)
      return colorme(bval, colormap, 'blob')
+ 
+ 
  formatter_for('buffer')(format_value_blob)
 +formatter_for('blob')(format_value_blob)
  
  
  def format_python_formatted_type(val, colormap, color, quote=False):
@@@ -259,9 -175,7 +265,10 @@@ def format_value_decimal(val, float_pre
  def format_value_uuid(val, colormap, **_):
      return format_python_formatted_type(val, colormap, 'uuid')
  
+ 
 +formatter_for('timeuuid')(format_value_uuid)
 +
 +
  @formatter_for('inet')
  def formatter_value_inet(val, colormap, quote=False, **_):
      return format_python_formatted_type(val, colormap, 'inet', quote=quote)
@@@ -273,9 -187,7 +280,10 @@@ def format_value_boolean(val, colormap
          val = boolean_styles[0] if val else boolean_styles[1]
      return format_python_formatted_type(val, colormap, 'boolean')
  
+ 
 +formatter_for('boolean')(format_value_boolean)
 +
 +
  def format_floating_point_type(val, colormap, float_precision, decimal_sep=None, thousands_sep=None, **_):
      if math.isnan(val):
          bval = 'NaN'
@@@ -302,8 -214,8 +310,9 @@@
  
      return colorme(bval, colormap, 'float')
  
+ 
  formatter_for('float')(format_floating_point_type)
 +formatter_for('double')(format_floating_point_type)
  
  
  def format_integer_type(val, colormap, thousands_sep=None, **_):
@@@ -348,12 -249,9 +358,13 @@@ def format_value_timestamp(val, colorma
          bval = "'%s'" % bval
      return colorme(bval, colormap, 'timestamp')
  
+ 
 -def strftime(time_format, seconds, timezone=None):
 -    ret_dt = datetime_from_timestamp(seconds).replace(tzinfo=UTC())
 +formatter_for('timestamp')(format_value_timestamp)
 +
 +
 +def strftime(time_format, seconds, microseconds=0, timezone=None):
 +    ret_dt = datetime_from_timestamp(seconds) + datetime.timedelta(microseconds=microseconds)
 +    ret_dt = ret_dt.replace(tzinfo=UTC())
      if timezone:
          ret_dt = ret_dt.astimezone(timezone)
      try:
@@@ -366,24 -264,7 +377,25 @@@
          # able to correctly import timestamps exported as milliseconds since the epoch.
          return '%d' % (seconds * 1000.0)
  
+ 
 +microseconds_regex = re.compile("(.*)(?:\.(\d{1,6}))(.*)")
 +
 +
 +def round_microseconds(val):
 +    """
 +    For COPY TO, we need to round microsecond to milliseconds because server side
 +    TimestampSerializer.dateStringPatterns only parses milliseconds. If we keep microseconds,
 +    users may try to import with COPY FROM a file generated with COPY TO and have problems if
 +    prepared statements are disabled, see CASSANDRA-11631.
 +    """
 +    m = microseconds_regex.match(val)
 +    if not m:
 +        return val
 +
 +    milliseconds = int(m.group(2)) * pow(10, 3 - len(m.group(2)))
 +    return '%s.%03d%s' % (m.group(1), milliseconds, '' if not m.group(3) else m.group(3))
 +
 +
  @formatter_for('Date')
  def format_value_date(val, colormap, **_):
      return format_python_formatted_type(val, colormap, 'date')
@@@ -475,16 -287,15 +487,17 @@@ def format_value_text(val, encoding, co
  
      return bval if colormap is NO_COLOR_MAP else color_text(bval, colormap, wcwidth.wcswidth(bval.decode(encoding)))
  
+ 
  # name alias
  formatter_for('unicode')(format_value_text)
 +formatter_for('text')(format_value_text)
 +formatter_for('ascii')(format_value_text)
  
  
 -def format_simple_collection(val, lbracket, rbracket, encoding,
 +def format_simple_collection(val, cqltype, lbracket, rbracket, encoding,
                               colormap, date_time_format, float_precision, nullval,
                               decimal_sep, thousands_sep, boolean_styles):
 -    subs = [format_value(type(sval), sval, encoding=encoding, colormap=colormap,
 +    subs = [format_value(sval, cqltype=stype, encoding=encoding, colormap=colormap,
                           date_time_format=date_time_format, float_precision=float_precision,
                           nullval=nullval, quote=True, decimal_sep=decimal_sep,
                           thousands_sep=thousands_sep, boolean_styles=boolean_styles)
@@@ -517,11 -328,13 +530,13 @@@ def format_value_tuple(val, cqltype, en
  
  
  @formatter_for('set')
 -def format_value_set(val, encoding, colormap, date_time_format, float_precision, nullval,
 +def format_value_set(val, cqltype, encoding, colormap, date_time_format, float_precision, nullval,
                       decimal_sep, thousands_sep, boolean_styles, **_):
 -    return format_simple_collection(sorted(val), '{', '}', encoding, colormap,
 +    return format_simple_collection(sorted(val), cqltype, '{', '}', encoding, colormap,
                                      date_time_format, float_precision, nullval,
                                      decimal_sep, thousands_sep, boolean_styles)
+ 
+ 
  formatter_for('frozenset')(format_value_set)
  formatter_for('sortedset')(format_value_set)
  formatter_for('SortedSet')(format_value_set)
@@@ -580,10 -393,3 +597,11 @@@ def format_value_utype(val, cqltype, en
          + rb
      displaywidth = 4 * len(subs) + sum(k.displaywidth + v.displaywidth for (k, v) in subs)
      return FormattedValue(bval, coloredval, displaywidth)
 +
++
 +NANOS_PER_MICRO = 1000
 +NANOS_PER_MILLI = 1000 * NANOS_PER_MICRO
 +NANOS_PER_SECOND = 1000 * NANOS_PER_MILLI
 +NANOS_PER_MINUTE = 60 * NANOS_PER_SECOND
 +NANOS_PER_HOUR = 60 * NANOS_PER_MINUTE
 +MONTHS_PER_YEAR = 12


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org