cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [4/7] git commit: Fix scrub against collection type
Date Fri, 01 Aug 2014 22:21:35 GMT
Fix scrub against collection type

patch by yukim; reviewed by thobbs for CASSANDRA-7665


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/110a132b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/110a132b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/110a132b

Branch: refs/heads/cassandra-2.1.0
Commit: 110a132b18f006c4c9ca0c5913cbe64c5d3e01f7
Parents: a09e53c
Author: Yuki Morishita <yukim@apache.org>
Authored: Fri Aug 1 17:20:25 2014 -0500
Committer: Yuki Morishita <yukim@apache.org>
Committed: Fri Aug 1 17:20:25 2014 -0500

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 src/java/org/apache/cassandra/db/AbstractCell.java     |  2 +-
 .../org/apache/cassandra/db/marshal/AbstractType.java  | 13 +++++++++++++
 .../apache/cassandra/db/marshal/CollectionType.java    |  6 ++++++
 4 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/110a132b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6ab8a73..9cff11a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -25,6 +25,7 @@
  * (cqlsh) Correctly handle paged result sets (CASSANDRA-7625)
  * (cqlsh) Improve waiting for a trace to complete (CASSANDRA-7626)
  * Fix tracing of concurrent range slices and 2ary index queries (CASSANDRA-7626)
+ * Fix scrub against collection type (CASSANDRA-7665)
 Merged from 2.0:
  * Set gc_grace_seconds to seven days for system schema tables (CASSANDRA-7668)
  * SimpleSeedProvider no longer caches seeds forever (CASSANDRA-7663)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/110a132b/src/java/org/apache/cassandra/db/AbstractCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/AbstractCell.java b/src/java/org/apache/cassandra/db/AbstractCell.java
index 82f1989..f27871f 100644
--- a/src/java/org/apache/cassandra/db/AbstractCell.java
+++ b/src/java/org/apache/cassandra/db/AbstractCell.java
@@ -164,7 +164,7 @@ public abstract class AbstractCell implements Cell
 
         AbstractType<?> valueValidator = metadata.getValueValidator(name());
         if (valueValidator != null)
-            valueValidator.validate(value());
+            valueValidator.validateCellValue(value());
     }
 
     public static Cell create(CellName name, ByteBuffer value, long timestamp, int ttl, CFMetaData
metadata)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/110a132b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/AbstractType.java b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
index f45de36..4e1f2a3 100644
--- a/src/java/org/apache/cassandra/db/marshal/AbstractType.java
+++ b/src/java/org/apache/cassandra/db/marshal/AbstractType.java
@@ -95,6 +95,19 @@ public abstract class AbstractType<T> implements Comparator<ByteBuffer>
         getSerializer().validate(bytes);
     }
 
+    /**
+     * Validate cell value. Unlike {@linkplain #validate(java.nio.ByteBuffer)},
+     * cell value is passed to validate its content.
+     * Usually, this is the same as validate except collection.
+     *
+     * @param cellValue ByteBuffer representing cell value
+     * @throws MarshalException
+     */
+    public void validateCellValue(ByteBuffer cellValue) throws MarshalException
+    {
+        validate(cellValue);
+    }
+
     /* Most of our internal type should override that. */
     public CQL3Type asCQL3Type()
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/110a132b/src/java/org/apache/cassandra/db/marshal/CollectionType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CollectionType.java b/src/java/org/apache/cassandra/db/marshal/CollectionType.java
index be344f9..8a5fe5c 100644
--- a/src/java/org/apache/cassandra/db/marshal/CollectionType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CollectionType.java
@@ -64,6 +64,12 @@ public abstract class CollectionType<T> extends AbstractType<T>
     public abstract CollectionSerializer<T> getSerializer();
 
     @Override
+    public void validateCellValue(ByteBuffer cellValue) throws MarshalException
+    {
+        valueComparator().validate(cellValue);
+    }
+
+    @Override
     public String toString()
     {
         StringBuilder sb = new StringBuilder();


Mime
View raw message