mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.5' into trunk
This commit is contained in:
commit
acde508159
|
|
@ -13,6 +13,7 @@ Merged from 2.2:
|
||||||
* Only log yaml config once, at startup (CASSANDRA-11217)
|
* Only log yaml config once, at startup (CASSANDRA-11217)
|
||||||
* Reference leak with parallel repairs on the same table (CASSANDRA-11215)
|
* Reference leak with parallel repairs on the same table (CASSANDRA-11215)
|
||||||
Merged from 2.1:
|
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)
|
* InvalidateKeys should have a weak ref to key cache (CASSANDRA-11176)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
33
bin/cqlsh.py
33
bin/cqlsh.py
|
|
@ -480,7 +480,7 @@ COPY_COMMON_OPTIONS = ['DELIMITER', 'QUOTE', 'ESCAPE', 'HEADER', 'NULL', 'DATETI
|
||||||
'MAXATTEMPTS', 'REPORTFREQUENCY', 'DECIMALSEP', 'THOUSANDSSEP', 'BOOLSTYLE',
|
'MAXATTEMPTS', 'REPORTFREQUENCY', 'DECIMALSEP', 'THOUSANDSSEP', 'BOOLSTYLE',
|
||||||
'NUMPROCESSES', 'CONFIGFILE', 'RATEFILE']
|
'NUMPROCESSES', 'CONFIGFILE', 'RATEFILE']
|
||||||
COPY_FROM_OPTIONS = ['CHUNKSIZE', 'INGESTRATE', 'MAXBATCHSIZE', 'MINBATCHSIZE', 'MAXROWS',
|
COPY_FROM_OPTIONS = ['CHUNKSIZE', 'INGESTRATE', 'MAXBATCHSIZE', 'MINBATCHSIZE', 'MAXROWS',
|
||||||
'SKIPROWS', 'SKIPCOLS', 'MAXPARSEERRORS', 'MAXINSERTERRORS', 'ERRFILE', 'TTL']
|
'SKIPROWS', 'SKIPCOLS', 'MAXPARSEERRORS', 'MAXINSERTERRORS', 'ERRFILE', 'PREPAREDSTATEMENTS', 'TTL']
|
||||||
COPY_TO_OPTIONS = ['ENCODING', 'PAGESIZE', 'PAGETIMEOUT', 'BEGINTOKEN', 'ENDTOKEN', 'MAXOUTPUTSIZE', 'MAXREQUESTS']
|
COPY_TO_OPTIONS = ['ENCODING', 'PAGESIZE', 'PAGETIMEOUT', 'BEGINTOKEN', 'ENDTOKEN', 'MAXOUTPUTSIZE', 'MAXREQUESTS']
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -607,7 +607,24 @@ def insert_driver_hooks():
|
||||||
|
|
||||||
|
|
||||||
def extend_cql_deserialization():
|
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
|
||||||
|
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.BytesType.deserialize = staticmethod(lambda byts, protocol_version: bytearray(byts))
|
||||||
|
|
||||||
class DateOverFlowWarning(RuntimeWarning):
|
class DateOverFlowWarning(RuntimeWarning):
|
||||||
|
|
@ -624,6 +641,9 @@ def extend_cql_deserialization():
|
||||||
|
|
||||||
cassandra.cqltypes.DateType.deserialize = staticmethod(deserialize_date_fallback_int)
|
cassandra.cqltypes.DateType.deserialize = staticmethod(deserialize_date_fallback_int)
|
||||||
|
|
||||||
|
if hasattr(cassandra, 'deserializers'):
|
||||||
|
del cassandra.deserializers.DesDateType
|
||||||
|
|
||||||
# Return cassandra.cqltypes.EMPTY instead of None for empty values
|
# Return cassandra.cqltypes.EMPTY instead of None for empty values
|
||||||
cassandra.cqltypes.CassandraType.support_empty_values = True
|
cassandra.cqltypes.CassandraType.support_empty_values = True
|
||||||
|
|
||||||
|
|
@ -1856,9 +1876,9 @@ class Shell(cmd.Cmd):
|
||||||
|
|
||||||
Available COPY FROM options and defaults:
|
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
|
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
|
MAXBATCHSIZE=20 - the maximum size of an import batch
|
||||||
MAXROWS=-1 - the maximum number of rows, -1 means no maximum
|
MAXROWS=-1 - the maximum number of rows, -1 means no maximum
|
||||||
SKIPROWS=0 - the number of rows to skip
|
SKIPROWS=0 - the number of rows to skip
|
||||||
|
|
@ -1867,6 +1887,11 @@ class Shell(cmd.Cmd):
|
||||||
MAXINSERTERRORS=-1 - the maximum global number of insert errors, -1 means no maximum
|
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
|
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.
|
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.
|
||||||
TTL=3600 - the time to live in seconds, by default data will not expire
|
TTL=3600 - the time to live in seconds, by default data will not expire
|
||||||
|
|
||||||
Available COPY TO options and defaults:
|
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 datetime import timedelta, tzinfo
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
|
try:
|
||||||
|
from line_profiler import LineProfiler
|
||||||
|
HAS_LINE_PROFILER = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_LINE_PROFILER = False
|
||||||
|
|
||||||
ZERO = timedelta(0)
|
ZERO = timedelta(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -126,18 +132,35 @@ def get_file_encoding_bomsize(filename):
|
||||||
else:
|
else:
|
||||||
file_encoding, size = "utf-8", 0
|
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 = cProfile.Profile()
|
||||||
pr.enable()
|
pr.enable()
|
||||||
return pr
|
return pr
|
||||||
|
|
||||||
|
|
||||||
def profile_off(pr):
|
def profile_off(pr, file_name):
|
||||||
pr.disable()
|
pr.disable()
|
||||||
s = StringIO()
|
s = StringIO()
|
||||||
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
|
|
||||||
ps.print_stats()
|
if HAS_LINE_PROFILER and isinstance(pr, LineProfiler):
|
||||||
print s.getvalue()
|
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.
|
# limitations under the License.
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
from Cython.Build import cythonize
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="cassandra-pylib",
|
name="cassandra-pylib",
|
||||||
description="Cassandra Python Libraries",
|
description="Cassandra Python Libraries",
|
||||||
packages=["cqlshlib"],
|
packages=["cqlshlib"],
|
||||||
|
ext_modules=cythonize("cqlshlib/copyutil.py"),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue