You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2012/12/10 16:23:59 UTC
[3/4] git commit: Merge branch 'cassandra-1.1' into cassandra-1.2.0
Merge branch 'cassandra-1.1' into cassandra-1.2.0
Conflicts:
CHANGES.txt
bin/cqlsh
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/24f95e03
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/24f95e03
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/24f95e03
Branch: refs/heads/trunk
Commit: 24f95e03c4c6acd647248caac6642b33a32fc1c2
Parents: 9210d57 36b183f
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Mon Dec 10 18:20:59 2012 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Mon Dec 10 18:20:59 2012 +0300
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/formatting.py | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/24f95e03/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 301afd2,43fe188..aea7212
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,60 -1,15 +1,61 @@@
-1.1.8
+1.2-rc1
+ * rename rpc_timeout settings to request_timeout (CASSANDRA-5027)
+ * add BF with 0.1 FP to LCS by default (CASSANDRA-5029)
+ * Fix preparing insert queries (CASSANDRA-5016)
+ * Fix preparing queries with counter increment (CASSANDRA-5022)
+ * Fix preparing updates with collections (CASSANDRA-5017)
+ * Don't generate UUID based on other node address (CASSANDRA-5002)
+ * Fix message when trying to alter a clustering key type (CASSANDRA-5012)
+ * Update IAuthenticator to match the new IAuthorizer (CASSANDRA-5003)
+Merged from 1.1
* reduce log spam from invalid counter shards (CASSANDRA-5026)
* Improve schema propagation performance (CASSANDRA-5025)
- * Fall back to old describe_splits if d_s_ex is not available (CASSANDRA-4803)
- * Improve error reporting when streaming ranges fail (CASSANDRA-5009)
+ * Fix for IndexHelper.IndexFor throws OOB Exception (CASSANDRA-5030)
+ * cqlsh: make it possible to describe thrift CFs (CASSANDRA-4827)
+ * cqlsh: fix timestamp formatting on some platforms (CASSANDRA-5046)
-1.1.7
- * cqlsh: improve COPY FROM performance (CASSANDRA-4921)
+1.2-beta3
+ * make consistency level configurable in cqlsh (CASSANDRA-4829)
+ * fix cqlsh rendering of blob fields (CASSANDRA-4970)
+ * fix cqlsh DESCRIBE command (CASSANDRA-4913)
+ * save truncation position in system table (CASSANDRA-4906)
+ * Move CompressionMetadata off-heap (CASSANDRA-4937)
+ * allow CLI to GET cql3 columnfamily data (CASSANDRA-4924)
+ * Fix rare race condition in getExpireTimeForEndpoint (CASSANDRA-4402)
+ * acquire references to overlapping sstables during compaction so bloom filter
+ doesn't get free'd prematurely (CASSANDRA-4934)
+ * Don't share slice query filter in CQL3 SelectStatement (CASSANDRA-4928)
+ * Separate tracing from Log4J (CASSANDRA-4861)
+ * Exclude gcable tombstones from merkle-tree computation (CASSANDRA-4905)
+ * Better printing of AbstractBounds for tracing (CASSANDRA-4931)
+ * Optimize mostRecentTombstone check in CC.collectAllData (CASSANDRA-4883)
+ * Change stream session ID to UUID to avoid collision from same node (CASSANDRA-4813)
+ * Use Stats.db when bulk loading if present (CASSANDRA-4957)
+ * Skip repair on system_trace and keyspaces with RF=1 (CASSANDRA-4956)
+ * (cql3) Remove arbitrary SELECT limit (CASSANDRA-4918)
+ * Correctly handle prepared operation on collections (CASSANDRA-4945)
+ * Fix CQL3 LIMIT (CASSANDRA-4877)
+ * Fix Stress for CQL3 (CASSANDRA-4979)
+ * Remove cassandra specific exceptions from JMX interface (CASSANDRA-4893)
+ * (CQL3) Force using ALLOW FILTERING on potentially inefficient queries (CASSANDRA-4915)
+ * (cql3) Fix adding column when the table has collections (CASSANDRA-4982)
+ * (cql3) Fix allowing collections with compact storage (CASSANDRA-4990)
+ * (cql3) Refuse ttl/writetime function on collections (CASSANDRA-4992)
+ * Replace IAuthority with new IAuthorizer (CASSANDRA-4874)
+ * clqsh: fix KEY pseudocolumn escaping when describing Thrift tables
+ in CQL3 mode (CASSANDRA-4955)
* add basic authentication support for Pig CassandraStorage (CASSANDRA-3042)
* fix CQL2 ALTER TABLE compaction_strategy_class altering (CASSANDRA-4965)
+Merged from 1.1:
+ * Fall back to old describe_splits if d_s_ex is not available (CASSANDRA-4803)
+ * Improve error reporting when streaming ranges fail (CASSANDRA-5009)
+ * Fix cqlsh timestamp formatting of timezone info (CASSANDRA-4746)
+ * Fix assertion failure with leveled compaction (CASSANDRA-4799)
+ * Check for null end_token in get_range_slice (CASSANDRA-4804)
+ * Remove all remnants of removed nodes (CASSANDRA-4840)
+ * Add aut-reloading of the log4j file in debian package (CASSANDRA-4855)
+ * Fix estimated row cache entry size (CASSANDRA-4860)
* reset getRangeSlice filter after finishing a row for get_paged_slice
(CASSANDRA-4919)
* expunge row cache post-truncate (CASSANDRA-4940)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/24f95e03/pylib/cqlshlib/formatting.py
----------------------------------------------------------------------
diff --cc pylib/cqlshlib/formatting.py
index bab3506,0000000..f2fdb95
mode 100644,000000..100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@@ -1,213 -1,0 +1,213 @@@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import re
+import time
+from collections import defaultdict
+from . import wcwidth
+from .displaying import colorme, FormattedValue, DEFAULT_VALUE_COLORS
+from cql import cqltypes
+
+unicode_controlchars_re = re.compile(r'[\x00-\x31\x7f-\xa0]')
+controlchars_re = re.compile(r'[\x00-\x31\x7f-\xff]')
+
+def _show_control_chars(match):
+ txt = repr(match.group(0))
+ if txt.startswith('u'):
+ txt = txt[2:-1]
+ else:
+ txt = txt[1:-1]
+ return txt
+
+bits_to_turn_red_re = re.compile(r'\\([^uUx]|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|U[0-9a-fA-F]{8})')
+
+def _make_turn_bits_red_f(color1, color2):
+ def _turn_bits_red(match):
+ txt = match.group(0)
+ if txt == '\\\\':
+ return '\\'
+ return color1 + txt + color2
+ return _turn_bits_red
+
+default_null_placeholder = 'null'
+default_time_format = ''
+default_float_precision = 3
+default_colormap = DEFAULT_VALUE_COLORS
+empty_colormap = defaultdict(lambda: '')
+
+def format_by_type(cqltype, val, encoding, colormap=None, addcolor=False,
+ nullval=None, time_format=None, float_precision=None):
+ if nullval is None:
+ nullval = default_null_placeholder
+ if val is None:
+ return colorme(nullval, colormap, 'error')
+ if addcolor is False:
+ colormap = empty_colormap
+ elif colormap is None:
+ colormap = default_colormap
+ if time_format is None:
+ time_format = default_time_format
+ if float_precision is None:
+ float_precision = default_float_precision
+ return format_value(cqltype, val, encoding=encoding, colormap=colormap,
+ time_format=time_format, float_precision=float_precision,
+ nullval=nullval)
+
+def format_value_default(val, colormap, **_):
+ val = str(val)
+ escapedval = val.replace('\\', '\\\\')
+ bval = controlchars_re.sub(_show_control_chars, escapedval)
+ tbr = _make_turn_bits_red_f(colormap['hex'], colormap['text'])
+ coloredval = colormap['text'] + bits_to_turn_red_re.sub(tbr, bval) + colormap['reset']
+ return FormattedValue(bval, coloredval)
+
+# Mapping cql type base names ("int", "map", etc) to formatter functions,
+# making format_value a generic function
+_formatters = {}
+
+def format_value(cqltype, val, **kwargs):
+ formatter = _formatters.get(cqltype.typename, format_value_default)
+ return formatter(val, subtypes=cqltype.subtypes, **kwargs)
+
+def formatter_for(typname):
+ def registrator(f):
+ _formatters[typname] = f
+ return f
+ return registrator
+
+@formatter_for('blob')
+def format_value_blob(val, colormap, **_):
+ bval = ''.join('%02x' % ord(c) for c in val)
+ return colorme(bval, colormap, 'hex')
+
+def format_python_formatted_type(val, colormap, color):
+ bval = str(val)
+ return colorme(bval, colormap, color)
+
+@formatter_for('decimal')
+def format_value_decimal(val, colormap, **_):
+ return format_python_formatted_type(val, colormap, 'decimal')
+
+@formatter_for('uuid')
+def format_value_uuid(val, colormap, **_):
+ return format_python_formatted_type(val, colormap, 'uuid')
+
+@formatter_for('inet')
+def formatter_value_inet(val, colormap, **_):
+ return format_python_formatted_type(val, colormap, 'inet')
+
+@formatter_for('boolean')
+def format_value_boolean(val, colormap, **_):
+ return format_python_formatted_type(val, colormap, 'boolean')
+
+def format_floating_point_type(val, colormap, float_precision, **_):
+ bval = '%.*g' % (float_precision, val)
+ 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, **_):
+ # base-10 only for now; support others?
+ bval = str(val)
+ return colorme(bval, colormap, 'int')
+
+formatter_for('bigint')(format_integer_type)
+formatter_for('int')(format_integer_type)
+formatter_for('varint')(format_integer_type)
+formatter_for('counter')(format_integer_type)
+
+@formatter_for('timestamp')
+def format_value_timestamp(val, colormap, time_format, **_):
+ bval = strftime(time_format, val)
+ return colorme(bval, colormap, 'timestamp')
+
+@formatter_for('timeuuid')
+def format_value_timeuuid(val, colormap, time_format, **_):
+ utime = cqltypes.unix_time_from_uuid1(val)
+ bval = strftime(time_format, utime)
+ return colorme(bval, colormap, 'timestamp')
+
+def strftime(time_format, seconds):
+ local = time.localtime(seconds)
+ formatted = time.strftime(time_format, local)
+ if local.tm_isdst != 0:
+ offset = -time.altzone
+ else:
+ offset = -time.timezone
- if formatted[-4] != '0000' or time_format[-2] != '%z' or offset == 0:
++ if formatted[-4:] != '0000' or time_format[-2:] != '%z' or offset == 0:
+ return formatted
+ # deal with %z on platforms where it isn't supported. see CASSANDRA-4746.
+ if offset < 0:
+ sign = '-'
+ else:
+ sign = '+'
+ hours, minutes = divmod(abs(offset) / 60, 60)
+ return formatted[:-5] + sign + '{0:0=2}{1:0=2}'.format(hours, minutes)
+
+@formatter_for('text')
+def format_value_text(val, encoding, colormap, **_):
+ escapedval = val.replace(u'\\', u'\\\\')
+ escapedval = unicode_controlchars_re.sub(_show_control_chars, escapedval)
+ bval = escapedval.encode(encoding, 'backslashreplace')
+ displaywidth = wcwidth.wcswidth(bval.decode(encoding))
+ tbr = _make_turn_bits_red_f(colormap['hex'], colormap['text'])
+ coloredval = colormap['text'] + bits_to_turn_red_re.sub(tbr, bval) + colormap['reset']
+ return FormattedValue(bval, coloredval)
+
+# name alias
+formatter_for('varchar')(format_value_text)
+
+def format_simple_collection(subtype, val, lbracket, rbracket, encoding,
+ colormap, time_format, float_precision, nullval):
+ subs = [format_value(subtype, sval, encoding=encoding, colormap=colormap,
+ time_format=time_format, float_precision=float_precision,
+ nullval=nullval)
+ for sval in val]
+ bval = lbracket + ', '.join(sval.strval for sval in subs) + rbracket
+ lb, sep, rb = [colormap['collection'] + s + colormap['reset']
+ for s in (lbracket, ', ', rbracket)]
+ coloredval = lb + sep.join(sval.coloredval for sval in subs) + rb
+ displaywidth = 2 * len(subs) + sum(sval.displaywidth for sval in subs)
+ return FormattedValue(bval, coloredval, displaywidth)
+
+@formatter_for('list')
+def format_value_list(val, encoding, colormap, time_format, float_precision, subtypes, nullval, **_):
+ return format_simple_collection(subtypes[0], val, '[', ']', encoding, colormap,
+ time_format, float_precision, nullval)
+
+@formatter_for('set')
+def format_value_set(val, encoding, colormap, time_format, float_precision, subtypes, nullval, **_):
+ return format_simple_collection(subtypes[0], val, '{', '}', encoding, colormap,
+ time_format, float_precision, nullval)
+
+@formatter_for('map')
+def format_value_map(val, encoding, colormap, time_format, float_precision, subtypes, nullval, **_):
+ def subformat(v, subtype):
+ return format_value(subtype, v, encoding=encoding, colormap=colormap,
+ time_format=time_format, float_precision=float_precision,
+ nullval=nullval)
+
+ subkeytype, subvaltype = subtypes
+ subs = [(subformat(k, subkeytype), subformat(v, subvaltype)) for (k, v) in val.items()]
+ bval = '{' + ', '.join(k.strval + ': ' + v.strval for (k, v) in subs) + '}'
+ lb, comma, colon, rb = [colormap['collection'] + s + colormap['reset']
+ for s in ('{', ', ', ': ', '}')]
+ coloredval = lb \
+ + comma.join(k.coloredval + colon + v.coloredval for (k, v) in subs) \
+ + rb
+ displaywidth = 4 * len(subs) + sum(k.displaywidth + v.displaywidth for (k, v) in subs)
+ return FormattedValue(bval, coloredval, displaywidth)