usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Make the unique value loading use the config interface for consistent read CL instead of hard coding to CL_ALL
Date Wed, 06 Jul 2016 22:14:31 GMT
Repository: usergrid
Updated Branches:
  refs/heads/release-2.1.1 8982ddd3a -> bd96b1811


Make the unique value loading use the config interface for consistent read CL instead of hard
coding to CL_ALL


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

Branch: refs/heads/release-2.1.1
Commit: bd96b18116e16fc35f2bc1d740cff65b03470594
Parents: 8982ddd
Author: Michael Russo <mrusso@apigee.com>
Authored: Wed Jul 6 15:14:30 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Wed Jul 6 15:14:30 2016 -0700

----------------------------------------------------------------------
 .../impl/EntityCollectionManagerFactoryImpl.java         |  9 +++++++--
 .../collection/impl/EntityCollectionManagerImpl.java     | 11 ++++++++---
 .../collection/mvcc/stage/write/WriteUniqueVerify.java   |  4 ++--
 3 files changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/bd96b181/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
index a52ee9c..01eab7d 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerFactoryImpl.java
@@ -40,6 +40,7 @@ import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerial
 import org.apache.usergrid.persistence.collection.serialization.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.rx.RxTaskScheduler;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
@@ -77,6 +78,7 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
     private final Keyspace keyspace;
     private final MetricsFactory metricsFactory;
     private final RxTaskScheduler rxTaskScheduler;
+    private final CassandraConfig cassandraConfig;
 
     private LoadingCache<ApplicationScope, EntityCollectionManager> ecmCache =
         CacheBuilder.newBuilder().maximumSize( 1000 )
@@ -89,7 +91,7 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
                                 entitySerializationStrategy, uniqueValueSerializationStrategy,
                                 mvccLogEntrySerializationStrategy, keyspace,
                                 metricsFactory, serializationFig,
-                                rxTaskScheduler, scope );
+                                rxTaskScheduler, scope, cassandraConfig );
 
                             return target;
                         }
@@ -107,7 +109,9 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
                                                final UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
                                                final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy,
                                                final Keyspace keyspace, final EntityCacheFig
entityCacheFig,
-                                               final MetricsFactory metricsFactory, @CollectionExecutorScheduler
 final RxTaskScheduler rxTaskScheduler ) {
+                                               final MetricsFactory metricsFactory,
+                                               @CollectionExecutorScheduler  final RxTaskScheduler
rxTaskScheduler,
+                                               final CassandraConfig cassandraConfig) {
 
         this.writeStart = writeStart;
         this.writeVerifyUnique = writeVerifyUnique;
@@ -125,6 +129,7 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
         this.keyspace = keyspace;
         this.metricsFactory = metricsFactory;
         this.rxTaskScheduler = rxTaskScheduler;
+        this.cassandraConfig = cassandraConfig;
     }
     @Override
     public EntityCollectionManager createCollectionManager(ApplicationScope applicationScope)
{

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bd96b181/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
index 9261b56..06b086c 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
@@ -28,6 +28,7 @@ import java.util.UUID;
 
 import com.netflix.astyanax.model.ConsistencyLevel;
 import org.apache.usergrid.persistence.collection.serialization.impl.LogEntryIterator;
+import org.apache.usergrid.persistence.core.astyanax.CassandraConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -110,6 +111,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
     private final UniqueValueSerializationStrategy uniqueValueSerializationStrategy;
 
     private final SerializationFig serializationFig;
+    private final CassandraConfig cassandraConfig;
 
 
     private final Keyspace keyspace;
@@ -135,7 +137,8 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                                         final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy,
                                         final Keyspace keyspace, final MetricsFactory metricsFactory,
                                         final SerializationFig serializationFig, final RxTaskScheduler
rxTaskScheduler,
-                                        @Assisted final ApplicationScope applicationScope
) {
+                                        @Assisted final ApplicationScope applicationScope,
+                                        final CassandraConfig cassandraConfig) {
         this.uniqueValueSerializationStrategy = uniqueValueSerializationStrategy;
         this.entitySerializationStrategy = entitySerializationStrategy;
         this.uniqueCleanup = uniqueCleanup;
@@ -166,6 +169,8 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
         this.fieldEntityTimer = metricsFactory.getTimer(EntityCollectionManagerImpl.class,
"base.fieldEntity");
         this.loadTimer = metricsFactory.getTimer(EntityCollectionManagerImpl.class, "base.load");
         this.getLatestTimer = metricsFactory.getTimer(EntityCollectionManagerImpl.class,
"base.latest");
+
+        this.cassandraConfig = cassandraConfig;
     }
 
 
@@ -333,10 +338,10 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                 final UUID startTime = UUIDGenerator.newTimeUUID();
 
                 //Get back set of unique values that correspond to collection of fields
-                //Purposely use CL ALL as consistency is extremely important here, regardless
of performance
+                //Purposely use string consistency as it's extremely important here, regardless
of performance
                 UniqueValueSet set =
                     uniqueValueSerializationStrategy
-                        .load( applicationScope, ConsistencyLevel.CL_ALL, type, fields1 ,
uniqueIndexRepair);
+                        .load( applicationScope, cassandraConfig.getConsistentReadCL(), type,
fields1 , uniqueIndexRepair);
 
                 //Short circuit if we don't have any uniqueValues from the given fields.
                 if ( !set.iterator().hasNext() ) {

http://git-wip-us.apache.org/repos/asf/usergrid/blob/bd96b181/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 01e6621..b36cb79 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
@@ -123,8 +123,8 @@ public class WriteUniqueVerify implements Action1<CollectionIoEvent<MvccEntity>>
 
                 // loading will retrieve the oldest unique value entry for the field
                 // don't use read repair on this pre-write check
-                // use CL ALL as consistency is extremely important here, more so than performance
-                UniqueValueSet set = uniqueValueStrat.load(scope, ConsistencyLevel.CL_ALL,
+                // stronger consistency is extremely important here, more so than performance
+                UniqueValueSet set = uniqueValueStrat.load(scope, cassandraFig.getConsistentReadCL(),
                     written.getEntityId().getType(), Collections.singletonList(written.getField()),
false);
 
 


Mime
View raw message