You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by st...@apache.org on 2017/03/02 02:02:25 UTC
[1/6] cassandra git commit: Cqlsh copy-from should error out when csv
contains invalid data for collections
Repository: cassandra
Updated Branches:
refs/heads/cassandra-3.0 45b6b5b1c -> 496cfa8f5
refs/heads/cassandra-3.11 093b2e294 -> 943fb02ff
refs/heads/trunk d91b40039 -> f08cf5af0
Cqlsh copy-from should error out when csv contains invalid data for collections
patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-13071
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/496cfa8f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/496cfa8f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/496cfa8f
Branch: refs/heads/cassandra-3.0
Commit: 496cfa8f5b160d26794b346ce360b513069aa300
Parents: 45b6b5b
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Wed Feb 22 17:35:57 2017 +0000
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Mar 2 09:58:58 2017 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/496cfa8f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c3ac39..1c3869f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.12
+ * Cqlsh copy-from should error out when csv contains invalid data for collections (CASSANDRA-13071)
* Update c.yaml doc for offheap memtables (CASSANDRA-13179)
* Faster StreamingHistogram (CASSANDRA-13038)
* Legacy deserializer can create unexpected boundary range tombstones (CASSANDRA-13237)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/496cfa8f/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 710a640..226fad5 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1881,11 +1881,30 @@ class ImportConversion(object):
def split(val, sep=','):
"""
- Split into a list of values whenever we encounter a separator but
+ Split "val" into a list of values whenever the separator "sep" is found, but
ignore separators inside parentheses or single quotes, except for the two
- outermost parentheses, which will be ignored. We expect val to be at least
- 2 characters long (the two outer parentheses).
+ outermost parentheses, which will be ignored. This method is called when parsing composite
+ types, "val" should be at least 2 characters long, the first char should be an
+ open parenthesis and the last char should be a matching closing parenthesis. We could also
+ check exactly which parenthesis type depending on the caller, but I don't want to enforce
+ too many checks that don't necessarily provide any additional benefits, and risk breaking
+ data that could previously be imported, even if strictly speaking it is incorrect CQL.
+ For example, right now we accept sets that start with '[' and ']', I don't want to break this
+ by enforcing '{' and '}' in a minor release.
"""
+ def is_open_paren(cc):
+ return cc == '{' or cc == '[' or cc == '('
+
+ def is_close_paren(cc):
+ return cc == '}' or cc == ']' or cc == ')'
+
+ def paren_match(c1, c2):
+ return (c1 == '{' and c2 == '}') or (c1 == '[' and c2 == ']') or (c1 == '(' and c2 == ')')
+
+ if len(val) < 2 or not paren_match(val[0], val[-1]):
+ raise ParseError('Invalid composite string, it should start and end with matching parentheses: {}'
+ .format(val))
+
ret = []
last = 1
level = 0
@@ -1894,9 +1913,9 @@ class ImportConversion(object):
if c == '\'':
quote = not quote
elif not quote:
- if c == '{' or c == '[' or c == '(':
+ if is_open_paren(c):
level += 1
- elif c == '}' or c == ']' or c == ')':
+ elif is_close_paren(c):
level -= 1
elif c == sep and level == 1:
ret.append(val[last:i])
[6/6] cassandra git commit: Merge branch 'cassandra-3.11' into trunk
Posted by st...@apache.org.
Merge branch 'cassandra-3.11' into trunk
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f08cf5af
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f08cf5af
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f08cf5af
Branch: refs/heads/trunk
Commit: f08cf5af0da0ca44944dfc30f22017f1062b1eff
Parents: d91b400 943fb02
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Thu Mar 2 10:00:40 2017 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Mar 2 10:00:40 2017 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f08cf5af/CHANGES.txt
----------------------------------------------------------------------
[2/6] cassandra git commit: Cqlsh copy-from should error out when csv
contains invalid data for collections
Posted by st...@apache.org.
Cqlsh copy-from should error out when csv contains invalid data for collections
patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-13071
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/496cfa8f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/496cfa8f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/496cfa8f
Branch: refs/heads/cassandra-3.11
Commit: 496cfa8f5b160d26794b346ce360b513069aa300
Parents: 45b6b5b
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Wed Feb 22 17:35:57 2017 +0000
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Mar 2 09:58:58 2017 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/496cfa8f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c3ac39..1c3869f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.12
+ * Cqlsh copy-from should error out when csv contains invalid data for collections (CASSANDRA-13071)
* Update c.yaml doc for offheap memtables (CASSANDRA-13179)
* Faster StreamingHistogram (CASSANDRA-13038)
* Legacy deserializer can create unexpected boundary range tombstones (CASSANDRA-13237)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/496cfa8f/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 710a640..226fad5 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1881,11 +1881,30 @@ class ImportConversion(object):
def split(val, sep=','):
"""
- Split into a list of values whenever we encounter a separator but
+ Split "val" into a list of values whenever the separator "sep" is found, but
ignore separators inside parentheses or single quotes, except for the two
- outermost parentheses, which will be ignored. We expect val to be at least
- 2 characters long (the two outer parentheses).
+ outermost parentheses, which will be ignored. This method is called when parsing composite
+ types, "val" should be at least 2 characters long, the first char should be an
+ open parenthesis and the last char should be a matching closing parenthesis. We could also
+ check exactly which parenthesis type depending on the caller, but I don't want to enforce
+ too many checks that don't necessarily provide any additional benefits, and risk breaking
+ data that could previously be imported, even if strictly speaking it is incorrect CQL.
+ For example, right now we accept sets that start with '[' and ']', I don't want to break this
+ by enforcing '{' and '}' in a minor release.
"""
+ def is_open_paren(cc):
+ return cc == '{' or cc == '[' or cc == '('
+
+ def is_close_paren(cc):
+ return cc == '}' or cc == ']' or cc == ')'
+
+ def paren_match(c1, c2):
+ return (c1 == '{' and c2 == '}') or (c1 == '[' and c2 == ']') or (c1 == '(' and c2 == ')')
+
+ if len(val) < 2 or not paren_match(val[0], val[-1]):
+ raise ParseError('Invalid composite string, it should start and end with matching parentheses: {}'
+ .format(val))
+
ret = []
last = 1
level = 0
@@ -1894,9 +1913,9 @@ class ImportConversion(object):
if c == '\'':
quote = not quote
elif not quote:
- if c == '{' or c == '[' or c == '(':
+ if is_open_paren(c):
level += 1
- elif c == '}' or c == ']' or c == ')':
+ elif is_close_paren(c):
level -= 1
elif c == sep and level == 1:
ret.append(val[last:i])
[4/6] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.11
Posted by st...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/943fb02f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/943fb02f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/943fb02f
Branch: refs/heads/trunk
Commit: 943fb02ffda7b7c65ec722d18a5c184fa480f525
Parents: 093b2e2 496cfa8
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Thu Mar 2 10:00:20 2017 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Mar 2 10:00:20 2017 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/943fb02f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index cf15d3a,1c3869f..eeb2215
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,15 -1,6 +1,16 @@@
-3.0.12
+3.11.0
+ * Fix equality comparisons of columns using the duration type (CASSANDRA-13174)
+ * Obfuscate password in stress-graphs (CASSANDRA-12233)
+ * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
+ * nodetool stopdaemon errors out (CASSANDRA-13030)
+ * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
+ * Fix primary index calculation for SASI (CASSANDRA-12910)
+ * More fixes to the TokenAllocator (CASSANDRA-12990)
+ * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
+Merged from 3.0:
+ * Cqlsh copy-from should error out when csv contains invalid data for collections (CASSANDRA-13071)
- * Update c.yaml doc for offheap memtables (CASSANDRA-13179)
+ * Fix "multiple versions of ant detected..." when running ant test (CASSANDRA-13232)
+ * Coalescing strategy sleeps too much (CASSANDRA-13090)
* Faster StreamingHistogram (CASSANDRA-13038)
* Legacy deserializer can create unexpected boundary range tombstones (CASSANDRA-13237)
* Remove unnecessary assertion from AntiCompactionTest (CASSANDRA-13070)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/943fb02f/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
[5/6] cassandra git commit: Merge branch 'cassandra-3.0' into
cassandra-3.11
Posted by st...@apache.org.
Merge branch 'cassandra-3.0' into cassandra-3.11
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/943fb02f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/943fb02f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/943fb02f
Branch: refs/heads/cassandra-3.11
Commit: 943fb02ffda7b7c65ec722d18a5c184fa480f525
Parents: 093b2e2 496cfa8
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Thu Mar 2 10:00:20 2017 +0800
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Mar 2 10:00:20 2017 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/943fb02f/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index cf15d3a,1c3869f..eeb2215
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,15 -1,6 +1,16 @@@
-3.0.12
+3.11.0
+ * Fix equality comparisons of columns using the duration type (CASSANDRA-13174)
+ * Obfuscate password in stress-graphs (CASSANDRA-12233)
+ * Move to FastThreadLocalThread and FastThreadLocal (CASSANDRA-13034)
+ * nodetool stopdaemon errors out (CASSANDRA-13030)
+ * Tables in system_distributed should not use gcgs of 0 (CASSANDRA-12954)
+ * Fix primary index calculation for SASI (CASSANDRA-12910)
+ * More fixes to the TokenAllocator (CASSANDRA-12990)
+ * NoReplicationTokenAllocator should work with zero replication factor (CASSANDRA-12983)
+Merged from 3.0:
+ * Cqlsh copy-from should error out when csv contains invalid data for collections (CASSANDRA-13071)
- * Update c.yaml doc for offheap memtables (CASSANDRA-13179)
+ * Fix "multiple versions of ant detected..." when running ant test (CASSANDRA-13232)
+ * Coalescing strategy sleeps too much (CASSANDRA-13090)
* Faster StreamingHistogram (CASSANDRA-13038)
* Legacy deserializer can create unexpected boundary range tombstones (CASSANDRA-13237)
* Remove unnecessary assertion from AntiCompactionTest (CASSANDRA-13070)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/943fb02f/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
[3/6] cassandra git commit: Cqlsh copy-from should error out when csv
contains invalid data for collections
Posted by st...@apache.org.
Cqlsh copy-from should error out when csv contains invalid data for collections
patch by Stefania Alborghetti; reviewed by Paulo Motta for CASSANDRA-13071
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/496cfa8f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/496cfa8f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/496cfa8f
Branch: refs/heads/trunk
Commit: 496cfa8f5b160d26794b346ce360b513069aa300
Parents: 45b6b5b
Author: Stefania Alborghetti <st...@datastax.com>
Authored: Wed Feb 22 17:35:57 2017 +0000
Committer: Stefania Alborghetti <st...@datastax.com>
Committed: Thu Mar 2 09:58:58 2017 +0800
----------------------------------------------------------------------
CHANGES.txt | 1 +
pylib/cqlshlib/copyutil.py | 29 ++++++++++++++++++++++++-----
2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/496cfa8f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 2c3ac39..1c3869f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.0.12
+ * Cqlsh copy-from should error out when csv contains invalid data for collections (CASSANDRA-13071)
* Update c.yaml doc for offheap memtables (CASSANDRA-13179)
* Faster StreamingHistogram (CASSANDRA-13038)
* Legacy deserializer can create unexpected boundary range tombstones (CASSANDRA-13237)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/496cfa8f/pylib/cqlshlib/copyutil.py
----------------------------------------------------------------------
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 710a640..226fad5 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -1881,11 +1881,30 @@ class ImportConversion(object):
def split(val, sep=','):
"""
- Split into a list of values whenever we encounter a separator but
+ Split "val" into a list of values whenever the separator "sep" is found, but
ignore separators inside parentheses or single quotes, except for the two
- outermost parentheses, which will be ignored. We expect val to be at least
- 2 characters long (the two outer parentheses).
+ outermost parentheses, which will be ignored. This method is called when parsing composite
+ types, "val" should be at least 2 characters long, the first char should be an
+ open parenthesis and the last char should be a matching closing parenthesis. We could also
+ check exactly which parenthesis type depending on the caller, but I don't want to enforce
+ too many checks that don't necessarily provide any additional benefits, and risk breaking
+ data that could previously be imported, even if strictly speaking it is incorrect CQL.
+ For example, right now we accept sets that start with '[' and ']', I don't want to break this
+ by enforcing '{' and '}' in a minor release.
"""
+ def is_open_paren(cc):
+ return cc == '{' or cc == '[' or cc == '('
+
+ def is_close_paren(cc):
+ return cc == '}' or cc == ']' or cc == ')'
+
+ def paren_match(c1, c2):
+ return (c1 == '{' and c2 == '}') or (c1 == '[' and c2 == ']') or (c1 == '(' and c2 == ')')
+
+ if len(val) < 2 or not paren_match(val[0], val[-1]):
+ raise ParseError('Invalid composite string, it should start and end with matching parentheses: {}'
+ .format(val))
+
ret = []
last = 1
level = 0
@@ -1894,9 +1913,9 @@ class ImportConversion(object):
if c == '\'':
quote = not quote
elif not quote:
- if c == '{' or c == '[' or c == '(':
+ if is_open_paren(c):
level += 1
- elif c == '}' or c == ']' or c == ')':
+ elif is_close_paren(c):
level -= 1
elif c == sep and level == 1:
ret.append(val[last:i])