You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/05/14 15:05:54 UTC

[1/2] git commit: Fix CellName comparison bugs

Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 50c18fd40 -> 4ee372106


Fix CellName comparison bugs

Patch by tjake; reviewed by bes for CASSANDRA-7227


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

Branch: refs/heads/cassandra-2.1
Commit: 0f977c597a6b70984de96bcc49474acdb12ad2ea
Parents: 50c18fd
Author: Jake Luciani <ja...@apache.org>
Authored: Wed May 14 08:37:34 2014 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Wed May 14 08:37:34 2014 -0400

----------------------------------------------------------------------
 .../composites/AbstractSimpleCellNameType.java  |   2 +-
 .../cassandra/db/composites/SimpleCType.java    |   4 +-
 .../cassandra/db/composites/CTypeTest.java      | 123 +++++++++++++++++++
 3 files changed, 126 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0f977c59/src/java/org/apache/cassandra/db/composites/AbstractSimpleCellNameType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/composites/AbstractSimpleCellNameType.java b/src/java/org/apache/cassandra/db/composites/AbstractSimpleCellNameType.java
index 6500069..95386fd 100644
--- a/src/java/org/apache/cassandra/db/composites/AbstractSimpleCellNameType.java
+++ b/src/java/org/apache/cassandra/db/composites/AbstractSimpleCellNameType.java
@@ -64,7 +64,7 @@ public abstract class AbstractSimpleCellNameType extends AbstractCellNameType
         boolean c1isEmpty = c1.isEmpty();
         boolean c2isEmpty = c2.isEmpty();
         if (c1isEmpty || c2isEmpty)
-            return c1isEmpty ? 1 : (c2isEmpty ? -1 : 0);
+            return !c1isEmpty ? 1 : (!c2isEmpty ? -1 : 0);
 
         return type.compare(c1.get(0), c2.get(0));
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0f977c59/src/java/org/apache/cassandra/db/composites/SimpleCType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/composites/SimpleCType.java b/src/java/org/apache/cassandra/db/composites/SimpleCType.java
index fe86655..35e14f9 100644
--- a/src/java/org/apache/cassandra/db/composites/SimpleCType.java
+++ b/src/java/org/apache/cassandra/db/composites/SimpleCType.java
@@ -58,14 +58,14 @@ public class SimpleCType extends AbstractCType
             ByteBuffer b1 = c1.toByteBuffer();
             ByteBuffer b2 = c2.toByteBuffer();
             if (!b1.hasRemaining() || !b2.hasRemaining())
-
+                return b1.hasRemaining() ? 1 : (b2.hasRemaining() ? -1 : 0);
             return ByteBufferUtil.compareUnsigned(b1, b2);
         }
 
         boolean c1isEmpty = c1.isEmpty();
         boolean c2isEmpty = c2.isEmpty();
         if (c1isEmpty || c2isEmpty)
-            return c1isEmpty ? 1 : (c2isEmpty ? -1 : 0);
+            return !c1isEmpty ? 1 : (!c2isEmpty ? -1 : 0);
 
         return type.compare(c1.get(0), c2.get(0));
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0f977c59/test/unit/org/apache/cassandra/db/composites/CTypeTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/composites/CTypeTest.java b/test/unit/org/apache/cassandra/db/composites/CTypeTest.java
new file mode 100644
index 0000000..4bd755b
--- /dev/null
+++ b/test/unit/org/apache/cassandra/db/composites/CTypeTest.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.db.composites;
+
+import com.google.common.collect.Lists;
+import org.apache.cassandra.db.marshal.*;
+import org.apache.cassandra.utils.ByteBufferUtil;
+import org.junit.Test;
+
+import java.util.List;
+
+public class CTypeTest
+{
+    static final List<AbstractType<?>> types = Lists.newArrayList();
+    static
+    {
+        types.add(UTF8Type.instance);
+        types.add(UUIDType.instance);
+        types.add(Int32Type.instance);
+    }
+
+    static final CellNameType cdtype = new CompoundDenseCellNameType(types);
+    static final CellNameType stype1 = new SimpleDenseCellNameType(BytesType.instance);
+    static final CellNameType stype2 = new SimpleDenseCellNameType(UUIDType.instance);
+
+    @Test
+    public void testCompoundType()
+    {
+        Composite a1 = cdtype.makeCellName("a",UUIDType.instance.fromString("00000000-0000-0000-0000-000000000000"), 1);
+        Composite a2 = cdtype.makeCellName("a",UUIDType.instance.fromString("00000000-0000-0000-0000-000000000000"), 100);
+        Composite b1 = cdtype.makeCellName("a",UUIDType.instance.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"), 1);
+        Composite b2 = cdtype.makeCellName("a",UUIDType.instance.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"), 100);
+        Composite c1 = cdtype.makeCellName("z",UUIDType.instance.fromString("00000000-0000-0000-0000-000000000000"), 1);
+        Composite c2 = cdtype.makeCellName("z",UUIDType.instance.fromString("00000000-0000-0000-0000-000000000000"), 100);
+        Composite d1 = cdtype.makeCellName("z",UUIDType.instance.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"), 1);
+        Composite d2 = cdtype.makeCellName("z",UUIDType.instance.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"), 100);
+
+        Composite z1 = cdtype.makeCellName(ByteBufferUtil.EMPTY_BYTE_BUFFER,UUIDType.instance.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"), 100);
+
+        assert cdtype.compare(a1,a2) < 0;
+        assert cdtype.compare(a2,b1) < 0;
+        assert cdtype.compare(b1,b2) < 0;
+        assert cdtype.compare(b2,c1) < 0;
+        assert cdtype.compare(c1,c2) < 0;
+        assert cdtype.compare(c2,d1) < 0;
+        assert cdtype.compare(d1,d2) < 0;
+
+        assert cdtype.compare(a2,a1) > 0;
+        assert cdtype.compare(b1,a2) > 0;
+        assert cdtype.compare(b2,b1) > 0;
+        assert cdtype.compare(c1,b2) > 0;
+        assert cdtype.compare(c2,c1) > 0;
+        assert cdtype.compare(d1,c2) > 0;
+        assert cdtype.compare(d2,d1) > 0;
+
+        assert cdtype.compare(z1,a1) < 0;
+        assert cdtype.compare(z1,a2) < 0;
+        assert cdtype.compare(z1,b1) < 0;
+        assert cdtype.compare(z1,b2) < 0;
+        assert cdtype.compare(z1,c1) < 0;
+        assert cdtype.compare(z1,c2) < 0;
+        assert cdtype.compare(z1,d1) < 0;
+        assert cdtype.compare(z1,d2) < 0;
+
+        assert cdtype.compare(a1,a1) == 0;
+        assert cdtype.compare(a2,a2) == 0;
+        assert cdtype.compare(b1,b1) == 0;
+        assert cdtype.compare(b2,b2) == 0;
+        assert cdtype.compare(c1,c1) == 0;
+        assert cdtype.compare(c2,c2) == 0;
+        assert cdtype.compare(z1,z1) == 0;
+    }
+
+    @Test
+    public void testSimpleType2()
+    {
+        CellName a = stype2.makeCellName(UUIDType.instance.fromString("00000000-0000-0000-0000-000000000000"));
+        CellName z = stype2.makeCellName(UUIDType.instance.fromString("ffffffff-ffff-ffff-ffff-ffffffffffff"));
+        Composite empty = Composites.EMPTY;
+
+        assert stype2.compare(a,z) < 0;
+        assert stype2.compare(z,a) > 0;
+        assert stype2.compare(a,a) == 0;
+        assert stype2.compare(z,z) == 0;
+        assert stype2.compare(empty, a) < 0;
+        assert stype2.compare(a,empty) > 0;
+        assert stype2.compare(empty, empty) == 0;
+    }
+
+
+    @Test
+    public void testSimpleType1()
+    {
+        CellName a = stype1.makeCellName(ByteBufferUtil.bytes("a"));
+        CellName z = stype1.makeCellName(ByteBufferUtil.bytes("z"));
+        Composite empty = Composites.EMPTY;
+
+        assert stype1.compare(a,z) < 0;
+        assert stype1.compare(z,a) > 0;
+        assert stype1.compare(a,a) == 0;
+        assert stype1.compare(z,z) == 0;
+        assert stype1.compare(empty, a) < 0;
+        assert stype1.compare(a,empty) > 0;
+        assert stype1.compare(empty, empty) == 0;
+
+    }
+
+}


[2/2] git commit: Followup commit to fix maven deps on boundary's NBHM for CASSANDRA-7128

Posted by ja...@apache.org.
Followup commit to fix maven deps on boundary's NBHM for CASSANDRA-7128


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

Branch: refs/heads/cassandra-2.1
Commit: 4ee372106fadc8033a547597e642ab99ea4c2618
Parents: 0f977c5
Author: Jake Luciani <ja...@apache.org>
Authored: Wed May 14 09:02:45 2014 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Wed May 14 09:02:45 2014 -0400

----------------------------------------------------------------------
 build.properties.default              |   1 -
 build.xml                             |   6 +-----
 lib/high-scale-lib-1.0.5.jar          | Bin 104776 -> 0 bytes
 lib/high-scale-lib-1.0.6.jar          | Bin 0 -> 105118 bytes
 lib/licenses/high-scale-lib-1.0.6.txt |  29 +++++++++++++++++++++++++++++
 lib/licenses/high-scale-lib-1.1.2.txt |  29 -----------------------------
 6 files changed, 30 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/4ee37210/build.properties.default
----------------------------------------------------------------------
diff --git a/build.properties.default b/build.properties.default
index be9b23b..ff6aea0 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -4,5 +4,4 @@ artifact.remoteRepository.java.net2:   http://download.java.net/maven/2
 artifact.remoteRepository.apache:      https://repository.apache.org/content/repositories/releases
 artifact.remoteRepository.jclouds:     http://jclouds.googlecode.com/svn/repo
 artifact.remoteRepository.oauth:       http://oauth.googlecode.com/svn/code/maven
-artifact.remoteRepository.boundary:	   http://maven.boundary.com/artifactory/external	
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4ee37210/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index fa3b5ca..044e3a2 100644
--- a/build.xml
+++ b/build.xml
@@ -283,7 +283,6 @@
       <artifact:remoteRepository id="central"   url="${artifact.remoteRepository.central}"/>
       <artifact:remoteRepository id="java.net2" url="${artifact.remoteRepository.java.net2}"/>
       <artifact:remoteRepository id="apache"    url="${artifact.remoteRepository.apache}"/>
-      <!--      <artifact:remoteRepository id="boundary"  url="${artifact.remoteRepository.boundary}"/> -->
 
       <macrodef name="install">
         <attribute name="pomFile"/>
@@ -362,7 +361,7 @@
             <exclusion groupId="junit" artifactId="junit"/>
           </dependency>
           <dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>
-          <dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.5"/>
+          <dependency groupId="com.boundary" artifactId="high-scale-lib" version="1.0.6"/>
           <dependency groupId="com.github.jbellis" artifactId="jamm" version="0.2.6"/>
           <dependency groupId="com.thinkaurelius.thrift" artifactId="thrift-server" version="0.3.3">
 	      	<exclusion groupId="org.slf4j" artifactId="slf4j-log4j12"/>
@@ -543,7 +542,6 @@
           <remoteRepository refid="central"/>
           <remoteRepository refid="apache"/>
           <remoteRepository refid="java.net2"/>
-          <!--          <remoteRepository refid="boundary"/> -->
       </artifact:dependencies>
       <artifact:dependencies pomRefId="coverage-deps-pom"
                              pathId="cobertura.classpath">
@@ -569,7 +567,6 @@
         <remoteRepository refid="apache"/>
         <remoteRepository refid="central"/>
         <remoteRepository refid="oauth"/>
-        <!--        <remoteRepository refid="boundary"/> -->
       </artifact:dependencies>
       <copy todir="${test.lib}/jars">
         <fileset refid="test-dependency-jars"/>
@@ -590,7 +587,6 @@
         <remoteRepository refid="apache"/>
         <remoteRepository refid="central"/>
         <remoteRepository refid="java.net2"/>
-        <!--        <remoteRepository refid="boundary"/> -->
       </artifact:dependencies>
       <copy todir="${build.dir.lib}/jars">
         <fileset refid="test-dependency-jars"/>

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4ee37210/lib/high-scale-lib-1.0.5.jar
----------------------------------------------------------------------
diff --git a/lib/high-scale-lib-1.0.5.jar b/lib/high-scale-lib-1.0.5.jar
deleted file mode 100644
index d184472..0000000
Binary files a/lib/high-scale-lib-1.0.5.jar and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4ee37210/lib/high-scale-lib-1.0.6.jar
----------------------------------------------------------------------
diff --git a/lib/high-scale-lib-1.0.6.jar b/lib/high-scale-lib-1.0.6.jar
new file mode 100644
index 0000000..5269294
Binary files /dev/null and b/lib/high-scale-lib-1.0.6.jar differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4ee37210/lib/licenses/high-scale-lib-1.0.6.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/high-scale-lib-1.0.6.txt b/lib/licenses/high-scale-lib-1.0.6.txt
new file mode 100644
index 0000000..6e69cdc
--- /dev/null
+++ b/lib/licenses/high-scale-lib-1.0.6.txt
@@ -0,0 +1,29 @@
+
+The person or persons who have associated work with this document (the
+"Dedicator" or "Certifier") hereby either (a) certifies that, to the best
+of his knowledge, the work of authorship identified is in the public 
+domain of the country from which the work is published, or (b) hereby 
+dedicates whatever copyright the dedicators holds in the work of
+authorship identified below (the "Work") to the public domain. A
+certifier, moreover, dedicates any copyright interest he may have in the
+associated work, and for these purposes, is described as a "dedicator"
+below.
+
+A certifier has taken reasonable steps to verify the copyright status of
+this work. Certifier recognizes that his good faith efforts may not
+shield him from liability if in fact the work certified is not in the
+public domain.
+
+Dedicator makes this dedication for the benefit of the public at large and
+to the detriment of the Dedicator's heirs and successors. Dedicator
+intends this dedication to be an overt act of relinquishment in perpetuity
+of all present and future rights under copyright law, whether vested or
+contingent, in the Work. Dedicator understands that such relinquishment of
+all rights includes the relinquishment of all rights to enforce (by
+lawsuit or otherwise) those copyrights in the Work.
+
+Dedicator recognizes that, once placed in the public domain, the Work may
+be freely reproduced, distributed, transmitted, used, modified, built 
+upon, or otherwise exploited by anyone for any purpose, commercial or
+non-commercial, and in any way, including by methods that have not yet
+been invented or conceived.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/4ee37210/lib/licenses/high-scale-lib-1.1.2.txt
----------------------------------------------------------------------
diff --git a/lib/licenses/high-scale-lib-1.1.2.txt b/lib/licenses/high-scale-lib-1.1.2.txt
deleted file mode 100644
index 6e69cdc..0000000
--- a/lib/licenses/high-scale-lib-1.1.2.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-
-The person or persons who have associated work with this document (the
-"Dedicator" or "Certifier") hereby either (a) certifies that, to the best
-of his knowledge, the work of authorship identified is in the public 
-domain of the country from which the work is published, or (b) hereby 
-dedicates whatever copyright the dedicators holds in the work of
-authorship identified below (the "Work") to the public domain. A
-certifier, moreover, dedicates any copyright interest he may have in the
-associated work, and for these purposes, is described as a "dedicator"
-below.
-
-A certifier has taken reasonable steps to verify the copyright status of
-this work. Certifier recognizes that his good faith efforts may not
-shield him from liability if in fact the work certified is not in the
-public domain.
-
-Dedicator makes this dedication for the benefit of the public at large and
-to the detriment of the Dedicator's heirs and successors. Dedicator
-intends this dedication to be an overt act of relinquishment in perpetuity
-of all present and future rights under copyright law, whether vested or
-contingent, in the Work. Dedicator understands that such relinquishment of
-all rights includes the relinquishment of all rights to enforce (by
-lawsuit or otherwise) those copyrights in the Work.
-
-Dedicator recognizes that, once placed in the public domain, the Work may
-be freely reproduced, distributed, transmitted, used, modified, built 
-upon, or otherwise exploited by anyone for any purpose, commercial or
-non-commercial, and in any way, including by methods that have not yet
-been invented or conceived.