mirror of https://github.com/apache/cassandra
Merge commit 'c3d2f26f46c2d37b6cf918cbb5565fe57a5904cc' into cassandra-2.2
This commit is contained in:
commit
b74ffeafd2
|
|
@ -25,6 +25,7 @@
|
|||
* Fix paging on DISTINCT queries repeats result when first row in partition changes
|
||||
(CASSANDRA-10010)
|
||||
Merged from 2.1:
|
||||
* COPY FROM on large datasets: fix progress report and debug performance (CASSANDRA-11053)
|
||||
* InvalidateKeys should have a weak ref to key cache (CASSANDRA-11176)
|
||||
* Don't remove FailureDetector history on removeEndpoint (CASSANDRA-10371)
|
||||
* Only notify if repair status changed (CASSANDRA-11172)
|
||||
|
|
|
|||
28
bin/cqlsh.py
28
bin/cqlsh.py
|
|
@ -470,7 +470,7 @@ COPY_COMMON_OPTIONS = ['DELIMITER', 'QUOTE', 'ESCAPE', 'HEADER', 'NULL', 'DATETI
|
|||
'MAXATTEMPTS', 'REPORTFREQUENCY', 'DECIMALSEP', 'THOUSANDSSEP', 'BOOLSTYLE',
|
||||
'NUMPROCESSES', 'CONFIGFILE', 'RATEFILE']
|
||||
COPY_FROM_OPTIONS = ['CHUNKSIZE', 'INGESTRATE', 'MAXBATCHSIZE', 'MINBATCHSIZE', 'MAXROWS',
|
||||
'SKIPROWS', 'SKIPCOLS', 'MAXPARSEERRORS', 'MAXINSERTERRORS', 'ERRFILE']
|
||||
'SKIPROWS', 'SKIPCOLS', 'MAXPARSEERRORS', 'MAXINSERTERRORS', 'ERRFILE', 'PREPAREDSTATEMENTS']
|
||||
COPY_TO_OPTIONS = ['ENCODING', 'PAGESIZE', 'PAGETIMEOUT', 'BEGINTOKEN', 'ENDTOKEN', 'MAXOUTPUTSIZE', 'MAXREQUESTS']
|
||||
|
||||
|
||||
|
|
@ -594,8 +594,23 @@ def insert_driver_hooks():
|
|||
|
||||
def extend_cql_deserialization():
|
||||
"""
|
||||
The python driver returns BLOBs as string, but we expect them as bytearrays
|
||||
The python driver returns BLOBs as string, but we expect them as bytearrays; therefore we change
|
||||
the implementation of cassandra.cqltypes.BytesType.deserialize.
|
||||
|
||||
The deserializers package exists only when the driver has been compiled with cython extensions and
|
||||
cassandra.deserializers.DesBytesType replaces cassandra.cqltypes.BytesType.deserialize.
|
||||
|
||||
DesBytesTypeByteArray is a fast deserializer that converts blobs into bytearrays but it was
|
||||
only introduced recently (3.1.0). If it is available we use it, otherwise we remove
|
||||
cassandra.deserializers.DesBytesType so that we fall back onto cassandra.cqltypes.BytesType.deserialize
|
||||
just like in the case where no cython extensions are present.
|
||||
"""
|
||||
if hasattr(cassandra, 'deserializers'):
|
||||
if hasattr(cassandra.deserializers, 'DesBytesTypeByteArray'):
|
||||
cassandra.deserializers.DesBytesType = cassandra.deserializers.DesBytesTypeByteArray
|
||||
else:
|
||||
del cassandra.deserializers.DesBytesType
|
||||
|
||||
cassandra.cqltypes.BytesType.deserialize = staticmethod(lambda byts, protocol_version: bytearray(byts))
|
||||
cassandra.cqltypes.CassandraType.support_empty_values = True
|
||||
|
||||
|
|
@ -1766,9 +1781,9 @@ class Shell(cmd.Cmd):
|
|||
|
||||
Available COPY FROM options and defaults:
|
||||
|
||||
CHUNKSIZE=1000 - the size of chunks passed to worker processes
|
||||
CHUNKSIZE=5000 - the size of chunks passed to worker processes
|
||||
INGESTRATE=100000 - an approximate ingest rate in rows per second
|
||||
MINBATCHSIZE=2 - the minimum size of an import batch
|
||||
MINBATCHSIZE=10 - the minimum size of an import batch
|
||||
MAXBATCHSIZE=20 - the maximum size of an import batch
|
||||
MAXROWS=-1 - the maximum number of rows, -1 means no maximum
|
||||
SKIPROWS=0 - the number of rows to skip
|
||||
|
|
@ -1777,6 +1792,11 @@ class Shell(cmd.Cmd):
|
|||
MAXINSERTERRORS=-1 - the maximum global number of insert errors, -1 means no maximum
|
||||
ERRFILE='' - a file where to store all rows that could not be imported, by default this is
|
||||
import_ks_table.err where <ks> is your keyspace and <table> is your table name.
|
||||
PREPAREDSTATEMENTS=True - whether to use prepared statements when importing, by default True. Set this to
|
||||
False if you don't mind shifting data parsing to the cluster. The cluster will also
|
||||
have to compile every batch statement. For large and oversized clusters
|
||||
this will result in a faster import but for smaller clusters it may generate
|
||||
timeouts.
|
||||
|
||||
Available COPY TO options and defaults:
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -23,6 +23,12 @@ from itertools import izip
|
|||
from datetime import timedelta, tzinfo
|
||||
from StringIO import StringIO
|
||||
|
||||
try:
|
||||
from line_profiler import LineProfiler
|
||||
HAS_LINE_PROFILER = True
|
||||
except ImportError:
|
||||
HAS_LINE_PROFILER = False
|
||||
|
||||
ZERO = timedelta(0)
|
||||
|
||||
|
||||
|
|
@ -126,18 +132,35 @@ def get_file_encoding_bomsize(filename):
|
|||
else:
|
||||
file_encoding, size = "utf-8", 0
|
||||
|
||||
return (file_encoding, size)
|
||||
return file_encoding, size
|
||||
|
||||
|
||||
def profile_on():
|
||||
def profile_on(fcn_names=None):
|
||||
if fcn_names and HAS_LINE_PROFILER:
|
||||
pr = LineProfiler()
|
||||
for fcn_name in fcn_names:
|
||||
pr.add_function(fcn_name)
|
||||
pr.enable()
|
||||
return pr
|
||||
|
||||
pr = cProfile.Profile()
|
||||
pr.enable()
|
||||
return pr
|
||||
|
||||
|
||||
def profile_off(pr):
|
||||
def profile_off(pr, file_name):
|
||||
pr.disable()
|
||||
s = StringIO()
|
||||
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
|
||||
ps.print_stats()
|
||||
print s.getvalue()
|
||||
|
||||
if HAS_LINE_PROFILER and isinstance(pr, LineProfiler):
|
||||
pr.print_stats(s)
|
||||
else:
|
||||
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
|
||||
ps.print_stats()
|
||||
|
||||
ret = s.getvalue()
|
||||
if file_name:
|
||||
with open(file_name, 'w') as f:
|
||||
print "Writing to %s\n" % (f.name, )
|
||||
f.write(ret)
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -16,9 +16,11 @@
|
|||
# limitations under the License.
|
||||
|
||||
from distutils.core import setup
|
||||
from Cython.Build import cythonize
|
||||
|
||||
setup(
|
||||
name="cassandra-pylib",
|
||||
description="Cassandra Python Libraries",
|
||||
packages=["cqlshlib"],
|
||||
ext_modules=cythonize("cqlshlib/copyutil.py"),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue