usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [18/50] git commit: Fixes issue with incorrect column comparator type.
Date Wed, 12 Feb 2014 13:21:26 GMT
Fixes issue with incorrect column comparator type.


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/b787221f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/b787221f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/b787221f

Branch: refs/heads/optimistic-tx-semantics
Commit: b787221ffd3cdce3bf9ed6dbf049ecf6dcb6e230
Parents: e38dda9
Author: Todd Nine <tnine@apigee.com>
Authored: Thu Jan 30 17:08:45 2014 -0700
Committer: Todd Nine <tnine@apigee.com>
Committed: Thu Jan 30 17:08:45 2014 -0700

----------------------------------------------------------------------
 .../collection/cassandra/ColumnTypes.java       | 22 ++++++++++++++++++++
 .../stage/write/EntityVersionSerializer.java    |  2 +-
 .../UniqueValueSerializationStrategyImpl.java   |  8 +++++--
 .../mvcc/stage/write/WriteUniqueVerify.java     |  4 ++--
 4 files changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b787221f/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cassandra/ColumnTypes.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cassandra/ColumnTypes.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cassandra/ColumnTypes.java
new file mode 100644
index 0000000..758d45e
--- /dev/null
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/cassandra/ColumnTypes.java
@@ -0,0 +1,22 @@
+package org.apache.usergrid.persistence.collection.cassandra;
+
+
+import org.apache.cassandra.db.marshal.DynamicCompositeType;
+
+
+/**
+ * Simple class to hold constants we'll need for column types
+ *
+ */
+public class ColumnTypes {
+
+    /**
+     * Constant for the dynamic composite comparator type we'll need
+     */
+    public static final String DYNAMIC_COMPOSITE_TYPE = DynamicCompositeType.class.getSimpleName()
+ "(a=>AsciiType,b=>BytesType,i=>IntegerType,x=>LexicalUUIDType,l=>LongType,"
+
+                        "t=>TimeUUIDType,s=>UTF8Type,u=>UUIDType,A=>AsciiType(reversed=true),B=>BytesType(reversed=true),"
+
+                        "I=>IntegerType(reversed=true),X=>LexicalUUIDType(reversed=true),L=>LongType(reversed=true),"
+
+                        "T=>TimeUUIDType(reversed=true),S=>UTF8Type(reversed=true),U=>UUIDType(reversed=true))";
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b787221f/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/EntityVersionSerializer.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/EntityVersionSerializer.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/EntityVersionSerializer.java
index ae075f3..c03448f 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/EntityVersionSerializer.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/EntityVersionSerializer.java
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
 /**
  * Serialize EntityVersion, entity ID and version, for use a column name in Unique Values
Column Family. 
  */
-class EntityVersionSerializer extends AbstractSerializer<EntityVersion> {
+public class EntityVersionSerializer extends AbstractSerializer<EntityVersion> {
 
     private static final Logger LOG = LoggerFactory.getLogger( EntityVersionSerializer.class
);
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b787221f/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/UniqueValueSerializationStrategyImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/UniqueValueSerializationStrategyImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/UniqueValueSerializationStrategyImpl.java
index 8c2e9eb..9964a30 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/UniqueValueSerializationStrategyImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/UniqueValueSerializationStrategyImpl.java
@@ -27,10 +27,13 @@ import com.netflix.astyanax.connectionpool.exceptions.NotFoundException;
 import com.netflix.astyanax.model.ColumnList;
 import java.util.Collections;
 import org.apache.cassandra.db.marshal.BytesType;
+import org.apache.cassandra.db.marshal.DynamicCompositeType;
+
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.astyanax.MultiTennantColumnFamily;
 import org.apache.usergrid.persistence.collection.astyanax.MultiTennantColumnFamilyDefinition;
 import org.apache.usergrid.persistence.collection.astyanax.ScopedRowKey;
+import org.apache.usergrid.persistence.collection.cassandra.ColumnTypes;
 import org.apache.usergrid.persistence.collection.migration.Migration;
 import org.apache.usergrid.persistence.collection.serialization.impl.CollectionScopedRowKeySerializer;
 import org.apache.usergrid.persistence.model.field.Field;
@@ -69,8 +72,7 @@ public class UniqueValueSerializationStrategyImpl implements UniqueValueSerializ
     public java.util.Collection getColumnFamilies() {
 
         MultiTennantColumnFamilyDefinition cf = new MultiTennantColumnFamilyDefinition( 
-                CF_UNIQUE_VALUES,
-                BytesType.class.getSimpleName(), 
+                CF_UNIQUE_VALUES, ColumnTypes.DYNAMIC_COMPOSITE_TYPE,
                 BytesType.class.getSimpleName(),
                 BytesType.class.getSimpleName() );
 
@@ -143,6 +145,8 @@ public class UniqueValueSerializationStrategyImpl implements UniqueValueSerializ
 
         Preconditions.checkNotNull( field, "field is required" );
 
+
+        //TODO Dave, this doesn't limit the size.  We should limit it to 1 explicitly, otherwise
you can get a huge result set explosion if multiple values are attempting to write the same
unique value.
         ColumnList<EntityVersion> result;
         try {
             result = keyspace.prepareQuery( CF_UNIQUE_VALUES )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/b787221f/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
index 818a01d..ad65820 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
@@ -51,7 +51,7 @@ public class WriteUniqueVerify
 
     private final UniqueValueSerializationStrategy uniqueValueStrat;
 
-    //TODO Dave, we don't want to use our own thread pool.  Use the Concurrent class to create
new observables
+    //TODO Dave: we don't want to use our own thread pool.  Use the Concurrent class to create
new observables
     private final ExecutorService threadPool;
 
     private final int MAX_THREAD_COUNT;
@@ -84,7 +84,7 @@ public class WriteUniqueVerify
 
         // use simple thread pool to verify fields in parallel
 
-        //TODO We don't want to use custom thread pools and futures here.
+        //TODO Dave: We don't want to use custom thread pools and futures here.
         // We want to use concurrent to fork all validations this way they're wrapped by
timeouts and
         // Hystrix thread pools for JMX operations.  See the WriteCommand in the EntityCollectionManagerImpl
         // I think it still needs added to the Concurrent utility class


Mime
View raw message