[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/13e153b0 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/13e153b0 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/13e153b0 Branch: refs/heads/trunk Commit: 13e153b090cdebd549d0d1a224c231e9fc1abbe1 Parents: f49579d fdb8c96 Author: Michael Shuler Authored: Thu Jun 15 14:06:17 2017 -0500 Committer: Michael Shuler Committed: Thu Jun 15 14:06:17 2017 -0500 -- build.properties.default | 2 +- build.xml| 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/13e153b0/build.xml -- - To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f0f9cf23 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f0f9cf23 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f0f9cf23 Branch: refs/heads/trunk Commit: f0f9cf232bf51107c855062c8b5b0196d0e90246 Parents: 2593809 eb0f443 Author: Robert Stupp Authored: Thu Feb 9 20:37:32 2017 +0100 Committer: Robert Stupp Committed: Thu Feb 9 20:37:32 2017 +0100 -- CHANGES.txt | 1 + build.xml | 2 +- lib/licenses/netty-all-4.0.23.Final.txt | 202 --- lib/licenses/netty-all-4.0.44.Final.txt | 202 +++ lib/netty-all-4.0.23.Final.jar | Bin 1779991 -> 0 bytes lib/netty-all-4.0.44.Final.jar | Bin 0 -> 2342652 bytes .../org/apache/cassandra/transport/Message.java | 12 +- 7 files changed, 212 insertions(+), 207 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0f9cf23/CHANGES.txt -- diff --cc CHANGES.txt index 086e0e5,0c7d129..c8419ab --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,33 -1,5 +1,34 @@@ -2.1.17 +2.2.9 + * Fix speculative retry bugs (CASSANDRA-13009) + * Fix handling of nulls and unsets in IN conditions (CASSANDRA-12981) + * Remove support for non-JavaScript UDFs (CASSANDRA-12883) + * Fix DynamicEndpointSnitch noop in multi-datacenter situations (CASSANDRA-13074) + * cqlsh copy-from: encode column names to avoid primary key parsing errors (CASSANDRA-12909) + * Temporarily fix bug that creates commit log when running offline tools (CASSANDRA-8616) + * Reduce granuality of OpOrder.Group during index build (CASSANDRA-12796) + * Test bind parameters and unset parameters in InsertUpdateIfConditionTest (CASSANDRA-12980) + * Do not specify local address on outgoing connection when listen_on_broadcast_address is set (CASSANDRA-12673) + * Use saved tokens when setting local tokens on StorageService.joinRing (CASSANDRA-12935) + * cqlsh: fix DESC TYPES errors (CASSANDRA-12914) + * Fix leak on skipped SSTables in sstableupgrade (CASSANDRA-12899) + * Avoid blocking gossip during pending range calculation (CASSANDRA-12281) + * Fix purgeability of tombstones with max timestamp (CASSANDRA-12792) + * Fail repair if participant dies during sync or anticompaction (CASSANDRA-12901) + * cqlsh COPY: unprotected pk values before converting them if not using prepared statements (CASSANDRA-12863) + * Fix Util.spinAssertEquals (CASSANDRA-12283) + * Fix potential NPE for compactionstats (CASSANDRA-12462) + * Prepare legacy authenticate statement if credentials table initialised after node startup (CASSANDRA-12813) + * Change cassandra.wait_for_tracing_events_timeout_secs default to 0 (CASSANDRA-12754) + * Clean up permissions when a UDA is dropped (CASSANDRA-12720) + * Limit colUpdateTimeDelta histogram updates to reasonable deltas (CASSANDRA-7) + * Fix leak errors and execution rejected exceptions when draining (CASSANDRA-12457) + * Fix merkle tree depth calculation (CASSANDRA-12580) + * Make Collections deserialization more robust (CASSANDRA-12618) + * Better handle invalid system roles table (CASSANDRA-12700) + * Split consistent range movement flag correction (CASSANDRA-12786) + * CompactionTasks now correctly drops sstables out of compaction when not enough disk space is available (CASSANDRA-12979) +Merged from 2.1: + * Upgrade netty version to fix memory leak with client encryption (CASSANDRA-13114) * Fix paging for DISTINCT queries on partition keys and static columns (CASSANDRA-13017) * Fix race causing infinite loop if Thrift server is stopped before it starts listening (CASSANDRA-12856) * cqlsh copy-from: sort user type fields in csv (CASSANDRA-12959) http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0f9cf23/build.xml -- diff --cc build.xml index d9f8198,91dc34b..94e4723 --- a/build.xml +++ b/build.xml @@@ -402,26 -400,16 +402,26 @@@ - - + + + - + - + + + + + + + + http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0f9cf23/src/java/org/apache/cassandra/transport/Message.java --
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
Merge branch cassandra-2.1 into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b45cb104 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b45cb104 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b45cb104 Branch: refs/heads/cassandra-3.11 Commit: b45cb10445731fdef67b720ab216a038b9499928 Parents: 2acc15b 70e8b39 Author: Benjamin Lerer Authored: Wed Jan 11 21:08:01 2017 +0100 Committer: Benjamin Lerer Committed: Wed Jan 11 21:09:29 2017 +0100 -- CHANGES.txt | 1 + .../org/apache/cassandra/service/pager/RangeSliceQueryPager.java | 3 ++- test/unit/org/apache/cassandra/service/QueryPagerTest.java| 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b45cb104/CHANGES.txt -- diff --cc CHANGES.txt index a7e89ed,414d6ed..4f769a1 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,33 -1,9 +1,34 @@@ -2.1.17 +2.2.9 + * Remove support for non-JavaScript UDFs (CASSANDRA-12883) + * Fix DynamicEndpointSnitch noop in multi-datacenter situations (CASSANDRA-13074) + * cqlsh copy-from: encode column names to avoid primary key parsing errors (CASSANDRA-12909) + * Temporarily fix bug that creates commit log when running offline tools (CASSANDRA-8616) + * Reduce granuality of OpOrder.Group during index build (CASSANDRA-12796) + * Test bind parameters and unset parameters in InsertUpdateIfConditionTest (CASSANDRA-12980) + * Do not specify local address on outgoing connection when listen_on_broadcast_address is set (CASSANDRA-12673) + * Use saved tokens when setting local tokens on StorageService.joinRing (CASSANDRA-12935) + * cqlsh: fix DESC TYPES errors (CASSANDRA-12914) + * Fix leak on skipped SSTables in sstableupgrade (CASSANDRA-12899) + * Avoid blocking gossip during pending range calculation (CASSANDRA-12281) + * Fix purgeability of tombstones with max timestamp (CASSANDRA-12792) + * Fail repair if participant dies during sync or anticompaction (CASSANDRA-12901) + * cqlsh COPY: unprotected pk values before converting them if not using prepared statements (CASSANDRA-12863) + * Fix Util.spinAssertEquals (CASSANDRA-12283) + * Fix potential NPE for compactionstats (CASSANDRA-12462) + * Prepare legacy authenticate statement if credentials table initialised after node startup (CASSANDRA-12813) + * Change cassandra.wait_for_tracing_events_timeout_secs default to 0 (CASSANDRA-12754) + * Clean up permissions when a UDA is dropped (CASSANDRA-12720) + * Limit colUpdateTimeDelta histogram updates to reasonable deltas (CASSANDRA-7) + * Fix leak errors and execution rejected exceptions when draining (CASSANDRA-12457) + * Fix merkle tree depth calculation (CASSANDRA-12580) + * Make Collections deserialization more robust (CASSANDRA-12618) + * Better handle invalid system roles table (CASSANDRA-12700) + * Split consistent range movement flag correction (CASSANDRA-12786) + * CompactionTasks now correctly drops sstables out of compaction when not enough disk space is available (CASSANDRA-12979) +Merged from 2.1: + * Fix paging for DISTINCT queries on partition keys and static columns (CASSANDRA-13017) * Fix race causing infinite loop if Thrift server is stopped before it starts listening (CASSANDRA-12856) * cqlsh copy-from: sort user type fields in csv (CASSANDRA-12959) - * Fix missed signal when commit log segments are recycled (CASSANDRA-13037) - * Fix RecoveryManagerTruncateTest (CASSANDRA-12802) * Don't skip sstables based on maxLocalDeletionTime (CASSANDRA-12765) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b45cb104/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java -- diff --cc src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java index 8ec9f4c,3ac777e..3b16e0b --- a/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java +++ b/src/java/org/apache/cassandra/service/pager/RangeSliceQueryPager.java @@@ -72,10 -72,10 +72,11 @@@ public class RangeSliceQueryPager exten protected List queryNextPage(int pageSize, ConsistencyLevel consistencyLevel, boolean localQuery) throws RequestExecutionException { -SliceQueryFilter sf = (SliceQueryFilter)columnFilter; +SliceQueryFilter rawFilter = (SliceQueryFilter)columnFilter; +SliceQueryFilter sf = rawFilter.withUpdatedCount(Math.min(rawFilter.count, pageSize)); AbstractBounds keyRange = lastReturnedKey == null ? command.keyRange : makeIncludingKeyBounds(lastReturnedKey); - Composite start = lastReturnedName == nul
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c5fdb32c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c5fdb32c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c5fdb32c Branch: refs/heads/trunk Commit: c5fdb32ceef796514cd0679f425e68c120a3e06e Parents: be6e6ea 83ae5f3 Author: Michael Shuler Authored: Mon Oct 10 17:10:10 2016 -0500 Committer: Michael Shuler Committed: Mon Oct 10 17:10:10 2016 -0500 -- --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2e4a8490 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2e4a8490 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2e4a8490 Branch: refs/heads/cassandra-3.3 Commit: 2e4a8490c4517e30b9897aeadb9161263d2f4abe Parents: b5d6d4f d5b6d1b Author: T Jake Luciani Authored: Tue Jan 26 09:13:37 2016 -0500 Committer: T Jake Luciani Committed: Tue Jan 26 09:13:37 2016 -0500 -- --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e2050c97 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e2050c97 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e2050c97 Branch: refs/heads/trunk Commit: e2050c97147505aa28576d17cba3a012bdef31d3 Parents: ee1c145 abe0c67 Author: T Jake Luciani Authored: Fri Jan 15 09:44:26 2016 -0500 Committer: T Jake Luciani Committed: Fri Jan 15 09:44:26 2016 -0500 -- CHANGES.txt | 1 + .../cassandra/service/StorageService.java | 56 +++- 2 files changed, 31 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2050c97/CHANGES.txt -- diff --cc CHANGES.txt index d04b9d5,4b87ed0..2bfba80 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,26 -1,8 +1,27 @@@ -2.1.13 +2.2.5 + * Avoid NPE when performing sstable tasks (scrub etc.) (CASSANDRA-10980) + * Make sure client gets tombstone overwhelmed warning (CASSANDRA-9465) + * Fix error streaming section more than 2GB (CASSANDRA-10961) + * (cqlsh) Also apply --connect-timeout to control connection + timeout (CASSANDRA-10959) + * Histogram buckets exposed in jmx are sorted incorrectly (CASSANDRA-10975) + * Enable GC logging by default (CASSANDRA-10140) + * Optimize pending range computation (CASSANDRA-9258) + * Skip commit log and saved cache directories in SSTable version startup check (CASSANDRA-10902) + * drop/alter user should be case sensitive (CASSANDRA-10817) + * jemalloc detection fails due to quoting issues in regexv (CASSANDRA-10946) + * Support counter-columns for native aggregates (sum,avg,max,min) (CASSANDRA-9977) + * (cqlsh) show correct column names for empty result sets (CASSANDRA-9813) + * Add new types to Stress (CASSANDRA-9556) + * Add property to allow listening on broadcast interface (CASSANDRA-9748) + * Fix regression in split size on CqlInputFormat (CASSANDRA-10835) + * Better handling of SSL connection errors inter-node (CASSANDRA-10816) + * Disable reloading of GossipingPropertyFileSnitch (CASSANDRA-9474) + * Verify tables in pseudo-system keyspaces at startup (CASSANDRA-10761) +Merged from 2.1: + * Allow simultaneous bootstrapping with strict consistency when no vnodes are used (CASSANDRA-11005) * Log a message when major compaction does not result in a single file (CASSANDRA-10847) * (cqlsh) fix cqlsh_copy_tests when vnodes are disabled (CASSANDRA-10997) - * (cqlsh) fix formatting bytearray values (CASSANDRA-10839) * (cqlsh) Add request timeout option to cqlsh (CASSANDRA-10686) * Avoid AssertionError while submitting hint with LWT (CASSANDRA-10477) * If CompactionMetadata is not in stats file, use index summary instead (CASSANDRA-10676) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2050c97/src/java/org/apache/cassandra/service/StorageService.java -- diff --cc src/java/org/apache/cassandra/service/StorageService.java index bace082,606670c..34419e9 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@@ -51,16 -51,17 +51,38 @@@ import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -- import javax.management.JMX; import javax.management.MBeanServer; -import javax.management.Notification; import javax.management.NotificationBroadcasterSupport; import javax.management.ObjectName; import javax.management.openmbean.TabularData; import javax.management.openmbean.TabularDataSupport; -import org.apache.cassandra.auth.Auth; ++import com.google.common.annotations.VisibleForTesting; ++import com.google.common.base.Predicate; ++import com.google.common.collect.ArrayListMultimap; ++import com.google.common.collect.Collections2; ++import com.google.common.collect.HashMultimap; ++import com.google.common.collect.ImmutableSet; ++import com.google.common.collect.Iterables; ++import com.google.common.collect.Lists; ++import com.google.common.collect.Maps; ++import com.google.common.collect.Multimap; ++import com.google.common.collect.Sets; ++import com.google.common.util.concurrent.FutureCallback; ++import com.google.common.util.concurrent.Futures; ++import com.google.common.util.concurrent.ListenableFuture; ++import com.google.common.util.concurrent.Uninterruptibles; ++import org.apache.commons.lang3.StringUtils; ++import org.slf4j.Logger; ++import org.slf4j.LoggerFactory; ++ ++import ch.qos
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
Merge branch cassandra-2.1 into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7550ebd9 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7550ebd9 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7550ebd9 Branch: refs/heads/cassandra-3.3 Commit: 7550ebd9cca222de964ba190af3628cd3d0da1cb Parents: f13a7df c0747d2 Author: Benjamin Lerer Authored: Wed Jan 13 14:39:49 2016 +0100 Committer: Benjamin Lerer Committed: Wed Jan 13 14:41:40 2016 +0100 -- --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/af509ec9/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 427fc29,000..8469836 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2481 -1,0 +1,2483 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +import webbrowser +from StringIO import StringIO +from contextlib import contextmanager +from glob import glob +from uuid import UUID + +if sys.version_info[0] != 2 or sys.version_info[1] != 7: +sys.exit("\nCQL Shell supports only Python 2.7\n") + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') +CASSANDRA_CQL_HTML_FALLBACK = 'https://cassandra.apache.org/doc/cql3/CQL-2.2.html' + +if os.path.exists(CASSANDRA_PATH + '/doc/cql3/CQL.html'): +# default location of local CQL.html +CASSANDRA_CQL_HTML = 'file://' + CASSANDRA_PATH + '/doc/cql3/CQL.html' +elif os.path.exists('/usr/share/doc/cassandra/CQL.html'): +# fallback to package file +CASSANDRA_CQL_HTML = 'file:///usr/share/doc/cassandra/CQL.html' +else: +# fallback to online version +CASSANDRA_CQL_HTML = CASSANDRA_CQL_HTML_FALLBACK + +# On Linux, the Python webbrowser module uses the 'xdg-open' executable +# to open a file/URL. But that only works, if the current session has been +# opened from _within_ a desktop environment. I.e. 'xdg-open' will fail, +# if the session's been opened via ssh to a remote box. +# +# Use 'python' to get some information about the detected browsers. +# >>> import webbrowser +# >>> webbrowser._tryorder +# >>> webbrowser._browser +# +if len(webbrowser._tryorder) == 0: +CASSANDRA_CQL_HTML = CASSANDRA_CQL_HTML_FALLBACK +elif webbrowser._tryorder[0] == 'xdg-open' and os.environ.get('XDG_DATA_DIRS', '') == '': +# only on Linux (some OS with xdg-open) +webbrowser._tryorder.remove('xdg-open') +webbrowser._tryorder.append('xdg-open') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/57d558fc/pylib/cqlshlib/copyutil.py -- diff --cc pylib/cqlshlib/copyutil.py index a2fab00,f699e64..a117ec3 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@@ -23,19 -26,25 +26,25 @@@ import sy import time import traceback - from StringIO import StringIO + from calendar import timegm + from collections import defaultdict, deque, namedtuple + from decimal import Decimal from random import randrange + from StringIO import StringIO from threading import Lock + from uuid import UUID from cassandra.cluster import Cluster + from cassandra.cqltypes import ReversedType, UserType from cassandra.metadata import protect_name, protect_names - from cassandra.policies import RetryPolicy, WhiteListRoundRobinPolicy, TokenAwarePolicy - from cassandra.query import tuple_factory + from cassandra.policies import RetryPolicy, WhiteListRoundRobinPolicy, TokenAwarePolicy, DCAwareRoundRobinPolicy + from cassandra.query import BatchStatement, BatchType, SimpleStatement, tuple_factory + from cassandra.util import Date, Time - - import sslhandling + from cql3handling import CqlRuleSet from displaying import NO_COLOR_MAP -from formatting import format_value_default, EMPTY, get_formatter +from formatting import format_value_default, DateTimeFormat, EMPTY, get_formatter + from sslhandling import ssl_settings def parse_options(shell, opts): @@@ -65,10 -74,13 +74,15 @@@ # by default the page timeout is 10 seconds per 1000 entries in the page size or 10 seconds if pagesize is smaller csv_options['pagetimeout'] = int(opts.pop('pagetimeout', max(10, 10 * (csv_options['pagesize'] / 1000 csv_options['maxattempts'] = int(opts.pop('maxattempts', 5)) - csv_options['float_precision'] = shell.display_float_precision -csv_options['dtformats'] = opts.pop('timeformat', shell.display_time_format) +csv_options['dtformats'] = DateTimeFormat(opts.pop('timeformat', shell.display_timestamp_format), + shell.display_date_format, + shell.display_nanotime_format) + csv_options['float_precision'] = shell.display_float_precision + csv_options['chunksize'] = int(opts.pop('chunksize', 1000)) + csv_options['ingestrate'] = int(opts.pop('ingestrate', 10)) + csv_options['maxbatchsize'] = int(opts.pop('maxbatchsize', 20)) + csv_options['minbatchsize'] = int(opts.pop('minbatchsize', 2)) + csv_options['reportfrequency'] = float(opts.pop('reportfrequency', 0.25)) return csv_options, dialect_options, opts @@@ -371,30 -648,18 +650,18 @@@ class ExportProcess(ChildProcess) An child worker process for the export task, ExportTask. """ - def __init__(self, inmsg, outmsg, ks, cf, columns, dialect_options, csv_options, - debug, port, cql_version, auth_provider, ssl, protocol_version, config_file): - mp.Process.__init__(self, target=self.run) - self.inmsg = inmsg - self.outmsg = outmsg - self.ks = ks - self.cf = cf - self.columns = columns - self.dialect_options = dialect_options + def __init__(self, params): + ChildProcess.__init__(self, params=params, target=self.run) + self.dialect_options = params['dialect_options'] self.hosts_to_sessions = dict() - self.debug = debug - self.port = port - self.cql_version = cql_version - self.auth_provider = auth_provider - self.ssl = ssl - self.protocol_version = protocol_version - self.config_file = config_file - + csv_options = params['csv_options'] self.encoding = csv_options['encoding'] -self.time_format = csv_options['dtformats'] +self.date_time_format = csv_options['dtformats'] self.float_precision = csv_options['float_precision'] self.nullval = csv_options['nullval'] - self.maxjobs = csv_options['jobs'] + self.max_attempts = csv_options['maxattempts'] + self.max_requests = csv_options['maxrequests'] self.csv_options = csv_options self.formatters = dict() @@@ -600,13 -851,424 +853,424 @@@ return query + class ImportConversion(object): + """ + A class for converting strings to values when importing from csv, used by ImportProcess, + the parent. + """ + def __init__(self, parent, table_meta, statement): + self.ks = parent.ks + self.cf = parent.cf + self.columns = parent.columns + self.nullval = parent.nullval + self.printmsg = parent.printmsg + self.table_meta = table_meta + self.primary_key_indexes = [self.columns.index(col.name) for col in self.table_meta.primary_key] + self.partition_key_indexes = [self.columns.
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7e3e1191 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7e3e1191 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7e3e1191 Branch: refs/heads/trunk Commit: 7e3e1191b9a02b2a638f8a12e2cc793c0a4735ab Parents: 15f03ab b876424 Author: Benjamin Lerer Authored: Thu Dec 3 21:30:45 2015 +0100 Committer: Benjamin Lerer Committed: Thu Dec 3 21:30:45 2015 +0100 -- CHANGES.txt | 3 ++- .../apache/cassandra/stress/settings/SettingsCommandUser.java | 7 +-- 2 files changed, 3 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/7e3e1191/CHANGES.txt -- diff --cc CHANGES.txt index 12accac,1a2887a..7932f51 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,27 -1,8 +1,28 @@@ -2.1.13 +2.2.5 + * Verify tables in pseudo-system keyspaces at startup (CASSANDRA-10761) - ++Merged from 2.1: + * Fix Stress profile parsing on Windows (CASSANDRA-10808) - -2.1.12 +2.2.4 + * Show CQL help in cqlsh in web browser (CASSANDRA-7225) + * Serialize on disk the proper SSTable compression ratio (CASSANDRA-10775) + * Reject index queries while the index is building (CASSANDRA-8505) + * CQL.textile syntax incorrectly includes optional keyspace for aggregate SFUNC and FINALFUNC (CASSANDRA-10747) + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) + * Fix IllegalArgumentException in DataOutputBuffer.reallocate for large buffers (CASSANDRA-10592) +Merged from 2.1: * Fix incremental repair hang when replica is down (CASSANDRA-10288) * Avoid writing range tombstones after END_OF_ROW marker (CASSANDRA-10791) * Optimize the way we check if a token is repaired in anticompaction (CASSANDRA-10768)
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e491f05b Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e491f05b Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e491f05b Branch: refs/heads/trunk Commit: e491f05b71437b47a2d7ed72c2d680188148332a Parents: 1604535 b85da71 Author: Tyler Hobbs Authored: Wed Dec 2 15:32:16 2015 -0600 Committer: Tyler Hobbs Committed: Wed Dec 2 15:32:16 2015 -0600 -- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e491f05b/build.xml --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/882df8a2 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/882df8a2 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/882df8a2 Branch: refs/heads/trunk Commit: 882df8a21711559d18bf6b38cd6026d78b7e4956 Parents: 29ed6fe 0b26ca6 Author: Marcus Eriksson Authored: Wed Dec 2 15:06:43 2015 +0100 Committer: Marcus Eriksson Committed: Wed Dec 2 15:06:43 2015 +0100 -- CHANGES.txt | 1 + .../org/apache/cassandra/db/ColumnIndex.java| 16 ++-- .../org/apache/cassandra/db/RangeTombstone.java | 5 ++ .../cassandra/db/compaction/Scrubber.java | 25 +- .../io/sstable/SSTableIdentityIterator.java | 76 +++ .../io/sstable/format/big/BigTableWriter.java | 1 + .../Keyspace1-Standard3-jb-1-Summary.db | Bin 71 -> 63 bytes .../Keyspace1-StandardInteger1-ka-2-CRC.db | Bin 0 -> 8 bytes .../Keyspace1-StandardInteger1-ka-2-Data.db | Bin 0 -> 12357 bytes .../Keyspace1-StandardInteger1-ka-2-Digest.sha1 | 1 + .../Keyspace1-StandardInteger1-ka-2-Filter.db | Bin 0 -> 176 bytes .../Keyspace1-StandardInteger1-ka-2-Index.db| Bin 0 -> 108 bytes ...eyspace1-StandardInteger1-ka-2-Statistics.db | Bin 0 -> 4470 bytes .../Keyspace1-StandardInteger1-ka-2-Summary.db | Bin 0 -> 112 bytes .../Keyspace1-StandardInteger1-ka-2-TOC.txt | 8 ++ .../apache/cassandra/db/RowIndexEntryTest.java | 1 + .../unit/org/apache/cassandra/db/ScrubTest.java | 60 +++ .../streaming/StreamingTransferTest.java| 46 ++- 18 files changed, 216 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/882df8a2/CHANGES.txt -- diff --cc CHANGES.txt index eaad3a2,e00abfe..bca5fb0 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,23 -1,5 +1,24 @@@ -2.1.12 +2.2.4 + * Show CQL help in cqlsh in web browser (CASSANDRA-7225) + * Serialize on disk the proper SSTable compression ratio (CASSANDRA-10775) + * Reject index queries while the index is building (CASSANDRA-8505) + * CQL.textile syntax incorrectly includes optional keyspace for aggregate SFUNC and FINALFUNC (CASSANDRA-10747) + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) + * Fix IllegalArgumentException in DataOutputBuffer.reallocate for large buffers (CASSANDRA-10592) +Merged from 2.1: + * Avoid writing range tombstones after END_OF_ROW marker (CASSANDRA-10791) * Optimize the way we check if a token is repaired in anticompaction (CASSANDRA-10768) * Add proper error handling to stream receiver (CASSANDRA-10774) * Warn or fail when changing cluster topology live (CASSANDRA-10243) http://git-wip-us.apache.org/repos/asf/cassandra/blob/882df8a2/src/java/org/apache/cassandra/db/RangeTombstone.java -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/882df8a2/src/java/org/apache/cassandra/db/compaction/Scrubber.java -- diff --cc src/java/org/apache/cassandra/db/compaction/Scrubber.java index 670c682,e02f901..9fd8560 --- a/src/java/org/apache/cassandra/db/compaction/Scrubber.java +++ b/src/java/org/apache/cassandra/db/compaction/Scrubber.java @@@ -162,6 -155,22 +162,22 @@@ public class Scrubber implements Closea if (scrubInfo.isStopRequested()) throw new CompactionInterruptedException(scrubInfo.getCompactionInfo()); + updateIndexKey(); + + if (prevKey != null && indexFile != null) + { + long nextRowStart = currentRowPositionFromIndex == -1 ? dataFile.length() : currentRowPositionFromIndex; + if (dataFile.getFilePointer() < nextRowStart) + { + /
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/9f19dd4e Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/9f19dd4e Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/9f19dd4e Branch: refs/heads/trunk Commit: 9f19dd4e4e4f4adc948b36a3fd38077cbc691617 Parents: a320737 dbfeeac Author: Marcus Eriksson Authored: Wed Dec 2 08:53:33 2015 +0100 Committer: Marcus Eriksson Committed: Wed Dec 2 08:53:33 2015 +0100 -- CHANGES.txt | 1 + .../db/compaction/CompactionManager.java| 3 +- src/java/org/apache/cassandra/dht/Range.java| 44 + .../org/apache/cassandra/dht/RangeTest.java | 66 4 files changed, 113 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/9f19dd4e/CHANGES.txt -- diff --cc CHANGES.txt index cf73f57,b0f9588..eaad3a2 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,23 -1,5 +1,24 @@@ -2.1.12 +2.2.4 + * Show CQL help in cqlsh in web browser (CASSANDRA-7225) + * Serialize on disk the proper SSTable compression ratio (CASSANDRA-10775) + * Reject index queries while the index is building (CASSANDRA-8505) + * CQL.textile syntax incorrectly includes optional keyspace for aggregate SFUNC and FINALFUNC (CASSANDRA-10747) + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) + * Fix IllegalArgumentException in DataOutputBuffer.reallocate for large buffers (CASSANDRA-10592) +Merged from 2.1: + * Optimize the way we check if a token is repaired in anticompaction (CASSANDRA-10768) * Add proper error handling to stream receiver (CASSANDRA-10774) * Warn or fail when changing cluster topology live (CASSANDRA-10243) * Status command in debian/ubuntu init script doesn't work (CASSANDRA-10213) http://git-wip-us.apache.org/repos/asf/cassandra/blob/9f19dd4e/src/java/org/apache/cassandra/db/compaction/CompactionManager.java -- diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java index f3a69a6,2630ba2..65f93c0 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@@ -1192,90 -1092,68 +1192,91 @@@ public class CompactionManager implemen if (!new File(sstable.getFilename()).exists()) { logger.info("Skipping anticompaction for {}, required sstable was compacted and is no longer available.", sstable); +i.remove(); continue; } +if (groupMaxDataAge < sstable.maxDataAge) +groupMaxDataAge = sstable.maxDataAge; +} -logger.info("Anticompacting {}", sstable); -Set sstableAsSet = new HashSet<>(); -sstableAsSet.add(sstable); +if (anticompactionGroup.originals().size() == 0) +{ +logger.info("No valid anticompactions for this group, All sstables were compacted and are no longer available"); +return 0; +} -File destination = cfs.directories.getWriteableLocationAsFile(cfs.getExpectedCompactedFileSize(sstableAsSet, OperationType.ANTICOMPACTION)); -SSTableRewriter repairedSSTableWriter = new SSTableRewriter(cfs, sstableAsSet, sstable.maxDataAge, false, false); -SSTableRewriter unRepairedSSTableWriter = new SSTableRewriter(cfs, sstableAsSet, sstable.maxDataAge, false, false); +logger.info("Anticompacting {}", anticompactionGroup); +Set sstableAsSet = anticompactionGroup.originals(); + +File destination = cfs.directories.getWriteableLocationAsFile(cfs.getExpectedCompactedFileSize(sstableAsSet, OperationType.ANTICOMPACTION)); +long repairedKeyCount = 0; +long unrepairedKeyCount = 0; +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/432a8a48 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/432a8a48 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/432a8a48 Branch: refs/heads/trunk Commit: 432a8a484394f6774fc64486229939c07f8af9e2 Parents: e7116f2 7650fc1 Author: Robert Stupp Authored: Fri Nov 27 13:50:52 2015 +0100 Committer: Robert Stupp Committed: Fri Nov 27 13:50:52 2015 +0100 -- CHANGES.txt | 1 + NEWS.txt| 6 + src/java/org/apache/cassandra/gms/Gossiper.java | 28 +- .../locator/GossipingPropertyFileSnitch.java| 107 ++ .../cassandra/locator/PropertyFileSnitch.java | 74 +++- .../cassandra/locator/SnitchProperties.java | 5 + .../cassandra/service/CassandraDaemon.java | 17 +- .../cassandra/service/MigrationManager.java | 4 +- .../apache/cassandra/service/StorageProxy.java | 10 +- .../cassandra/service/StorageService.java | 30 +- .../GossipingPropertyFileSnitchTest.java| 38 +-- .../locator/PropertyFileSnitchTest.java | 334 +++ 12 files changed, 496 insertions(+), 158 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/432a8a48/CHANGES.txt -- diff --cc CHANGES.txt index 7281bd3,a2f7b6e..ce82bd0 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,21 -1,5 +1,22 @@@ -2.1.12 +2.2.4 + * Serialize on disk the proper SSTable compression ratio (CASSANDRA-10775) + * Reject index queries while the index is building (CASSANDRA-8505) + * CQL.textile syntax incorrectly includes optional keyspace for aggregate SFUNC and FINALFUNC (CASSANDRA-10747) + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Warn or fail when changing cluster topology live (CASSANDRA-10243) * Status command in debian/ubuntu init script doesn't work (CASSANDRA-10213) * Some DROP ... IF EXISTS incorrectly result in exceptions on non-existing KS (CASSANDRA-10658) * DeletionTime.compareTo wrong in rare cases (CASSANDRA-10749) http://git-wip-us.apache.org/repos/asf/cassandra/blob/432a8a48/NEWS.txt -- diff --cc NEWS.txt index 4cf9c7b,cae8dfb..87e77f4 --- a/NEWS.txt +++ b/NEWS.txt @@@ -39,9 -24,22 +39,15 @@@ New feature - DTCS option max_sstable_age_days is now deprecated and defaults to 1000 days. - Native protocol server now allows both SSL and non-SSL connections on the same port. -- Switching racks is no longer an allowed operation on a node which has - data. Instead, the node will need to be decommissioned and rebootstrapped. - If moving from the SimpleSnitch, make sure the rack containing all current - nodes is named "rack1". To override this behavior when manually wiping - the node and bootstrapping, use -Dcassandra.ignore_rack=true. -- a new validate(key, cf) method is added to PerRowSecondaryIndex. A default - implementation is provided, so no changes are required to custom implementations. + Operations + + - Changing rack or dc of live nodes is no longer possible for PropertyFileSnitch + and YamlFileNetworkTopologySnitch. Reloading the configuration file of + GossipingPropertyFileSnitch has been disabled, CASSANDRA-10243. + -2.1.11 +2.2.3 = Upgrading http://git-wip-us.apache.org/repos/asf/cassandra/blob/432a8a48/src/java/org/apache/cassandra/gms/Gossiper.java -- diff --cc src/java/org/apache/cassandra/gms/Gossiper.java index 3d0d5fa,09851b2..fadaffc --- a/src/java/org/apache/cassandra/gms/Gossiper.java +++ b/src/java/org/apache/cassandra/gms/Gossiper.java @@@ -981,10 -984,11 +970,11 @@@ public class Gossiper implements IFailu for
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d44dbe19 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d44dbe19 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d44dbe19 Branch: refs/heads/trunk Commit: d44dbe1929b3746f6f931ef5c6499073ed3bbaeb Parents: f8fc031 8cd13f1 Author: Robert Stupp Authored: Fri Nov 27 12:58:16 2015 +0100 Committer: Robert Stupp Committed: Fri Nov 27 12:58:16 2015 +0100 -- CHANGES.txt | 1 + debian/init | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d44dbe19/CHANGES.txt -- diff --cc CHANGES.txt index 63305d6,111852c..39ce927 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,20 -1,5 +1,21 @@@ -2.1.12 +2.2.4 + * Reject index queries while the index is building (CASSANDRA-8505) + * CQL.textile syntax incorrectly includes optional keyspace for aggregate SFUNC and FINALFUNC (CASSANDRA-10747) + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Status command in debian/ubuntu init script doesn't work (CASSANDRA-10213) * Some DROP ... IF EXISTS incorrectly result in exceptions on non-existing KS (CASSANDRA-10658) * DeletionTime.compareTo wrong in rare cases (CASSANDRA-10749) * Force encoding when computing statement ids (CASSANDRA-10755)
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b3e6a433/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java -- diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java index 000,b0c0809..2c68390 mode 00,100644..100644 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/DropTest.java @@@ -1,0 -1,37 +1,37 @@@ + /* + * 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. + */ + + package org.apache.cassandra.cql3.validation.operations; + + import org.junit.Test; + + import org.apache.cassandra.cql3.CQLTester; + + public class DropTest extends CQLTester + { + @Test + public void testNonExistingOnes() throws Throwable + { -assertInvalidMessage("Cannot drop non existing column family", "DROP TABLE " + KEYSPACE + ".table_does_not_exist"); -assertInvalidMessage("Cannot drop non existing column family", "DROP TABLE keyspace_does_not_exist.table_does_not_exist"); ++assertInvalidMessage("Cannot drop non existing table", "DROP TABLE " + KEYSPACE + ".table_does_not_exist"); ++assertInvalidMessage("Cannot drop non existing table", "DROP TABLE keyspace_does_not_exist.table_does_not_exist"); + + execute("DROP TABLE IF EXISTS " + KEYSPACE + ".table_does_not_exist"); + execute("DROP TABLE IF EXISTS keyspace_does_not_exist.table_does_not_exist"); + } + + }
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/db970837 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/db970837 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/db970837 Branch: refs/heads/trunk Commit: db97083764e08755fcce7e74c1c81f081db48e3f Parents: 53e777a b8a8004 Author: Robert Stupp Authored: Fri Nov 27 09:29:06 2015 +0100 Committer: Robert Stupp Committed: Fri Nov 27 09:29:06 2015 +0100 -- CHANGES.txt| 1 + src/java/org/apache/cassandra/db/DeletionTime.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/db970837/CHANGES.txt -- diff --cc CHANGES.txt index 361bbf6,48f4e89..8779275 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,19 -1,5 +1,20 @@@ -2.1.12 +2.2.4 + * CQL.textile syntax incorrectly includes optional keyspace for aggregate SFUNC and FINALFUNC (CASSANDRA-10747) + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * DeletionTime.compareTo wrong in rare cases (CASSANDRA-10749) * Force encoding when computing statement ids (CASSANDRA-10755) * Properly reject counters as map keys (CASSANDRA-10760) * Fix the sstable-needs-cleanup check (CASSANDRA-10740)
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/8bfdd65c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/8bfdd65c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/8bfdd65c Branch: refs/heads/trunk Commit: 8bfdd65c0d0c3013b00902a64e591d4aaeaea4dd Parents: 31be903 cdf0485 Author: Sylvain Lebresne Authored: Thu Nov 26 10:40:49 2015 +0100 Committer: Sylvain Lebresne Committed: Thu Nov 26 10:40:49 2015 +0100 -- CHANGES.txt | 1 + src/java/org/apache/cassandra/cql3/CQL3Type.java | 2 ++ 2 files changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bfdd65c/CHANGES.txt -- diff --cc CHANGES.txt index 7b32c2b,7978a56..237c251 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,20 -1,8 +1,21 @@@ -2.1.12 +2.2.4 + * Fix JSON update with prepared statements (CASSANDRA-10631) + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Properly reject counters as map keys (CASSANDRA-10760) * Fix the sstable-needs-cleanup check (CASSANDRA-10740) * (cqlsh) Print column names before COPY operation (CASSANDRA-8935) - * Add Native-Transport-Requests back to tpstats (CASSANDRA-10044) * Make paging logic consistent between searcher impls (CASSANDRA-10683) * Fix CompressedInputStream for proper cleanup (CASSANDRA-10012) * (cqlsh) Support counters in COPY commands (CASSANDRA-9043) http://git-wip-us.apache.org/repos/asf/cassandra/blob/8bfdd65c/src/java/org/apache/cassandra/cql3/CQL3Type.java --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/96b7603d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/96b7603d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/96b7603d Branch: refs/heads/trunk Commit: 96b7603d9edfcbbc5cecd38bfe598056d8c564e1 Parents: cd75ecd 3d99418 Author: Marcus Eriksson Authored: Thu Nov 26 08:31:42 2015 +0100 Committer: Marcus Eriksson Committed: Thu Nov 26 08:31:42 2015 +0100 -- CHANGES.txt | 1 + .../db/compaction/CompactionManager.java| 6 +- .../org/apache/cassandra/db/CleanupTest.java| 75 3 files changed, 80 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/96b7603d/CHANGES.txt -- diff --cc CHANGES.txt index 5ff53b6,3ede9b7..a548c9f --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,18 -1,7 +1,19 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Fix the sstable-needs-cleanup check (CASSANDRA-10740) * (cqlsh) Print column names before COPY operation (CASSANDRA-8935) - * Add Native-Transport-Requests back to tpstats (CASSANDRA-10044) * Make paging logic consistent between searcher impls (CASSANDRA-10683) * Fix CompressedInputStream for proper cleanup (CASSANDRA-10012) * (cqlsh) Support counters in COPY commands (CASSANDRA-9043) http://git-wip-us.apache.org/repos/asf/cassandra/blob/96b7603d/src/java/org/apache/cassandra/db/compaction/CompactionManager.java -- diff --cc src/java/org/apache/cassandra/db/compaction/CompactionManager.java index 0c6e24f,b0ad244..f3a69a6 --- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java +++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java @@@ -27,7 -35,16 +27,8 @@@ import javax.management.ObjectName import javax.management.openmbean.OpenDataException; import javax.management.openmbean.TabularData; -import com.google.common.base.Predicate; -import com.google.common.base.Throwables; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ConcurrentHashMultiset; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Multimap; -import com.google.common.collect.Multiset; -import com.google.common.collect.Sets; + import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.*; import com.google.common.util.concurrent.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/cassandra/blob/96b7603d/test/unit/org/apache/cassandra/db/CleanupTest.java -- diff --cc test/unit/org/apache/cassandra/db/CleanupTest.java index 81f7d41,1d04dfa..0115ad9 --- a/test/unit/org/apache/cassandra/db/CleanupTest.java +++ b/test/unit/org/apache/cassandra/db/CleanupTest.java @@@ -33,17 -34,15 +35,18 @@@ import org.junit.Test import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; +import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.cql3.Operator; +import org.apache.cassandra.db.filter.IDiskAtomFilter; import org.apache.cassandra.db.columniterator.IdentityQueryFilter; import org.apache.cassandra.db.compaction.CompactionManager; -import org.apache.cassandra.db.filter.IDiskAtomFilter; import org.apache.cassandra.db.index.SecondaryIndex; -import org.apache.cassandra.dht.BytesToken; +import org.apache.cassandra.dht.ByteOrderedPartitioner.BytesToken; import org.apache.cassandra.dht.Range; -import org.apache.cassandra.io.sstable.SSTableReader; +import org.apache.cassandra.exceptions.ConfigurationException; +import org.apache.cassandra.io.sstable.format.SSTableReader; +import org.apache.cassandra.locator.SimpleStrategy; + import o
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/cd75ecd9 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/cd75ecd9 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/cd75ecd9 Branch: refs/heads/trunk Commit: cd75ecd90fe7c49c09dde8e454edd235b1a2 Parents: a90c3b2 9768e57 Author: Tyler Hobbs Authored: Wed Nov 25 17:52:58 2015 -0600 Committer: Tyler Hobbs Committed: Wed Nov 25 17:52:58 2015 -0600 -- pylib/cqlshlib/formatting.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/cd75ecd9/pylib/cqlshlib/formatting.py -- diff --cc pylib/cqlshlib/formatting.py index 8b66bce,b740bf9..62ecd10 --- a/pylib/cqlshlib/formatting.py +++ b/pylib/cqlshlib/formatting.py @@@ -15,15 -15,13 +15,15 @@@ # limitations under the License. import binascii -import sys -import re import calendar import math +import re +import sys +import platform - from collections import defaultdict + import wcwidth + - from . import wcwidth - from .displaying import colorme, get_str, FormattedValue, DEFAULT_VALUE_COLORS, NO_COLOR_MAP + from collections import defaultdict + from displaying import colorme, get_str, FormattedValue, DEFAULT_VALUE_COLORS, NO_COLOR_MAP from cassandra.cqltypes import EMPTY from cassandra.util import datetime_from_timestamp from util import UTC
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/1142183f/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 41672c0,000..ffcbcbd mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2690 -1,0 +1,2699 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing as mp +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +if sys.version_info[0] != 2 or sys.version_info[1] != 7: +sys.exit("\nCQL Shell supports only Python 2.7\n") + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory, TraceUnavailable + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, copy +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, Form
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/2aa83426 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/2aa83426 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/2aa83426 Branch: refs/heads/trunk Commit: 2aa834265ba76fe0e161ce9fdb612df045dcd576 Parents: d425fe4 4a94f75 Author: Aleksey Yeschenko Authored: Mon Nov 23 17:14:14 2015 + Committer: Aleksey Yeschenko Committed: Mon Nov 23 17:14:14 2015 + -- --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0fd5178/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 94c7af3,000..41672c0 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2674 -1,0 +1,2690 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing as mp +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +if sys.version_info[0] != 2 or sys.version_info[1] != 7: +sys.exit("\nCQL Shell supports only Python 2.7\n") + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory, TraceUnavailable + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, copy +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, Form
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/da4b9716 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/da4b9716 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/da4b9716 Branch: refs/heads/trunk Commit: da4b97164a89d57990ef19b553cb4a25937efe4a Parents: 3851670 882adf0 Author: Sylvain Lebresne Authored: Fri Nov 20 14:00:35 2015 +0100 Committer: Sylvain Lebresne Committed: Fri Nov 20 14:00:35 2015 +0100 -- CHANGES.txt | 2 ++ .../hadoop/ColumnFamilyRecordReader.java| 35 +++- 2 files changed, 21 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/da4b9716/CHANGES.txt -- diff --cc CHANGES.txt index 867226f,9e2869e..17c5047 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,17 -1,6 +1,19 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Try next replica if not possible to connect to primary replica on +ColumnFamilyRecordReader (CASSANDRA-2388) * Limit window size in DTCS (CASSANDRA-10280) * sstableloader does not use MAX_HEAP_SIZE env parameter (CASSANDRA-10188) * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304) http://git-wip-us.apache.org/repos/asf/cassandra/blob/da4b9716/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java -- diff --cc src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java index 97dc497,dc44a43..9d1d10c --- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java +++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java @@@ -152,25 -151,28 +152,28 @@@ public class ColumnFamilyRecordReader e if (batchSize < 2) throw new IllegalArgumentException("Minimum batchSize is 2. Suggested batchSize is 100 or more"); - try - { - if (client != null) - return; - - // create connection using thrift - String location = getLocation(); - - int port = ConfigHelper.getInputRpcPort(conf); - client = ColumnFamilyInputFormat.createAuthenticatedClient(location, port, conf); + String[] locations = getLocations(); + int port = ConfigHelper.getInputRpcPort(conf); - } - catch (Exception e) + Exception lastException = null; + for (String location : locations) { - throw new RuntimeException(e); + try + { + client = ColumnFamilyInputFormat.createAuthenticatedClient(location, port, conf); + break; + } + catch (Exception e) + { + lastException = e; + logger.warn("Failed to create authenticated client to {}:{}", location , port); + } } + if (client == null && lastException != null) + throw new RuntimeException(lastException); iter = widerows ? new WideRowIterator() : new StaticRowIterator(); -logger.debug("created {}", iter); +logger.trace("created {}", iter); } public boolean nextKeyValue() throws IOException @@@ -210,10 -212,10 +213,10 @@@ } } } - return split.getLocations()[0]; + return split.getLocations(); } -private abstract class RowIterator extends AbstractIterator>> +private abstract class RowIterator extends AbstractIterator>> { protected List rows; protected int totalRead = 0;
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bdd88a2f Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bdd88a2f Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bdd88a2f Branch: refs/heads/trunk Commit: bdd88a2f6a1cd12f23bc084e64ec24ca60f20e04 Parents: 073f062 851aed7 Author: Marcus Eriksson Authored: Fri Nov 20 12:04:04 2015 +0100 Committer: Marcus Eriksson Committed: Fri Nov 20 12:04:04 2015 +0100 -- NEWS.txt | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/bdd88a2f/NEWS.txt -- diff --cc NEWS.txt index b67814a,54a6b79..4cf9c7b --- a/NEWS.txt +++ b/NEWS.txt @@@ -33,11 -18,22 +33,15 @@@ Operation New features + - Time windows in DTCS are now limited to 1 day by default to be able to + handle bootstrap and repair in a better way. To get the old behaviour, + increase max_window_size_seconds. + - DTCS option max_sstable_age_days is now deprecated and defaults to 1000 days. - Native protocol server now allows both SSL and non-SSL connections on the same port. -- Switching racks is no longer an allowed operation on a node which has - data. Instead, the node will need to be decommissioned and rebootstrapped. - If moving from the SimpleSnitch, make sure the rack containing all current - nodes is named "rack1". To override this behavior when manually wiping - the node and bootstrapping, use -Dcassandra.ignore_rack=true. -- a new validate(key, cf) method is added to PerRowSecondaryIndex. A default - implementation is provided, so no changes are required to custom implementations. -2.1.11 +2.2.3 = Upgrading
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/073f0626 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/073f0626 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/073f0626 Branch: refs/heads/trunk Commit: 073f06262a60f661d3db5e308daa9877516cda51 Parents: 95feab6 99617a5 Author: Marcus Eriksson Authored: Fri Nov 20 11:05:01 2015 +0100 Committer: Marcus Eriksson Committed: Fri Nov 20 11:05:01 2015 +0100 -- CHANGES.txt | 1 + pylib/cqlshlib/cql3handling.py | 1 + .../DateTieredCompactionStrategy.java | 34 ++ .../DateTieredCompactionStrategyOptions.java| 30 ++-- .../DateTieredCompactionStrategyTest.java | 37 +--- 5 files changed, 73 insertions(+), 30 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/073f0626/CHANGES.txt -- diff --cc CHANGES.txt index 14e8c3d,66423c7..867226f --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,17 -1,5 +1,18 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Limit window size in DTCS (CASSANDRA-10280) * sstableloader does not use MAX_HEAP_SIZE env parameter (CASSANDRA-10188) * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304) * Don't remove level info when running upgradesstables (CASSANDRA-10692) http://git-wip-us.apache.org/repos/asf/cassandra/blob/073f0626/pylib/cqlshlib/cql3handling.py -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/073f0626/src/java/org/apache/cassandra/db/compaction/DateTieredCompactionStrategy.java -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/073f0626/test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java -- diff --cc test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java index 2824d3a,5afd575..2fab014 --- a/test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java +++ b/test/unit/org/apache/cassandra/db/compaction/DateTieredCompactionStrategyTest.java @@@ -312,10 -311,11 +322,11 @@@ public class DateTieredCompactionStrate Thread.sleep(2000); AbstractCompactionTask t = dtcs.getNextBackgroundTask((int) (System.currentTimeMillis()/1000)); assertNotNull(t); -assertEquals(1, Iterables.size(t.sstables)); -SSTableReader sstable = t.sstables.iterator().next(); +assertEquals(1, Iterables.size(t.transaction.originals())); +SSTableReader sstable = t.transaction.originals().iterator().next(); assertEquals(sstable, expiredSSTable); -cfs.getDataTracker().unmarkCompacting(cfs.getSSTables()); +t.transaction.abort(); + cfs.truncateBlocking(); } @Test @@@ -355,7 -354,9 +365,8 @@@ DateTieredCompactionStrategy dtcs = new DateTieredCompactionStrategy(cfs, options); for (SSTableReader sstable : cfs.getSSTables()) dtcs.addSSTable(sstable); - assertEquals(20, dtcs.getNextBackgroundTask(0).transaction.originals().size()); + AbstractCompactionTask task = dtcs.getNextBackgroundTask(0); -assertEquals(20, task.sstables.size()); -cfs.getDataTracker().unmarkCompacting(task.sstables); -cfs.truncateBlocking(); ++assertEquals(20, task.transaction.originals().size()); ++task.transaction.abort(); } - }
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/95feab66 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/95feab66 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/95feab66 Branch: refs/heads/trunk Commit: 95feab6631f96315db3587f42c6c190a9745c2a7 Parents: 4e48324 4f2337f Author: Robert Stupp Authored: Thu Nov 19 11:09:11 2015 +0100 Committer: Robert Stupp Committed: Thu Nov 19 11:09:11 2015 +0100 -- CHANGES.txt | 3 ++- bin/sstableloader | 6 +- 2 files changed, 7 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/95feab66/CHANGES.txt -- diff --cc CHANGES.txt index 4e19b23,94a9ae2..14e8c3d --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,18 -1,6 +1,19 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: - * * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304) + * sstableloader does not use MAX_HEAP_SIZE env parameter (CASSANDRA-10188) + * (cqlsh) Improve COPY TO performance and error handling (CASSANDRA-9304) * Don't remove level info when running upgradesstables (CASSANDRA-10692) * Create compression chunk for sending file only (CASSANDRA-10680) * Make buffered read size configurable (CASSANDRA-10249)
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/d2f243ee/pylib/cqlshlib/copy.py -- diff --cc pylib/cqlshlib/copy.py index 000,8534b98..8ff474f mode 00,100644..100644 --- a/pylib/cqlshlib/copy.py +++ b/pylib/cqlshlib/copy.py @@@ -1,0 -1,644 +1,647 @@@ + # 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 csv + import json + import multiprocessing as mp + import os + import Queue ++import random + import sys + import time + import traceback + + from StringIO import StringIO + from random import randrange + from threading import Lock + + from cassandra.cluster import Cluster + from cassandra.metadata import protect_name, protect_names + from cassandra.policies import RetryPolicy, WhiteListRoundRobinPolicy, TokenAwarePolicy + from cassandra.query import tuple_factory + + + import sslhandling + from displaying import NO_COLOR_MAP -from formatting import format_value_default, EMPTY, get_formatter ++from formatting import format_value_default, DateTimeFormat, EMPTY, get_formatter + + + def parse_options(shell, opts): + """ + Parse options for import (COPY FROM) and export (COPY TO) operations. + Extract from opts csv and dialect options. + + :return: 3 dictionaries: the csv options, the dialect options, any unrecognized options. + """ + dialect_options = shell.csv_dialect_defaults.copy() + if 'quote' in opts: + dialect_options['quotechar'] = opts.pop('quote') + if 'escape' in opts: + dialect_options['escapechar'] = opts.pop('escape') + if 'delimiter' in opts: + dialect_options['delimiter'] = opts.pop('delimiter') + if dialect_options['quotechar'] == dialect_options['escapechar']: + dialect_options['doublequote'] = True + del dialect_options['escapechar'] + + csv_options = dict() + csv_options['nullval'] = opts.pop('null', '') + csv_options['header'] = bool(opts.pop('header', '').lower() == 'true') + csv_options['encoding'] = opts.pop('encoding', 'utf8') + csv_options['jobs'] = int(opts.pop('jobs', 12)) + csv_options['pagesize'] = int(opts.pop('pagesize', 1000)) + # by default the page timeout is 10 seconds per 1000 entries in the page size or 10 seconds if pagesize is smaller + csv_options['pagetimeout'] = int(opts.pop('pagetimeout', max(10, 10 * (csv_options['pagesize'] / 1000 + csv_options['maxattempts'] = int(opts.pop('maxattempts', 5)) -csv_options['dtformats'] = opts.pop('timeformat', shell.display_time_format) + csv_options['float_precision'] = shell.display_float_precision ++csv_options['dtformats'] = DateTimeFormat(opts.pop('timeformat', shell.display_timestamp_format), ++ shell.display_date_format, ++ shell.display_nanotime_format) + + return csv_options, dialect_options, opts + + + def get_num_processes(cap): + """ + Pick a reasonable number of child processes. We need to leave at + least one core for the parent process. This doesn't necessarily + need to be capped, but 4 is currently enough to keep + a single local Cassandra node busy so we use this for import, whilst + for export we use 16 since we can connect to multiple Cassandra nodes. + Eventually this parameter will become an option. + """ + try: + return max(1, min(cap, mp.cpu_count() - 1)) + except NotImplementedError: + return 1 + + + class ExportTask(object): + """ + A class that exports data to .csv by instantiating one or more processes that work in parallel (ExportProcess). + """ + def __init__(self, shell, ks, cf, columns, fname, csv_options, dialect_options, protocol_version, config_file): + self.shell = shell + self.csv_options = csv_options + self.dialect_options = dialect_options + self.ks = ks + self.cf = cf + self.columns = shell.get_column_names(ks, cf) if columns is None else columns + self.fname = fname + self.protocol_version = protocol_version + self.config_file = config_file + + def run(self): +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d09b6c69 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d09b6c69 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d09b6c69 Branch: refs/heads/trunk Commit: d09b6c69e0e0c6adff8e679f2286a335d883f1bd Parents: 077f9bf 246cb88 Author: Marcus Eriksson Authored: Wed Nov 18 13:59:09 2015 +0100 Committer: Marcus Eriksson Committed: Wed Nov 18 13:59:09 2015 +0100 -- CHANGES.txt | 1 + .../compaction/WrappingCompactionStrategy.java | 16 + .../LeveledCompactionStrategyTest.java | 35 3 files changed, 52 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d09b6c69/CHANGES.txt -- diff --cc CHANGES.txt index 572afc2,6ccde28..c3dacc2 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,17 -1,5 +1,18 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Don't remove level info when running upgradesstables (CASSANDRA-10692) * Create compression chunk for sending file only (CASSANDRA-10680) * Make buffered read size configurable (CASSANDRA-10249) * Forbid compact clustering column type changes in ALTER TABLE (CASSANDRA-8879) http://git-wip-us.apache.org/repos/asf/cassandra/blob/d09b6c69/src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java -- diff --cc src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java index 9daa0c5,71a6bc1..8555432 --- a/src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java +++ b/src/java/org/apache/cassandra/db/compaction/WrappingCompactionStrategy.java @@@ -32,10 -32,10 +32,11 @@@ import org.slf4j.LoggerFactory import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.db.ColumnFamilyStore; ++import org.apache.cassandra.db.lifecycle.LifecycleTransaction; import org.apache.cassandra.dht.Range; import org.apache.cassandra.dht.Token; +import org.apache.cassandra.io.sstable.format.SSTableReader; import org.apache.cassandra.io.sstable.ISSTableScanner; -import org.apache.cassandra.io.sstable.SSTableReader; import org.apache.cassandra.notifications.INotification; import org.apache.cassandra.notifications.INotificationConsumer; import org.apache.cassandra.notifications.SSTableAddedNotification; @@@ -123,6 -123,21 +124,21 @@@ public final class WrappingCompactionSt } @Override -public AbstractCompactionTask getCompactionTask(Collection sstables, final int gcBefore, long maxSSTableBytes) ++public AbstractCompactionTask getCompactionTask(LifecycleTransaction txn, final int gcBefore, long maxSSTableBytes) + { -assert sstables.size() > 0; -boolean repairedSSTables = sstables.iterator().next().isRepaired(); -for (SSTableReader sstable : sstables) ++assert txn.originals().size() > 0; ++boolean repairedSSTables = txn.originals().iterator().next().isRepaired(); ++for (SSTableReader sstable : txn.originals()) + if (repairedSSTables != sstable.isRepaired()) + throw new RuntimeException("Can't mix repaired and unrepaired sstables in a compaction"); + + if (repairedSSTables) -return repaired.getCompactionTask(sstables, gcBefore, maxSSTableBytes); ++return repaired.getCompactionTask(txn, gcBefore, maxSSTableBytes); + else -return unrepaired.getCompactionTask(sstables, gcBefore, maxSSTableBytes); ++return unrepaired.getCompactionTask(txn, gcBefore, maxSSTableBytes); + } + + @Override public synchronized AbstractCompactionTask getUserDefinedTask(Collection sstables, int gcBefore) { assert !sstables.isEmpty(); http://git-wip-us.apache.org/repos/asf/cassandra/blob/d09b6c69/test/unit/org/apac
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/077f9bf5 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/077f9bf5 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/077f9bf5 Branch: refs/heads/trunk Commit: 077f9bf5f55fe7dca0b10b3357314c208c2f35ed Parents: ae64cc0 5a665b8 Author: Aleksey Yeschenko Authored: Wed Nov 18 12:52:36 2015 + Committer: Aleksey Yeschenko Committed: Wed Nov 18 12:52:36 2015 + -- .../org/apache/cassandra/io/sstable/CorruptSSTableException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/afe3fe3d Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/afe3fe3d Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/afe3fe3d Branch: refs/heads/trunk Commit: afe3fe3df98f3439bca05cbe132a0e97b66945e4 Parents: a68f8bd 9b97766 Author: Aleksey Yeschenko Authored: Tue Nov 17 18:56:02 2015 + Committer: Aleksey Yeschenko Committed: Tue Nov 17 18:56:02 2015 + -- CHANGES.txt | 1 + src/java/org/apache/cassandra/io/util/RandomAccessReader.java | 7 --- 2 files changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/afe3fe3d/CHANGES.txt -- diff --cc CHANGES.txt index fb8f89a,08db386..4cb9275 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,17 -1,5 +1,18 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Make buffered read size configurable (CASSANDRA-10249) * Forbid compact clustering column type changes in ALTER TABLE (CASSANDRA-8879) * Reject incremental repair with subrange repair (CASSANDRA-10422) * Add a nodetool command to refresh size_estimates (CASSANDRA-9579) http://git-wip-us.apache.org/repos/asf/cassandra/blob/afe3fe3d/src/java/org/apache/cassandra/io/util/RandomAccessReader.java -- diff --cc src/java/org/apache/cassandra/io/util/RandomAccessReader.java index 278f55c,d15fe46..751269b --- a/src/java/org/apache/cassandra/io/util/RandomAccessReader.java +++ b/src/java/org/apache/cassandra/io/util/RandomAccessReader.java @@@ -23,22 -24,31 +23,23 @@@ import java.nio.ByteBuffer import com.google.common.annotations.VisibleForTesting; import org.apache.cassandra.io.FSReadError; +import org.apache.cassandra.io.compress.BufferType; +import org.apache.cassandra.utils.ByteBufferUtil; -public class RandomAccessReader extends RandomAccessFile implements FileDataInput +public class RandomAccessReader extends AbstractDataInput implements FileDataInput { -public static final long CACHE_FLUSH_INTERVAL_IN_BYTES = (long) Math.pow(2, 27); // 128mb - // default buffer size, 64Kb public static final int DEFAULT_BUFFER_SIZE = 65536; + public static final int BUFFER_SIZE = Integer.getInteger("cassandra.rar_buffer_size", DEFAULT_BUFFER_SIZE); -// absolute filesystem path to the file -private final String filePath; - // buffer which will cache file blocks -protected byte[] buffer; +protected ByteBuffer buffer; -// `current` as current position in file // `bufferOffset` is the offset of the beginning of the buffer // `markedPointer` folds the offset of the last file mark -protected long bufferOffset, current = 0, markedPointer; -// `validBufferBytes` is the number of bytes in the buffer that are actually valid; -// this will be LESS than buffer capacity if buffer is not full! -protected int validBufferBytes = 0; +protected long bufferOffset, markedPointer; -// channel liked with the file, used to retrieve data and force updates. -protected final FileChannel channel; +protected final ChannelProxy channel; // this can be overridden at construction to a value shorter than the true length of the file; // if so, it acts as an imposed limit on reads, rather than a convenience property @@@ -55,40 -73,39 +56,40 @@@ if (bufferSize <= 0) throw new IllegalArgumentException("bufferSize must be positive"); -buffer = new byte[bufferSize]; - // we can cache file length in read-only mode -long fileLength = overrideLength; -if (fileLength <= 0) -{ -try -{ -fileLength = channel.size(); -} -catch (IOException e) -
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a68f8bd7 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a68f8bd7 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a68f8bd7 Branch: refs/heads/trunk Commit: a68f8bd700666e87877993107ad1b20ed957c8a8 Parents: 99b82db 5414950 Author: Aleksey Yeschenko Authored: Tue Nov 17 16:47:41 2015 + Committer: Aleksey Yeschenko Committed: Tue Nov 17 16:47:41 2015 + -- CHANGES.txt | 1 + .../cassandra/cql3/statements/AlterTableStatement.java | 3 +++ .../cassandra/cql3/validation/operations/AlterTest.java | 8 3 files changed, 12 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a68f8bd7/CHANGES.txt -- diff --cc CHANGES.txt index f5d3416,eea14c8..fb8f89a --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,17 -1,5 +1,18 @@@ -2.1.12 +2.2.4 + * Don't do anticompaction after subrange repair (CASSANDRA-10422) + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Forbid compact clustering column type changes in ALTER TABLE (CASSANDRA-8879) * Reject incremental repair with subrange repair (CASSANDRA-10422) * Add a nodetool command to refresh size_estimates (CASSANDRA-9579) * Shutdown compaction in drain to prevent leak (CASSANDRA-10079) http://git-wip-us.apache.org/repos/asf/cassandra/blob/a68f8bd7/src/java/org/apache/cassandra/cql3/statements/AlterTableStatement.java -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/a68f8bd7/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java -- diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java index 566c0ea,a6aad87..2cc8a18 --- a/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java +++ b/test/unit/org/apache/cassandra/cql3/validation/operations/AlterTest.java @@@ -201,20 -200,10 +202,27 @@@ public class AlterTest extends CQLTeste } } +/** + * tests CASSANDRA-10027 + */ +@Test +public void testAlterColumnTypeToDate() throws Throwable +{ +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 int);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +execute("ALTER TABLE %s ALTER c1 TYPE date;"); +assertRows(execute("SELECT * FROM %s"), row(1, 1)); + +createTable("CREATE TABLE %s (key int PRIMARY KEY, c1 varint);"); +execute("INSERT INTO %s (key, c1) VALUES (1,1);"); +assertInvalidMessage("Cannot change c1 from type varint to type date: types are incompatible.", + "ALTER TABLE %s ALTER c1 TYPE date;"); +} ++ + @Test // tests CASSANDRA-8879 + public void testAlterClusteringColumnTypeInCompactTable() throws Throwable + { + createTable("CREATE TABLE %s (key blob, column1 blob, value blob, PRIMARY KEY ((key), column1)) WITH COMPACT STORAGE"); + assertInvalidThrow(InvalidRequestException.class, "ALTER TABLE %s ALTER column1 TYPE ascii"); + } }
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d434a33a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d434a33a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d434a33a Branch: refs/heads/cassandra-3.1 Commit: d434a33ace2dfe6715f4857f9537ee884f4ef410 Parents: 73a730f a8e8a67 Author: Marcus Eriksson Authored: Tue Nov 17 10:07:04 2015 +0100 Committer: Marcus Eriksson Committed: Tue Nov 17 10:07:04 2015 +0100 -- CHANGES.txt| 1 + .../apache/cassandra/repair/messages/RepairOption.java | 3 +++ .../org/apache/cassandra/service/StorageService.java | 4 .../cassandra/repair/messages/RepairOptionTest.java| 13 +++-- 4 files changed, 19 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/d434a33a/CHANGES.txt -- diff --cc CHANGES.txt index 5705453,b6b394a..489a76d --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,16 -1,5 +1,17 @@@ -2.1.12 +2.2.4 + * Fix SimpleDateType type compatibility (CASSANDRA-10027) + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Reject incremental repair with subrange repair (CASSANDRA-10422) * Add a nodetool command to refresh size_estimates (CASSANDRA-9579) * Shutdown compaction in drain to prevent leak (CASSANDRA-10079) * Invalidate cache after stream receive task is completed (CASSANDRA-10341) http://git-wip-us.apache.org/repos/asf/cassandra/blob/d434a33a/src/java/org/apache/cassandra/repair/messages/RepairOption.java -- diff --cc src/java/org/apache/cassandra/repair/messages/RepairOption.java index f3e452c,000..1780b6b mode 100644,00..100644 --- a/src/java/org/apache/cassandra/repair/messages/RepairOption.java +++ b/src/java/org/apache/cassandra/repair/messages/RepairOption.java @@@ -1,308 -1,0 +1,311 @@@ +/* + * 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. + */ +package org.apache.cassandra.repair.messages; + +import java.util.*; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.cassandra.config.Config; +import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.dht.IPartitioner; +import org.apache.cassandra.dht.Range; +import org.apache.cassandra.dht.Token; +import org.apache.cassandra.repair.RepairParallelism; +import org.apache.cassandra.tools.nodetool.Repair; +import org.apache.cassandra.utils.FBUtilities; + +/** + * Repair options. + */ +public class RepairOption +{ +public static final String PARALLELISM_KEY = "parallelism"; +public static final String PRIMARY_RANGE_KEY = "primaryRange"; +public static final String INCREMENTAL_KEY = "incremental"; +public static final String JOB_THREADS_KEY = "jobThreads"; +public static final String RANGES_KEY = "ranges"; +public static final String COLUMNFAMILIES_KEY = "columnFamilies"; +public static final String DATACENTERS_KEY = "dataCenters"; +public static final String HOSTS_KEY = "hosts"; +public static final String TRACE_KEY = "trace"; + +// we don't want to push nodes too much for repair +public static final int MAX_JOB_THREADS = 4; + +private static final Logger logger = LoggerFa
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/84d44885 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/84d44885 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/84d44885 Branch: refs/heads/trunk Commit: 84d4488537605a86373325f86bbc4cd358921223 Parents: d84b42b ecd66de Author: Aleksey Yeschenko Authored: Thu Nov 12 17:58:38 2015 + Committer: Aleksey Yeschenko Committed: Thu Nov 12 17:58:38 2015 + -- CHANGES.txt | 1 + .../cassandra/service/StorageService.java | 6 .../cassandra/service/StorageServiceMBean.java | 5 +++ .../org/apache/cassandra/tools/NodeProbe.java | 12 +++ .../org/apache/cassandra/tools/NodeTool.java| 3 +- .../tools/nodetool/RefreshSizeEstimates.java| 33 6 files changed, 59 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/84d44885/CHANGES.txt -- diff --cc CHANGES.txt index 2cfcb55,2eeda94..9c834f3 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,15 -1,5 +1,16 @@@ -2.1.12 +2.2.4 + * (Hadoop) fix splits calculation (CASSANDRA-10640) + * (Hadoop) ensure that Cluster instances are always closed (CASSANDRA-10058) + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Add a nodetool command to refresh size_estimates (CASSANDRA-9579) * Shutdown compaction in drain to prevent leak (CASSANDRA-10079) * Invalidate cache after stream receive task is completed (CASSANDRA-10341) * Reject counter writes in CQLSSTableWriter (CASSANDRA-10258) http://git-wip-us.apache.org/repos/asf/cassandra/blob/84d44885/src/java/org/apache/cassandra/service/StorageService.java -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/84d44885/src/java/org/apache/cassandra/service/StorageServiceMBean.java -- diff --cc src/java/org/apache/cassandra/service/StorageServiceMBean.java index 2c92d43,1351fea..00060ae --- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java +++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java @@@ -239,9 -248,14 +239,14 @@@ public interface StorageServiceMBean ex public long trueSnapshotsSize(); /** + * Forces refresh of values stored in system.size_estimates of all column families. + */ + public void refreshSizeEstimates() throws ExecutionException; + + /** * Forces major compaction of a single keyspace */ -public void forceKeyspaceCompaction(String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException; +public void forceKeyspaceCompaction(boolean splitOutput, String keyspaceName, String... columnFamilies) throws IOException, ExecutionException, InterruptedException; /** * Trigger a cleanup of keys on a single keyspace http://git-wip-us.apache.org/repos/asf/cassandra/blob/84d44885/src/java/org/apache/cassandra/tools/NodeProbe.java -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/84d44885/src/java/org/apache/cassandra/tools/NodeTool.java -- diff --cc src/java/org/apache/cassandra/tools/NodeTool.java index 175b325,1d4a420..fcb6ed0 --- a/src/java/org/apache/cassandra/tools/NodeTool.java +++ b/src/java/org/apache/cassandra/tools/NodeTool.java @@@ -129,23 -187,14 +129,24 @@@ public class NodeToo TpStats.class, TopPartitions.class, SetLoggingLevel.class, -GetLoggingLevels.class +GetLoggingLevels.class, - FailureDetectorInfo.class ++FailureDetectorInfo.class, ++RefreshSizeEstimates.class ); -Cli parser = Cli.builder("nodetool") -.withDescription("Manage your Cassandra cluster") +Cli.CliBuilder builder = Cli.builder("nodetool"); + +builder.withDescription("Manage your Cassandra cluster") + .withDefa
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b0def95b Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b0def95b Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b0def95b Branch: refs/heads/trunk Commit: b0def95b596448564890ab8f88ef8da9739f823c Parents: b5b1252 852a8ba Author: Aleksey Yeschenko Authored: Mon Nov 9 15:40:42 2015 + Committer: Aleksey Yeschenko Committed: Mon Nov 9 15:40:42 2015 + -- CHANGES.txt | 1 + src/java/org/apache/cassandra/net/MessagingService.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0def95b/CHANGES.txt -- diff --cc CHANGES.txt index 814a924,123c1f3..fa868fe --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,13 -1,5 +1,14 @@@ -2.1.12 +2.2.4 + * (cqlsh) show partial trace if incomplete after max_trace_wait (CASSANDRA-7645) + * Use most up-to-date version of schema for system tables (CASSANDRA-10652) + * Deprecate memory_allocator in cassandra.yaml (CASSANDRA-10581,10628) + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: + * Remove superfluous COUNTER_MUTATION stage mapping (CASSANDRA-10605) * Improve json2sstable error reporting on nonexistent columns (CASSANDRA-10401) * (cqlsh) fix COPY using wrong variable name for time_format (CASSANDRA-10633) * Do not run SizeEstimatesRecorder if a node is not a member of the ring (CASSANDRA-9912) http://git-wip-us.apache.org/repos/asf/cassandra/blob/b0def95b/src/java/org/apache/cassandra/net/MessagingService.java --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/cb429063/pylib/cqlshlib/tracing.py -- diff --cc pylib/cqlshlib/tracing.py index 40d22f0,40d22f0..2ded259 --- a/pylib/cqlshlib/tracing.py +++ b/pylib/cqlshlib/tracing.py @@@ -20,13 -20,13 +20,14 @@@ import tim from cassandra.query import QueryTrace, TraceUnavailable --def print_trace_session(shell, session, session_id): ++def print_trace_session(shell, session, session_id, partial_session=False): """ Lookup a trace by session and trace session ID, then print it. """ trace = QueryTrace(session_id, session) try: --trace.populate() ++wait_for_complete = not partial_session ++trace.populate(wait_for_complete=wait_for_complete) except TraceUnavailable: shell.printerr("Session %s wasn't found." % session_id) else: @@@ -69,11 -69,11 +70,10 @@@ def make_trace_rows(trace) # append footer row (from sessions table). if trace.duration: finished_at = (datetime_from_utc_to_local(trace.started_at) + trace.duration) ++rows.append(['Request complete', str(finished_at), trace.coordinator, trace.duration.microseconds]) else: finished_at = trace.duration = "--" --rows.append(['Request complete', str(finished_at), trace.coordinator, trace.duration.microseconds]) -- return rows
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/edca4dce/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 17bddd3,000..a6070ef mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2737 -1,0 +1,2737 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +if sys.version_info[0] != 2 or sys.version_info[1] != 7: +sys.exit("\nCQL Shell supports only Python 2.7\n") + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory, TraceUnavailable + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, FormattedValue,
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/40cef770/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 7f2d39b,000..09da020 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2743 -1,0 +1,2744 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +if sys.version_info[0] != 2 or sys.version_info[1] != 7: +sys.exit("\nCQL Shell supports only Python 2.7\n") + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster, PagedResult +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, FormattedValue, colorm
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
Merge branch cassandra-2.1 into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/bbaa9630 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/bbaa9630 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/bbaa9630 Branch: refs/heads/trunk Commit: bbaa9630c4be9a9451f69ddd25e045dc2e92c057 Parents: 12e38f7 5a1d376 Author: blerer Authored: Thu Oct 22 10:22:01 2015 +0200 Committer: blerer Committed: Thu Oct 22 10:22:12 2015 +0200 -- --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 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/20d55086 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/20d55086 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/20d55086 Branch: refs/heads/trunk Commit: 20d5508618e65091f9e4c277a97dab2282199f24 Parents: d3085b1 a2c4d4e Author: Sylvain Lebresne Authored: Wed Oct 21 14:32:56 2015 +0200 Committer: Sylvain Lebresne Committed: Wed Oct 21 14:32:56 2015 +0200 -- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/20d55086/CHANGES.txt -- diff --cc CHANGES.txt index 120be92,d06345e..ed28f2e --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,15 -1,11 +1,15 @@@ -2.1.12 +2.2.4 + * Expose phi values from failure detector via JMX and tweak debug + and trace logging (CASSANDRA-9526) + * Fix RangeNamesQueryPager (CASSANDRA-10509) + * Deprecate Pig support (CASSANDRA-10542) + * Reduce contention getting instances of CompositeType (CASSANDRA-10433) +Merged from 2.1: - * Avoid repetition of JVM_OPTS in debian package (CASSANDRA-8821) + * Avoid repetition of JVM_OPTS in debian package (CASSANDRA-10251) * Fix potential NPE from handling result of SIM.highestSelectivityIndex (CASSANDRA-10550) - * Fix paging issues with partitions containing only static columns data - (CASSANDRA-10381) + * Fix paging issues with partitions containing only static columns data (CASSANDRA-10381) * Fix conditions on static columns (CASSANDRA-10264) * AssertionError: attempted to delete non-existing file CommitLog (CASSANDRA-10377) - * Merge range tombstones during compaction (CASSANDRA-7953) * (cqlsh) Distinguish negative and positive infinity in output (CASSANDRA-10523) * (cqlsh) allow custom time_format for COPY TO (CASSANDRA-8970) * Don't allow startup if the node's rack has changed (CASSANDRA-10242)
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
Merge branch cassandra-2.1 into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f497c13e Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f497c13e Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f497c13e Branch: refs/heads/trunk Commit: f497c13ee33cc76b7c7bd4c6d4d12caf475ca79d Parents: def5803 f587397 Author: blerer Authored: Fri Oct 16 14:44:29 2015 +0200 Committer: blerer Committed: Fri Oct 16 14:45:08 2015 +0200 -- .../org/apache/cassandra/cql3/ResultSet.java| 5 ++ .../apache/cassandra/cql3/UntypedResultSet.java | 6 +-- .../cassandra/cql3/selection/Selection.java | 57 +--- .../cassandra/cql3/selection/Selector.java | 12 + .../cql3/selection/SelectorFactories.java | 20 +++ .../cql3/selection/SimpleSelector.java | 6 +++ .../cql3/statements/SelectStatement.java| 2 +- .../operations/SelectOrderByTest.java | 52 ++ 8 files changed, 138 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f497c13e/src/java/org/apache/cassandra/cql3/ResultSet.java -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f497c13e/src/java/org/apache/cassandra/cql3/UntypedResultSet.java -- diff --cc src/java/org/apache/cassandra/cql3/UntypedResultSet.java index 49e0d86,a0b6ae7..e8d610d --- a/src/java/org/apache/cassandra/cql3/UntypedResultSet.java +++ b/src/java/org/apache/cassandra/cql3/UntypedResultSet.java @@@ -73,9 -74,9 +73,9 @@@ public abstract class UntypedResultSet public Row one() { -if (cqlRows.rows.size() != 1) -throw new IllegalStateException("One row required, " + cqlRows.rows.size() + " found"); +if (cqlRows.size() != 1) +throw new IllegalStateException("One row required, " + cqlRows.size() + " found"); - return new Row(cqlRows.metadata.names, cqlRows.rows.get(0)); + return new Row(cqlRows.metadata.requestNames(), cqlRows.rows.get(0)); } public Iterator iterator() http://git-wip-us.apache.org/repos/asf/cassandra/blob/f497c13e/src/java/org/apache/cassandra/cql3/selection/Selection.java -- diff --cc src/java/org/apache/cassandra/cql3/selection/Selection.java index 13e030f,000..f6925b2 mode 100644,00..100644 --- a/src/java/org/apache/cassandra/cql3/selection/Selection.java +++ b/src/java/org/apache/cassandra/cql3/selection/Selection.java @@@ -1,545 -1,0 +1,566 @@@ +/* + * 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. + */ +package org.apache.cassandra.cql3.selection; + +import java.nio.ByteBuffer; +import java.util.*; + +import com.google.common.base.Objects; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Iterators; + +import org.apache.cassandra.config.CFMetaData; +import org.apache.cassandra.config.ColumnDefinition; +import org.apache.cassandra.cql3.*; +import org.apache.cassandra.cql3.functions.Function; +import org.apache.cassandra.db.Cell; +import org.apache.cassandra.db.CounterCell; +import org.apache.cassandra.db.ExpiringCell; +import org.apache.cassandra.db.context.CounterContext; +import org.apache.cassandra.db.marshal.UTF8Type; +import org.apache.cassandra.exceptions.InvalidRequestException; +import org.apache.cassandra.utils.ByteBufferUtil; + +public abstract class Selection +{ +/** + * A predicate that returns true for static columns. + */ +private static final Predicate STATIC_COLUMN_FILTER = new Predicate() +{ +public boolean apply(ColumnDefinition def) +{ +return def.isStatic(); +} +}; + +private final CFMetaData cfm; +private final L
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/50da872f/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 6f3f816,000..a15fb02 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2735 -1,0 +1,2740 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster, PagedResult +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, FormattedValue, colorme) +from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT, +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/751e4f9e/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 55f7ee9,000..6f3f816 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2732 -1,0 +1,2735 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster, PagedResult +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, FormattedValue, colorme) +from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT, +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/89596682/bin/cqlsh.py -- diff --cc bin/cqlsh.py index e2691cc,000..55f7ee9 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2735 -1,0 +1,2732 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement + +import cmd +import codecs +import ConfigParser +import csv +import getpass +import locale +import multiprocessing +import optparse +import os +import platform +import sys +import time +import traceback +import warnings +from contextlib import contextmanager +from functools import partial +from glob import glob +from StringIO import StringIO +from uuid import UUID + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.auth import PlainTextAuthProvider +from cassandra.cluster import Cluster, PagedResult +from cassandra.metadata import (ColumnMetadata, KeyspaceMetadata, +TableMetadata, protect_name, protect_names, +protect_value) +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.query import SimpleStatement, ordered_dict_factory + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling +from cqlshlib.displaying import (ANSI_RESET, BLUE, COLUMN_NAME_COLORS, CYAN, + RED, FormattedValue, colorme) +from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT, +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/757dac9c Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/757dac9c Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/757dac9c Branch: refs/heads/trunk Commit: 757dac9c0ed441024f281d6510c36932210bf962 Parents: 82dabe0 94b6471 Author: Sylvain Lebresne Authored: Fri Oct 9 14:01:54 2015 +0200 Committer: Sylvain Lebresne Committed: Fri Oct 9 14:01:54 2015 +0200 -- .../org/apache/cassandra/db/KeyCacheTest.java | 55 1 file changed, 55 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/757dac9c/test/unit/org/apache/cassandra/db/KeyCacheTest.java -- diff --cc test/unit/org/apache/cassandra/db/KeyCacheTest.java index 4188d97,d3328f1..9a98bde --- a/test/unit/org/apache/cassandra/db/KeyCacheTest.java +++ b/test/unit/org/apache/cassandra/db/KeyCacheTest.java @@@ -17,24 -17,23 +17,27 @@@ */ package org.apache.cassandra.db; + import java.util.Collection; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; + import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Uninterruptibles; import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.apache.cassandra.SchemaLoader; import org.apache.cassandra.Util; import org.apache.cassandra.cache.KeyCacheKey; +import org.apache.cassandra.config.DatabaseDescriptor; +import org.apache.cassandra.config.KSMetaData; import org.apache.cassandra.concurrent.ScheduledExecutors; + import org.apache.cassandra.db.compaction.OperationType; import org.apache.cassandra.db.composites.*; import org.apache.cassandra.db.compaction.CompactionManager; import org.apache.cassandra.db.filter.QueryFilter; @@@ -47,23 -44,14 +50,25 @@@ import org.apache.cassandra.utils.ByteB import org.apache.cassandra.utils.concurrent.Refs; import static org.junit.Assert.assertEquals; -public class KeyCacheTest extends SchemaLoader +public class KeyCacheTest { -private static final String KEYSPACE1 = "KeyCacheSpace"; +private static final String KEYSPACE1 = "KeyCacheTest1"; private static final String COLUMN_FAMILY1 = "Standard1"; private static final String COLUMN_FAMILY2 = "Standard2"; + private static final String COLUMN_FAMILY3 = "Standard3"; + +@BeforeClass +public static void defineSchema() throws ConfigurationException +{ +SchemaLoader.prepareServer(); +SchemaLoader.createKeyspace(KEYSPACE1, +SimpleStrategy.class, +KSMetaData.optsWithRF(1), +SchemaLoader.standardCFMD(KEYSPACE1, COLUMN_FAMILY1), +SchemaLoader.standardCFMD(KEYSPACE1, COLUMN_FAMILY2)); +} + @AfterClass public static void cleanup() {
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 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/f3ad68cb Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f3ad68cb Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f3ad68cb Branch: refs/heads/trunk Commit: f3ad68cb4e4bf1ebdcd2f93e54a7b422d024512d Parents: dcada8b 0c1432a Author: Sylvain Lebresne Authored: Fri Sep 18 16:31:39 2015 +0200 Committer: Sylvain Lebresne Committed: Fri Sep 18 16:31:39 2015 +0200 -- CHANGES.txt | 1 + .../org/apache/cassandra/service/pager/SliceQueryPager.java | 7 --- 2 files changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f3ad68cb/CHANGES.txt -- diff --cc CHANGES.txt index 97858c5,deec093..a83fd53 --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -1,14 -1,5 +1,15 @@@ -2.1.10 +2.2.2 + * 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) +Merged from 2.1: + * Fix potential ClassCastException during paging (CASSANDRA-10352) * Prevent ALTER TYPE from creating circular references (CASSANDRA-10339) * Fix cache handling of 2i and base tables (CASSANDRA-10155, 10359) * Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/eecfb07d/doc/cql3/CQL.textile -- diff --cc doc/cql3/CQL.textile index ce712be,cc041df..aa0468b --- a/doc/cql3/CQL.textile +++ b/doc/cql3/CQL.textile @@@ -1,6 -1,6 +1,7 @@@ - h1. Cassandra Query Language (CQL) v3.3.0 -h1. Cassandra Query Language (CQL) v3.2.1 ++h1. Cassandra Query Language (CQL) v3.3.1 ++ @@@ -2197,17 -1531,10 +2198,22 @@@ h2(#changes). Change The following describes the changes in each version of CQL. -h3. 3.2.1 ++ ++h3. 3.3.1 + + * The syntax @TRUNCATE TABLE X@ is now accepted as an alias for @TRUNCATE X@ + +h3. 3.3.0 + +* Adds new "aggregates":#aggregates +* User-defined functions are now supported through "@CREATE FUNCTION@":#createFunctionStmt and "@DROP FUNCTION@":#dropFunctionStmt. +* User-defined aggregates are now supported through "@CREATE AGGREGATE@":#createAggregateStmt and "@DROP AGGREGATE@":#dropAggregateStmt. +* Allows double-dollar enclosed strings literals as an alternative to single-quote enclosed strings. +* Introduces Roles to supercede user based authentication and access control +* "@Date@":#usingdates and "@Time@":usingtime data types have been added +* "@JSON@":#json support has been added +* Adds new time conversion functions and deprecate @dateOf@ and @unixTimestampOf@. See "@Time conversion functions@":#timeFun + h3. 3.2.0 * User-defined types are now supported through "@CREATE TYPE@":#createTypeStmt, "@ALTER TYPE@":#alterTypeStmt, and "@DROP TYPE@":#dropTypeStmt http://git-wip-us.apache.org/repos/asf/cassandra/blob/eecfb07d/pylib/cqlshlib/cql3handling.py -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/eecfb07d/src/java/org/apache/cassandra/cql3/Cql.g -- http://git-wip-us.apache.org/repos/asf/cassandra/blob/eecfb07d/src/java/org/apache/cassandra/cql3/QueryProcessor.java -- diff --cc src/java/org/apache/cassandra/cql3/QueryProcessor.java index e9ff1b1,d4ca76f..161d8d0 --- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java +++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java @@@ -56,7 -64,7 +56,7 @@@ import org.github.jamm.MemoryMeter public class QueryProcessor implements QueryHandler { - public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.3.0"); -public static final SemanticVersion CQL_VERSION = new SemanticVersion("3.2.1"); ++public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.3.1"); public static final QueryProcessor instance = new QueryProcessor();
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/b2b75601/bin/cqlsh.py -- diff --cc bin/cqlsh.py index c991cc7,000..4fce833 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2697 -1,0 +1,2697 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement +from uuid import UUID + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +from StringIO import StringIO +from contextlib import contextmanager +from glob import glob + +import cmd +import sys +import os +import time +import optparse +import ConfigParser +import codecs +import locale +import platform +import warnings +import csv +import getpass +from functools import partial +import traceback + + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.cluster import Cluster, PagedResult +from cassandra.query import SimpleStatement, ordered_dict_factory +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.metadata import protect_name, protect_names, protect_value, KeyspaceMetadata, TableMetadata, ColumnMetadata +from cassandra.auth import PlainTextAuthProvider + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cqlhandling, cql3handling, pylexotron, sslhandling +from cqlshlib.displaying import (RED, BLUE, CYAN, ANSI_RESET, COLUMN_NAME_COLORS, + FormattedValue, colorme) +from cqlshlib.formatting import format_by_type, formatter_for, format_value_utype +from cqlshlib.util import trim_if_present, get_file_encoding_bomsize +from cqlshlib.formatting import DateTimeForma
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/464ca14a/bin/cqlsh.py -- diff --cc bin/cqlsh.py index bfb3a24,000..c991cc7 mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2695 -1,0 +1,2697 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement +from uuid import UUID + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +from StringIO import StringIO +from contextlib import contextmanager +from glob import glob + +import cmd +import sys +import os +import time +import optparse +import ConfigParser +import codecs +import locale +import platform +import warnings +import csv +import getpass +from functools import partial +import traceback + + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.cluster import Cluster, PagedResult +from cassandra.query import SimpleStatement, ordered_dict_factory +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.metadata import protect_name, protect_names, protect_value, KeyspaceMetadata, TableMetadata, ColumnMetadata +from cassandra.auth import PlainTextAuthProvider + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cqlhandling, cql3handling, pylexotron, sslhandling +from cqlshlib.displaying import (RED, BLUE, CYAN, ANSI_RESET, COLUMN_NAME_COLORS, + FormattedValue, colorme) +from cqlshlib.formatting import format_by_type, formatter_for, format_value_utype +from cqlshlib.util import trim_if_present, get_file_encoding_bomsize +from cqlshlib.formatting import DateTimeForma
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c870adc2/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java -- diff --cc src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java index 0c4b797,000..d843d4d mode 100644,00..100644 --- a/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java +++ b/src/java/org/apache/cassandra/io/sstable/format/SSTableReader.java @@@ -1,2287 -1,0 +1,2287 @@@ +/* + * 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. + */ +package org.apache.cassandra.io.sstable.format; + +import java.io.*; +import java.nio.ByteBuffer; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Iterators; +import com.google.common.collect.Ordering; +import com.google.common.primitives.Longs; +import com.google.common.util.concurrent.RateLimiter; + +import com.clearspring.analytics.stream.cardinality.CardinalityMergeException; +import com.clearspring.analytics.stream.cardinality.HyperLogLogPlus; +import com.clearspring.analytics.stream.cardinality.ICardinality; +import com.codahale.metrics.Counter; +import org.apache.cassandra.cache.CachingOptions; +import org.apache.cassandra.cache.InstrumentingCache; +import org.apache.cassandra.cache.KeyCacheKey; +import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor; +import org.apache.cassandra.concurrent.ScheduledExecutors; +import org.apache.cassandra.config.*; +import org.apache.cassandra.db.*; +import org.apache.cassandra.db.columniterator.OnDiskAtomIterator; +import org.apache.cassandra.db.commitlog.ReplayPosition; +import org.apache.cassandra.db.composites.CellName; +import org.apache.cassandra.db.filter.ColumnSlice; +import org.apache.cassandra.db.index.SecondaryIndex; +import org.apache.cassandra.db.lifecycle.Tracker; +import org.apache.cassandra.dht.*; +import org.apache.cassandra.io.FSError; +import org.apache.cassandra.io.compress.CompressionMetadata; +import org.apache.cassandra.io.sstable.*; +import org.apache.cassandra.io.sstable.metadata.*; +import org.apache.cassandra.io.util.*; +import org.apache.cassandra.metrics.RestorableMeter; +import org.apache.cassandra.metrics.StorageMetrics; +import org.apache.cassandra.service.ActiveRepairService; +import org.apache.cassandra.service.CacheService; +import org.apache.cassandra.service.StorageService; +import org.apache.cassandra.utils.*; +import org.apache.cassandra.utils.concurrent.OpOrder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.cassandra.utils.concurrent.Ref; +import org.apache.cassandra.utils.concurrent.SelfRefCounted; + +import static org.apache.cassandra.db.Directories.SECONDARY_INDEX_NAME_SEPARATOR; + +/** + * An SSTableReader can be constructed in a number of places, but typically is either + * read from disk at startup, or constructed from a flushed memtable, or after compaction + * to replace some existing sstables. However once created, an sstablereader may also be modified. + * + * A reader's OpenReason describes its current stage in its lifecycle, as follows: + * + * + * {@code + * NORMAL + * From: None=> Reader has been read from disk, either at startup or from a flushed memtable + * EARLY => Reader is the final result of a compaction + * MOVED_START => Reader WAS being compacted, but this failed and it has been restored to NORMAL status + * + * EARLY + * From: None=> Reader is a compaction replacement that is either incomplete and has been opened + *to represent its partial result status, or has been finished but the compaction + *it is a part of has not yet completed fully + * EARLY => Same as from None, only it is not the first time it has been + * + * MOVED_START + * F
[2/5] cassandra git commit: Merge branch cassandra-2.1 into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5fb4e58b/src/java/org/apache/cassandra/tools/nodetool/Status.java -- diff --cc src/java/org/apache/cassandra/tools/nodetool/Status.java index c4b2295,000..99f745d mode 100644,00..100644 --- a/src/java/org/apache/cassandra/tools/nodetool/Status.java +++ b/src/java/org/apache/cassandra/tools/nodetool/Status.java @@@ -1,206 -1,0 +1,207 @@@ +/* + * 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. + */ +package org.apache.cassandra.tools.nodetool; + +import io.airlift.command.Arguments; +import io.airlift.command.Command; +import io.airlift.command.Option; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.text.DecimalFormat; +import java.util.Collection; +import java.util.List; +import java.util.Map; ++import java.util.SortedMap; + +import org.apache.cassandra.locator.EndpointSnitchInfoMBean; +import org.apache.cassandra.tools.NodeProbe; +import org.apache.cassandra.tools.NodeTool; +import org.apache.cassandra.tools.NodeTool.NodeToolCmd; + +import com.google.common.collect.ArrayListMultimap; + +@Command(name = "status", description = "Print cluster information (state, load, IDs, ...)") +public class Status extends NodeToolCmd +{ +@Arguments(usage = "[]", description = "The keyspace name") +private String keyspace = null; + +@Option(title = "resolve_ip", name = {"-r", "--resolve-ip"}, description = "Show node domain names instead of IPs") +private boolean resolveIp = false; + +private boolean isTokenPerNode = true; +private int maxAddressLength = 0; +private String format = null; +private Collection joiningNodes, leavingNodes, movingNodes, liveNodes, unreachableNodes; +private Map loadMap, hostIDMap; +private EndpointSnitchInfoMBean epSnitchInfo; + +@Override +public void execute(NodeProbe probe) +{ +joiningNodes = probe.getJoiningNodes(); +leavingNodes = probe.getLeavingNodes(); +movingNodes = probe.getMovingNodes(); +loadMap = probe.getLoadMap(); +Map tokensToEndpoints = probe.getTokenToEndpointMap(); +liveNodes = probe.getLiveNodes(); +unreachableNodes = probe.getUnreachableNodes(); +hostIDMap = probe.getHostIdMap(); +epSnitchInfo = probe.getEndpointSnitchInfoProxy(); + +StringBuffer errors = new StringBuffer(); + +Map ownerships = null; +boolean hasEffectiveOwns = false; +try +{ +ownerships = probe.effectiveOwnership(keyspace); +hasEffectiveOwns = true; +} +catch (IllegalStateException e) +{ +ownerships = probe.getOwnership(); +errors.append("Note: " + e.getMessage() + "%n"); +} +catch (IllegalArgumentException ex) +{ +System.out.printf("%nError: " + ex.getMessage() + "%n"); +System.exit(1); +} + - Map dcs = NodeTool.getOwnershipByDc(probe, resolveIp, tokensToEndpoints, ownerships); ++SortedMap dcs = NodeTool.getOwnershipByDc(probe, resolveIp, tokensToEndpoints, ownerships); + +// More tokens than nodes (aka vnodes)? +if (dcs.values().size() < tokensToEndpoints.keySet().size()) +isTokenPerNode = false; + +findMaxAddressLength(dcs); + +// Datacenters +for (Map.Entry dc : dcs.entrySet()) +{ +String dcHeader = String.format("Datacenter: %s%n", dc.getKey()); +System.out.printf(dcHeader); +for (int i = 0; i < (dcHeader.length() - 1); i++) System.out.print('='); +System.out.println(); + +// Legend +System.out.println("Status=Up/Down"); +System.out.println("|/ State=Normal/Leaving/Joining/Moving"); + +printNodesHeader(hasEffectiveOwns, isTokenPerNode); + +ArrayListMultimap hostToTokens = ArrayListMultimap.create(); +for (HostStat stat : dc.getValue()) +hostToTokens.put(stat.endpoint, stat); + +
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/d526536f Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/d526536f Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/d526536f Branch: refs/heads/cassandra-3.0 Commit: d526536f288c1851724c0d769f9ebfdabc57d028 Parents: a69558b 7d74563 Author: T Jake Luciani Authored: Tue Aug 25 09:40:30 2015 -0400 Committer: T Jake Luciani Committed: Tue Aug 25 09:40:30 2015 -0400 -- --
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/8ffeebff/bin/cqlsh.py -- diff --cc bin/cqlsh.py index 6df1d75,000..11f110d mode 100644,00..100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -1,2668 -1,0 +1,2675 @@@ +#!/bin/sh +# -*- mode: Python -*- + +# 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. + +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(not (0x020500b0 < sys.hexversion < 0x0300))' 2>/dev/null \ +&& exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do +which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + +from __future__ import with_statement +from uuid import UUID + +description = "CQL Shell for Apache Cassandra" +version = "5.0.1" + +from StringIO import StringIO +from contextlib import contextmanager +from glob import glob + +import cmd +import sys +import os +import time +import optparse +import ConfigParser +import codecs +import locale +import platform +import warnings +import csv +import getpass +from functools import partial +import traceback + + +readline = None +try: +# check if tty first, cause readline doesn't check, and only cares +# about $TERM. we don't want the funky escape code stuff to be +# output if not a tty. +if sys.stdin.isatty(): +import readline +except ImportError: +pass + +CQL_LIB_PREFIX = 'cassandra-driver-internal-only-' + +CASSANDRA_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..') + +# use bundled libs for python-cql and thrift, if available. if there +# is a ../lib dir, use bundled libs there preferentially. +ZIPLIB_DIRS = [os.path.join(CASSANDRA_PATH, 'lib')] +myplatform = platform.system() +if myplatform == 'Linux': +ZIPLIB_DIRS.append('/usr/share/cassandra/lib') + +if os.environ.get('CQLSH_NO_BUNDLED', ''): +ZIPLIB_DIRS = () + + +def find_zip(libprefix): +for ziplibdir in ZIPLIB_DIRS: +zips = glob(os.path.join(ziplibdir, libprefix + '*.zip')) +if zips: +return max(zips) # probably the highest version, if multiple + +cql_zip = find_zip(CQL_LIB_PREFIX) +if cql_zip: +ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):] +sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver)) + +third_parties = ('futures-', 'six-') + +for lib in third_parties: +lib_zip = find_zip(lib) +if lib_zip: +sys.path.insert(0, lib_zip) + +warnings.filterwarnings("ignore", r".*blist.*") +try: +import cassandra +except ImportError, e: +sys.exit("\nPython Cassandra driver not installed, or not on PYTHONPATH.\n" + 'You might try "pip install cassandra-driver".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) + +from cassandra.cluster import Cluster, PagedResult +from cassandra.query import SimpleStatement, ordered_dict_factory +from cassandra.policies import WhiteListRoundRobinPolicy +from cassandra.protocol import QueryMessage, ResultMessage +from cassandra.metadata import protect_name, protect_names, protect_value, KeyspaceMetadata, TableMetadata, ColumnMetadata +from cassandra.auth import PlainTextAuthProvider + +# cqlsh should run correctly when run out of a Cassandra source tree, +# out of an unpacked Cassandra tarball, and after a proper package install. +cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib') +if os.path.isdir(cqlshlibdir): +sys.path.insert(0, cqlshlibdir) + +from cqlshlib import cqlhandling, cql3handling, pylexotron, sslhandling +from cqlshlib.displaying import (RED, BLUE, CYAN, ANSI_RESET, COLUMN_NAME_COLORS, + FormattedValue, colorme) +from cqlshlib.formatting import format_by_type, formatter_for, format_value_utype +from cqlshlib.util import trim_if_present, get_file_encoding_bomsize +from cqlshlib.formatting import DateTimeForma
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/io/util/FileUtils.java -- diff --cc src/java/org/apache/cassandra/io/util/FileUtils.java index 3552ca9,3be7c99..9f5193b --- a/src/java/org/apache/cassandra/io/util/FileUtils.java +++ b/src/java/org/apache/cassandra/io/util/FileUtils.java @@@ -24,6 -33,6 +24,7 @@@ import java.nio.file.* import java.text.DecimalFormat; import java.util.Arrays; ++import org.apache.cassandra.config.Config; import sun.nio.ch.DirectBuffer; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/io/util/SegmentedFile.java -- diff --cc src/java/org/apache/cassandra/io/util/SegmentedFile.java index edbd742,c65ecbf..66898c6 --- a/src/java/org/apache/cassandra/io/util/SegmentedFile.java +++ b/src/java/org/apache/cassandra/io/util/SegmentedFile.java @@@ -175,12 -165,17 +175,21 @@@ public abstract class SegmentedFile ext public SegmentedFile complete(String path) { - return complete(getChannel(path), -1); -return complete(path, -1, true); -} - -public SegmentedFile complete(String path, boolean isFinal) -{ -return complete(path, -1, isFinal); ++return complete(path, -1L); } public SegmentedFile complete(String path, long overrideLength) { - return complete(getChannel(path), overrideLength); -return complete(path, overrideLength, false); ++ChannelProxy channelCopy = getChannel(path); ++try ++{ ++return complete(channelCopy, overrideLength); ++} ++catch (Throwable t) ++{ ++channelCopy.close(); ++throw t; ++} } public void serializeBounds(DataOutput out) throws IOException http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/service/CassandraDaemon.java -- diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java index 167d6b9,949ea4c..8388138 --- a/src/java/org/apache/cassandra/service/CassandraDaemon.java +++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java @@@ -122,21 -125,16 +122,23 @@@ public class CassandraDaemo private static final CassandraDaemon instance = new CassandraDaemon(); -/** - * The earliest legit timestamp a casandra instance could have ever launched. - * Date roughly taken from http://perspectives.mvdirona.com/2008/07/12/FacebookReleasesCassandraAsOpenSource.aspx - * We use this to ensure the system clock is at least somewhat correct at startup. - */ -private static final long EARLIEST_LAUNCH_DATE = 121582080L; - public Server thriftServer; public Server nativeServer; -private boolean setupCompleted = false; + +private final boolean runManaged; +protected final StartupChecks startupChecks; ++private boolean setupCompleted; + +public CassandraDaemon() { +this(false); +} + +public CassandraDaemon(boolean runManaged) { +this.runManaged = runManaged; +this.startupChecks = new StartupChecks().withDefaultTests(); ++this.setupCompleted = false; +} + /** * This is a hook for concrete daemons to initialize themselves suitably. * @@@ -335,31 -425,15 +337,38 @@@ InetAddress nativeAddr = DatabaseDescriptor.getRpcAddress(); int nativePort = DatabaseDescriptor.getNativeTransportPort(); nativeServer = new org.apache.cassandra.transport.Server(nativeAddr, nativePort); + + setupCompleted = true; + } + + public boolean setupCompleted() + { + return setupCompleted; } +private void logSystemInfo() +{ + if (logger.isInfoEnabled()) + { + try + { + logger.info("Hostname: {}", InetAddress.getLocalHost().getHostName()); + } + catch (UnknownHostException e1) + { + logger.info("Could not resolve local host"); + } + + logger.info("JVM vendor/version: {}/{}", System.getProperty("java.vm.name"), System.getProperty("java.version")); + logger.info("Heap size: {}/{}", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().maxMemory()); + + for(MemoryPoolMXBean pool: ManagementFactory.getMemoryPoolMXBeans()) + logger.info("{} {}: {}", pool.getName(), pool.getType(), pool.getPeakUsage()); + + logger.info("Classpath: {}", System.getProperty("java.clas
[2/5] cassandra git commit: Merge branch 'cassandra-2.1' into cassandra-2.2
Merge branch 'cassandra-2.1' into cassandra-2.2 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/269059e8 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/269059e8 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/269059e8 Branch: refs/heads/trunk Commit: 269059e8eb09bfa03bdd6ade9c33d91cc0cf5f3b Parents: 63e122c eb875b4 Author: T Jake Luciani Authored: Mon Jul 6 11:20:44 2015 -0400 Committer: T Jake Luciani Committed: Mon Jul 6 11:20:44 2015 -0400 -- --