mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.2' into cassandra-3.0
Conflicts: CHANGES.txt
This commit is contained in:
commit
d689da3677
|
|
@ -19,6 +19,7 @@
|
|||
header is received (CASSANDRA-11464)
|
||||
* Validate that num_tokens and initial_token are consistent with one another (CASSANDRA-10120)
|
||||
Merged from 2.2:
|
||||
* cqlsh: correctly handle non-ascii chars in error messages (CASSANDRA-11626)
|
||||
* Exit JVM if JMX server fails to startup (CASSANDRA-11540)
|
||||
* Produce a heap dump when exiting on OOM (CASSANDRA-9861)
|
||||
* Restore ability to filter on clustering columns when using a 2i (CASSANDRA-11510)
|
||||
|
|
|
|||
20
bin/cqlsh.py
20
bin/cqlsh.py
|
|
@ -36,7 +36,6 @@ import codecs
|
|||
import ConfigParser
|
||||
import csv
|
||||
import getpass
|
||||
import locale
|
||||
import optparse
|
||||
import os
|
||||
import platform
|
||||
|
|
@ -917,7 +916,7 @@ class Shell(cmd.Cmd):
|
|||
if ksname is None:
|
||||
ksname = self.current_keyspace
|
||||
layout = self.get_table_meta(ksname, cfname)
|
||||
return [str(col) for col in layout.columns]
|
||||
return [unicode(col) for col in layout.columns]
|
||||
|
||||
def get_usertype_names(self, ksname=None):
|
||||
if ksname is None:
|
||||
|
|
@ -1155,7 +1154,7 @@ class Shell(cmd.Cmd):
|
|||
except EOFError:
|
||||
self.handle_eof()
|
||||
except CQL_ERRORS, cqlerr:
|
||||
self.printerr(str(cqlerr))
|
||||
self.printerr(unicode(cqlerr))
|
||||
except KeyboardInterrupt:
|
||||
self.reset_statement()
|
||||
print
|
||||
|
|
@ -1317,10 +1316,10 @@ class Shell(cmd.Cmd):
|
|||
break
|
||||
except cassandra.OperationTimedOut, err:
|
||||
self.refresh_schema_metadata_best_effort()
|
||||
self.printerr(str(err.__class__.__name__) + ": " + str(err))
|
||||
self.printerr(unicode(err.__class__.__name__) + u": " + unicode(err))
|
||||
return False, None
|
||||
except CQL_ERRORS, err:
|
||||
self.printerr(str(err.__class__.__name__) + ": " + str(err))
|
||||
self.printerr(unicode(err.__class__.__name__) + u": " + unicode(err))
|
||||
return False, None
|
||||
except Exception, err:
|
||||
import traceback
|
||||
|
|
@ -2329,7 +2328,16 @@ class Shell(cmd.Cmd):
|
|||
def writeresult(self, text, color=None, newline=True, out=None):
|
||||
if out is None:
|
||||
out = self.query_out
|
||||
out.write(self.applycolor(str(text), color) + ('\n' if newline else ''))
|
||||
|
||||
# convert Exceptions, etc to text
|
||||
if not isinstance(text, (unicode, str)):
|
||||
text = unicode(text)
|
||||
|
||||
if isinstance(text, unicode):
|
||||
text = text.encode(self.encoding)
|
||||
|
||||
to_write = self.applycolor(text, color) + ('\n' if newline else '')
|
||||
out.write(to_write)
|
||||
|
||||
def flush_output(self):
|
||||
self.query_out.flush()
|
||||
|
|
|
|||
|
|
@ -76,8 +76,9 @@ def printdebugmsg(msg):
|
|||
printmsg(msg)
|
||||
|
||||
|
||||
def printmsg(msg, eol='\n'):
|
||||
sys.stdout.write(msg + eol)
|
||||
def printmsg(msg, eol='\n', encoding='utf8'):
|
||||
sys.stdout.write(msg.encode(encoding))
|
||||
sys.stdout.write(eol)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
|
|
@ -219,6 +220,7 @@ class CopyTask(object):
|
|||
self.options = self.parse_options(opts, direction)
|
||||
|
||||
self.num_processes = self.options.copy['numprocesses']
|
||||
self.encoding = self.options.copy['encoding']
|
||||
self.printmsg('Using %d child processes' % (self.num_processes,))
|
||||
|
||||
if direction == 'from':
|
||||
|
|
@ -601,7 +603,8 @@ class ExportTask(CopyTask):
|
|||
if not self.writer.open():
|
||||
return 0
|
||||
|
||||
self.printmsg("\nStarting copy of %s.%s with columns %s." % (self.ks, self.table, self.columns))
|
||||
columns = u"[" + u", ".join(self.columns) + u"]"
|
||||
self.printmsg(u"\nStarting copy of %s.%s with columns %s." % (self.ks, self.table, columns), encoding=self.encoding)
|
||||
|
||||
params = self.make_params()
|
||||
for i in xrange(self.num_processes):
|
||||
|
|
@ -1093,7 +1096,8 @@ class ImportTask(CopyTask):
|
|||
if not self.validate_columns():
|
||||
return 0
|
||||
|
||||
self.printmsg("\nStarting copy of %s.%s with columns %s." % (self.ks, self.table, self.valid_columns))
|
||||
columns = u"[" + u", ".join(self.valid_columns) + u"]"
|
||||
self.printmsg(u"\nStarting copy of %s.%s with columns %s." % (self.ks, self.table, columns), encoding=self.encoding)
|
||||
|
||||
try:
|
||||
params = self.make_params()
|
||||
|
|
@ -1115,7 +1119,7 @@ class ImportTask(CopyTask):
|
|||
profile_off(pr, file_name='parent_profile_%d.txt' % (os.getpid(),))
|
||||
|
||||
except Exception, exc:
|
||||
shell.printerr(str(exc))
|
||||
shell.printerr(unicode(exc))
|
||||
if shell.debug:
|
||||
traceback.print_exc()
|
||||
return 0
|
||||
|
|
@ -1470,7 +1474,7 @@ class ExportProcess(ChildProcess):
|
|||
if print_traceback and sys.exc_info()[1] == err:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
msg = str(err)
|
||||
msg = unicode(err)
|
||||
return msg
|
||||
|
||||
def report_error(self, err, token_range):
|
||||
|
|
|
|||
Loading…
Reference in New Issue