usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [37/50] [abbrv] incubator-usergrid git commit: Second pass at fixing the merge
Date Thu, 19 Mar 2015 23:26:54 GMT
Second pass at fixing the merge


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

Branch: refs/heads/USERGRID-480
Commit: 762e43e1ee9dfda1a07b9ba6ea7cd13cede06afc
Parents: 7b5d222
Author: Todd Nine <tnine@apigee.com>
Authored: Tue Mar 17 17:26:25 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Tue Mar 17 17:26:25 2015 -0600

----------------------------------------------------------------------
 .../usergrid/corepersistence/CoreModule.java    | 37 +++++------
 .../corepersistence/CpEntityManagerFactory.java | 21 +++----
 .../events/EntityVersionDeletedHandler.java     |  8 +--
 .../collection/EntityCollectionManager.java     |  6 --
 .../EntityCollectionManagerFactoryImpl.java     | 22 ++++---
 .../impl/EntityCollectionManagerImpl.java       | 65 ++++++++------------
 .../impl/EntityVersionCleanupTask.java          |  9 +--
 .../MvccEntitySerializationStrategyV1Impl.java  |  2 +-
 .../MvccEntitySerializationStrategyV3Impl.java  |  1 -
 .../migration/MvccEntityDataMigrationImpl.java  |  8 +--
 .../collection/EntityCollectionManagerIT.java   |  2 +-
 .../impl/EntityVersionCleanupTaskTest.java      | 13 ++--
 ...ntitySerializationStrategyProxyV1_3Test.java |  3 +
 ...ntitySerializationStrategyProxyV2_3Test.java |  3 +
 ...ccEntitySerializationStrategyV1ImplTest.java |  2 +
 .../impl/GraphManagerFactoryImpl.java           | 17 ++---
 16 files changed, 104 insertions(+), 115 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
index 5da7067..2e9b780 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CoreModule.java
@@ -15,30 +15,37 @@
  */
 package org.apache.usergrid.corepersistence;
 
-import com.google.inject.AbstractModule;
-import com.google.inject.Provider;
-import com.google.inject.multibindings.Multibinder;
 
-import org.apache.usergrid.corepersistence.migration.EntityDataMigration;
-import org.apache.usergrid.corepersistence.migration.EntityTypeMappingMigration;
-import org.apache.usergrid.corepersistence.migration.GraphShardVersionMigration;
+import org.springframework.context.ApplicationContext;
+
 import org.apache.usergrid.corepersistence.events.EntityDeletedHandler;
 import org.apache.usergrid.corepersistence.events.EntityVersionCreatedHandler;
 import org.apache.usergrid.corepersistence.events.EntityVersionDeletedHandler;
+import org.apache.usergrid.corepersistence.migration.CoreMigration;
+import org.apache.usergrid.corepersistence.migration.CoreMigrationPlugin;
+import org.apache.usergrid.corepersistence.migration.EntityTypeMappingMigration;
+import org.apache.usergrid.corepersistence.migration.MigrationModuleVersionPlugin;
+import org.apache.usergrid.corepersistence.rx.impl.AllApplicationsObservableImpl;
+import org.apache.usergrid.corepersistence.rx.impl.AllEntitiesInSystemImpl;
+import org.apache.usergrid.corepersistence.rx.impl.AllNodesInGraphImpl;
 import org.apache.usergrid.persistence.EntityManagerFactory;
 import org.apache.usergrid.persistence.collection.event.EntityDeleted;
 import org.apache.usergrid.persistence.collection.event.EntityVersionCreated;
 import org.apache.usergrid.persistence.collection.event.EntityVersionDeleted;
 import org.apache.usergrid.persistence.collection.guice.CollectionModule;
+import org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
 import org.apache.usergrid.persistence.core.guice.CommonModule;
 import org.apache.usergrid.persistence.core.migration.data.DataMigration;
+import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
+import org.apache.usergrid.persistence.core.migration.data.MigrationPlugin;
 import org.apache.usergrid.persistence.graph.guice.GraphModule;
+import org.apache.usergrid.persistence.graph.serialization.impl.migration.GraphNode;
 import org.apache.usergrid.persistence.index.guice.IndexModule;
-import org.apache.usergrid.persistence.map.guice.MapModule;
-import org.apache.usergrid.persistence.queue.guice.QueueModule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provider;
+import com.google.inject.TypeLiteral;
+import com.google.inject.multibindings.Multibinder;
 
 
 /**
@@ -74,7 +81,7 @@ public class CoreModule  extends AbstractModule {
             @Override
            public void configureMigrationProvider() {
 
-                bind(new TypeLiteral< MigrationDataProvider<EntityIdScope>>(){}).to(
+                bind(new TypeLiteral<MigrationDataProvider<EntityIdScope>>(){}).to(
                     AllEntitiesInSystemImpl.class );
            }
         } );
@@ -95,12 +102,6 @@ public class CoreModule  extends AbstractModule {
 
         bind(ManagerCache.class).to( CpManagerCache.class );
 
-        Multibinder<DataMigration> dataMigrationMultibinder =
-                Multibinder.newSetBinder( binder(), DataMigration.class );
-        dataMigrationMultibinder.addBinding().to( EntityTypeMappingMigration.class );
-        dataMigrationMultibinder.addBinding().to( GraphShardVersionMigration.class );
-        dataMigrationMultibinder.addBinding().to( EntityDataMigration.class );
-
         Multibinder<EntityDeleted> entityBinder =
             Multibinder.newSetBinder(binder(), EntityDeleted.class);
         entityBinder.addBinding().to(EntityDeletedHandler.class);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
index 01dfa1f..f76b9fc 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManagerFactory.java
@@ -15,15 +15,14 @@
  */
 package org.apache.usergrid.corepersistence;
 
-import com.google.common.base.Optional;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import static java.lang.String.CASE_INSENSITIVE_ORDER;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.slf4j.Logger;
@@ -48,9 +47,8 @@ import org.apache.usergrid.persistence.cassandra.Setup;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.impl.CollectionScopeImpl;
-import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.collection.serialization.impl.migration.EntityIdScope;
-import org.apache.usergrid.persistence.core.migration.data.DataMigrationManager;
+import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.migration.data.MigrationDataProvider;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.core.scope.ApplicationScopeImpl;
@@ -59,7 +57,6 @@ import org.apache.usergrid.persistence.entities.Application;
 import org.apache.usergrid.persistence.exceptions.ApplicationAlreadyExistsException;
 import org.apache.usergrid.persistence.exceptions.DuplicateUniquePropertyExistsException;
 import org.apache.usergrid.persistence.exceptions.EntityNotFoundException;
-import org.apache.usergrid.persistence.exceptions.OrganizationAlreadyExistsException;
 import org.apache.usergrid.persistence.graph.Edge;
 import org.apache.usergrid.persistence.graph.GraphManager;
 import org.apache.usergrid.persistence.graph.SearchByEdgeType;
@@ -71,13 +68,13 @@ import org.apache.usergrid.persistence.model.entity.SimpleId;
 import org.apache.usergrid.persistence.model.util.UUIDGenerator;
 import org.apache.usergrid.utils.UUIDUtils;
 
+import com.google.common.base.Optional;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.inject.Injector;
 import com.google.inject.Key;
 import com.google.inject.TypeLiteral;
-import com.yammer.metrics.annotation.Metered;
 
 import rx.Observable;
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
index 95ff9dc..c45949b 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/events/EntityVersionDeletedHandler.java
@@ -85,7 +85,7 @@ public class EntityVersionDeletedHandler implements EntityVersionDeleted
{
 
         CpEntityManagerFactory cpemf = (CpEntityManagerFactory)emf;
 
-        final EntityIndex ei = cpemf.getManagerCache().getEntityIndex(scope);
+        final EntityIndex ei = cpemf.getManagerCache().getEntityIndex( scope );
 
         final IndexScope indexScope = new IndexScopeImpl(
                 new SimpleId(scope.getOwner().getUuid(), scope.getOwner().getType()),
@@ -93,10 +93,10 @@ public class EntityVersionDeletedHandler implements EntityVersionDeleted
{
         );
 
         Observable.from( entityVersions )
-            .collect( ei.createBatch(), new Action2<EntityIndexBatch, MvccEntity>()
{
+            .collect( ei.createBatch(), new Action2<EntityIndexBatch, MvccLogEntry>()
{
                 @Override
-                public void call( final EntityIndexBatch entityIndexBatch, final MvccEntity
mvccEntity ) {
-                    entityIndexBatch.deindex( indexScope, mvccEntity.getId(), mvccEntity.getVersion()
);
+                public void call( final EntityIndexBatch entityIndexBatch, final MvccLogEntry
mvccLogEntry ) {
+                    entityIndexBatch.deindex( indexScope, mvccLogEntry.getEntityId(), mvccLogEntry.getVersion()
);
                 }
             } ).doOnNext( new Action1<EntityIndexBatch>() {
             @Override

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
index 35fc5d4..6532ee6 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/EntityCollectionManager.java
@@ -75,12 +75,6 @@ public interface EntityCollectionManager {
      */
     public Observable<EntitySet> load(Collection<Id> entityIds);
 
-    /**
-     * Takes the change and reloads an entity with all changes applied in this entity applied.
-     * The resulting entity from calling load will be the previous version of this entity
plus
-     * the entity in this object applied to it.
-     */
-    public Observable<Entity> update ( Entity entity );
 
     /**
      * Returns health of entity data store.

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/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 ac82181..409467c 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
@@ -26,18 +26,23 @@ import java.util.concurrent.ExecutionException;
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
 import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory;
-import org.apache.usergrid.persistence.collection.EntityCollectionManagerSync;
-import org.apache.usergrid.persistence.collection.EntityDeletedFactory;
-import org.apache.usergrid.persistence.collection.EntityVersionCleanupFactory;
-import org.apache.usergrid.persistence.collection.EntityVersionCreatedFactory;
 import org.apache.usergrid.persistence.collection.cache.CachedEntityCollectionManager;
 import org.apache.usergrid.persistence.collection.cache.EntityCacheFig;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.guice.CollectionTaskExecutor;
+import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
+import org.apache.usergrid.persistence.collection.mvcc.stage.delete.MarkCommit;
+import org.apache.usergrid.persistence.collection.mvcc.stage.delete.MarkStart;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.RollbackAction;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteCommit;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteOptimisticVerify;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteStart;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteUniqueVerify;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
+import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
+import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
+import org.apache.usergrid.persistence.core.task.TaskExecutor;
 
 import com.google.common.base.Preconditions;
 import com.google.common.cache.CacheBuilder;
@@ -45,6 +50,7 @@ import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
+import com.google.inject.assistedinject.Assisted;
 import com.netflix.astyanax.Keyspace;
 
 
@@ -72,25 +78,21 @@ public class EntityCollectionManagerFactoryImpl implements EntityCollectionManag
     private final EntityCacheFig entityCacheFig;
     private final MetricsFactory metricsFactory;
 
-    private EntityCacheFig entityCacheFig;
-    private SerializationFig serializationFig;
     private LoadingCache<CollectionScope, EntityCollectionManager> ecmCache =
         CacheBuilder.newBuilder().maximumSize( 1000 )
                     .build( new CacheLoader<CollectionScope, EntityCollectionManager>()
{
                         public EntityCollectionManager load( CollectionScope scope ) {
-
                                   //create the target EM that will perform logic
                             final EntityCollectionManager target = new EntityCollectionManagerImpl(
                                 writeStart, writeVerifyUnique,
                                 writeOptimisticVerify, writeCommit, rollback, markStart,
markCommit,
                                 entitySerializationStrategy, uniqueValueSerializationStrategy,
-                                mvccLogEntrySerializationStrategy, keyspace, serializationFig,entityVersionTaskFactory,
taskExecutor, scope, metricsFactory );
+                                mvccLogEntrySerializationStrategy, keyspace,entityVersionTaskFactory,
taskExecutor, scope, metricsFactory );
 
 
                             final EntityCollectionManager proxy = new CachedEntityCollectionManager(entityCacheFig,
target  );
 
                             return proxy;
-//                            return target;
                         }
                     } );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/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 001e0db..f565fab 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
@@ -19,28 +19,22 @@
 package org.apache.usergrid.persistence.collection.impl;
 
 
-import java.util.*;
-
-import com.netflix.astyanax.MutationBatch;
-import org.apache.usergrid.persistence.collection.*;
-import org.apache.usergrid.persistence.collection.serialization.impl.MutableFieldSet;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
 import org.apache.usergrid.persistence.collection.EntityCollectionManager;
-import org.apache.usergrid.persistence.collection.EntityDeletedFactory;
 import org.apache.usergrid.persistence.collection.EntitySet;
-import org.apache.usergrid.persistence.collection.EntityVersionCleanupFactory;
-import org.apache.usergrid.persistence.collection.EntityVersionCreatedFactory;
+import org.apache.usergrid.persistence.collection.FieldSet;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.VersionSet;
 import org.apache.usergrid.persistence.collection.guice.CollectionTaskExecutor;
-import org.apache.usergrid.persistence.collection.guice.CollectionTaskExecutor;
-import org.apache.usergrid.persistence.collection.guice.Write;
-import org.apache.usergrid.persistence.collection.guice.WriteUpdate;
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.MvccLogEntrySerializationStrategy;
 import org.apache.usergrid.persistence.collection.mvcc.entity.MvccValidationUtils;
 import org.apache.usergrid.persistence.collection.mvcc.stage.CollectionIoEvent;
@@ -52,13 +46,11 @@ import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteOptimist
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteStart;
 import org.apache.usergrid.persistence.collection.mvcc.stage.write.WriteUniqueVerify;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
-import org.apache.usergrid.persistence.collection.serialization.SerializationFig;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
+import org.apache.usergrid.persistence.collection.serialization.impl.MutableFieldSet;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;
-import org.apache.usergrid.persistence.core.task.Task;
-import org.apache.usergrid.persistence.core.task.TaskExecutor;
 import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.task.Task;
 import org.apache.usergrid.persistence.core.task.TaskExecutor;
@@ -75,17 +67,12 @@ import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
 import com.netflix.astyanax.Keyspace;
+import com.netflix.astyanax.MutationBatch;
 import com.netflix.astyanax.connectionpool.OperationResult;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 import com.netflix.astyanax.model.ColumnFamily;
 import com.netflix.astyanax.model.CqlResult;
 import com.netflix.astyanax.serializers.StringSerializer;
-import org.apache.usergrid.persistence.collection.EntityDeletedFactory;
-import org.apache.usergrid.persistence.collection.EntityVersionCleanupFactory;
-import org.apache.usergrid.persistence.collection.EntityVersionCreatedFactory;
-import org.apache.usergrid.persistence.collection.guice.CollectionTaskExecutor;
-import org.apache.usergrid.persistence.core.task.Task;
-import org.apache.usergrid.persistence.core.task.TaskExecutor;
 
 import rx.Notification;
 import rx.Observable;
@@ -224,19 +211,19 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                     entity.getVersion(), false ));
                 //post-processing to come later. leave it empty for now.
             }
-        }).doOnError(rollback)
-            .doOnEach(new Action1<Notification<? super Entity>>() {
+        }).doOnError( rollback )
+            .doOnEach( new Action1<Notification<? super Entity>>() {
                 @Override
-                public void call(Notification<? super Entity> notification) {
+                public void call( Notification<? super Entity> notification ) {
                     writeMeter.mark();
                 }
-            })
-            .doOnCompleted(new Action0() {
+            } )
+            .doOnCompleted( new Action0() {
                 @Override
                 public void call() {
                     timer.stop();
                 }
-            });
+            } );
     }
 
 
@@ -250,7 +237,7 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
         final Timer.Context timer = deleteTimer.time();
         Observable<Id> o = Observable.from(new CollectionIoEvent<Id>(collectionScope,
entityId))
             .map(markStart)
-            .doOnNext(markCommit)
+            .doOnNext( markCommit )
             .map(new Func1<CollectionIoEvent<MvccEntity>, Id>() {
 
                      @Override
@@ -269,12 +256,12 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                     deleteMeter.mark();
                 }
             })
-            .doOnCompleted(new Action0() {
+            .doOnCompleted( new Action0() {
                 @Override
                 public void call() {
                     timer.stop();
                 }
-            });
+            } );
 
         return o;
     }
@@ -300,18 +287,18 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                 return Observable.from(entity.getEntity().get());
             }
         })
-            .doOnNext(new Action1<Entity>() {
+            .doOnNext( new Action1<Entity>() {
                 @Override
-                public void call(Entity entity) {
+                public void call( Entity entity ) {
                     loadMeter.mark();
                 }
-            })
-            .doOnCompleted(new Action0() {
+            } )
+            .doOnCompleted( new Action0() {
                 @Override
                 public void call() {
                     timer.stop();
                 }
-            });
+            } );
     }
 
 
@@ -347,12 +334,12 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                     loadMeter.mark();
                 }
             })
-            .doOnCompleted(new Action0() {
+            .doOnCompleted( new Action0() {
                 @Override
                 public void call() {
                     timer.stop();
                 }
-            });
+            } );
     }
 
 
@@ -505,12 +492,12 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager
{
                 }
             }
         } )
-            .doOnCompleted(new Action0() {
+            .doOnCompleted( new Action0() {
                 @Override
                 public void call() {
                     timer.stop();
                 }
-            });
+            } );
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
index 27c3db8..55d135b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTask.java
@@ -26,10 +26,12 @@ import java.util.UUID;
 import com.google.inject.Inject;
 import com.google.inject.assistedinject.Assisted;
 import org.apache.usergrid.persistence.collection.MvccEntity;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.impl.UniqueValueImpl;
 import org.apache.usergrid.persistence.collection.util.EntityUtils;
+import org.apache.usergrid.persistence.core.guice.ProxyImpl;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.field.Field;
 import org.slf4j.Logger;
@@ -86,7 +88,6 @@ public class EntityVersionCleanupTask implements Task<Void> {
     public EntityVersionCleanupTask(
         final SerializationFig serializationFig,
         final MvccLogEntrySerializationStrategy logEntrySerializationStrategy,
-        @ProxyImpl final MvccEntitySerializationStrategy   entitySerializationStrategy,
         final UniqueValueSerializationStrategy  uniqueValueSerializationStrategy,
         final Keyspace                          keyspace,
         final Set<EntityVersionDeleted>         listeners, // MUST be a set or Guice
will not inject
@@ -104,7 +105,7 @@ public class EntityVersionCleanupTask implements Task<Void> {
         this.entityId = entityId;
         this.version = version;
 
-        includeVersion = includeVersion;
+        this.includeVersion = includeVersion;
     }
 
 
@@ -146,7 +147,7 @@ public class EntityVersionCleanupTask implements Task<Void> {
                         .skipWhile( new Func1<UniqueValue, Boolean>() {
                             @Override
                             public Boolean call( final UniqueValue uniqueValue ) {
-                                return version.equals( uniqueValue.getEntityVersion() );
+                                return !includeVersion && version.equals( uniqueValue.getEntityVersion()
);
                             }
                         } )
                                 //buffer our buffer size, then roll them all up in a single
batch mutation
@@ -185,7 +186,7 @@ public class EntityVersionCleanupTask implements Task<Void> {
                         .skipWhile( new Func1<MvccLogEntry, Boolean>() {
                             @Override
                             public Boolean call( final MvccLogEntry mvccLogEntry ) {
-                                return version.equals( mvccLogEntry.getVersion() );
+                                return !includeVersion && version.equals( mvccLogEntry.getVersion()
);
                             }
                         } )
                                 //buffer them for efficiency

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
index 6f8525c..40054ec 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1Impl.java
@@ -194,7 +194,7 @@ public class MvccEntitySerializationStrategyV1Impl extends MvccEntitySerializati
             // it's been deleted, remove it
 
             if ( Arrays.equals( STATE_DELETED, state ) ) {
-                return new EntityWrapper( MvccEntity.Status.COMPLETE, Optional.<Entity>absent()
);
+                return new EntityWrapper( MvccEntity.Status.DELETED, Optional.<Entity>absent()
);
             }
 
             Entity storedEntity;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
index 6ad18bb..ace076b 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV3Impl.java
@@ -310,7 +310,6 @@ public class MvccEntitySerializationStrategyV3Impl implements MvccEntitySerializ
         Preconditions.checkNotNull( version, "version is required" );
 
 
-        TimeUUIDUtils.getMicrosTimeFromUUID(version);
         return doWrite( collectionScope, entityId, version, new RowOp() {
             @Override
             public void doOp( final ColumnListMutation<Boolean> colMutation ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
index beaaef9..bd4eafc 100644
--- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
+++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/serialization/impl/migration/MvccEntityDataMigrationImpl.java
@@ -30,9 +30,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.EntityVersionCleanupFactory;
 import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.collection.impl.EntityVersionCleanupTask;
+import org.apache.usergrid.persistence.collection.impl.EntityVersionTaskFactory;
 import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValue;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
@@ -75,7 +75,7 @@ public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope>
     private final Keyspace keyspace;
     private final VersionedMigrationSet<MvccEntitySerializationStrategy> allVersions;
     private final UniqueValueSerializationStrategy uniqueValueSerializationStrategy;
-    private final EntityVersionCleanupFactory entityVersionCleanupFactory;
+    private final EntityVersionTaskFactory entityVersionCleanupFactory;
     private final MvccEntitySerializationStrategyV3Impl mvccEntitySerializationStrategyV3;
 
 
@@ -84,7 +84,7 @@ public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope>
     public MvccEntityDataMigrationImpl( final Keyspace keyspace,
                                         final VersionedMigrationSet<MvccEntitySerializationStrategy>
allVersions,
                                         final UniqueValueSerializationStrategy uniqueValueSerializationStrategy,
-                                        final EntityVersionCleanupFactory entityVersionCleanupFactory,
+                                        final EntityVersionTaskFactory entityVersionCleanupFactory,
                                         final MvccEntitySerializationStrategyV3Impl mvccEntitySerializationStrategyV3
                                       ) {
 
@@ -227,7 +227,7 @@ public class MvccEntityDataMigrationImpl implements DataMigration<EntityIdScope>
                                             totalBatch.mergeShallow( mb );
                                         }
 
-                                        final EntityVersionCleanupTask task = entityVersionCleanupFactory.getTask(
message.scope, message.entity.getId(), version );
+                                        final EntityVersionCleanupTask task = entityVersionCleanupFactory.getCleanupTask(
message.scope, message.entity.getId(), version, false );
 
                                         entityVersionCleanupTasks.add( task );
                                     }

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
index c92bb74..f6d9782 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/EntityCollectionManagerIT.java
@@ -23,7 +23,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.UUID;
 
-import org.apache.usergrid.persistence.collection.mvcc.MvccEntitySerializationStrategy;
+import org.apache.usergrid.persistence.collection.serialization.MvccEntitySerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSerializationStrategy;
 import org.apache.usergrid.persistence.collection.serialization.UniqueValueSet;
 import org.apache.usergrid.persistence.core.guice.ProxyImpl;

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
index b4921a3..787ab30 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/impl/EntityVersionCleanupTaskTest.java
@@ -128,7 +128,7 @@ public class EntityVersionCleanupTaskTest {
 
         EntityVersionCleanupTask cleanupTask =
                 new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId,
-                        version );
+                        version, false );
 
         final MutationBatch newBatch = mock( MutationBatch.class );
 
@@ -209,8 +209,7 @@ public class EntityVersionCleanupTaskTest {
 
 
         EntityVersionCleanupTask cleanupTask =
-                new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId,
-                        version );
+                new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId, version, false );
 
         final MutationBatch newBatch = mock( MutationBatch.class );
 
@@ -290,7 +289,7 @@ public class EntityVersionCleanupTaskTest {
 
         EntityVersionCleanupTask cleanupTask =
                 new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId,
-                        version );
+                        version, false );
 
         final MutationBatch newBatch = mock( MutationBatch.class );
 
@@ -390,7 +389,7 @@ public class EntityVersionCleanupTaskTest {
 
         EntityVersionCleanupTask cleanupTask =
                 new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId,
-                        version );
+                        version, false );
 
         final MutationBatch newBatch = mock( MutationBatch.class );
 
@@ -517,7 +516,7 @@ public class EntityVersionCleanupTaskTest {
 
         EntityVersionCleanupTask cleanupTask =
                 new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId,
-                        version );
+                        version, false);
 
         final MutationBatch newBatch = mock( MutationBatch.class );
 
@@ -645,7 +644,7 @@ public class EntityVersionCleanupTaskTest {
 
         EntityVersionCleanupTask cleanupTask =
                 new EntityVersionCleanupTask( serializationFig, less, uvss, keyspace, listeners,
appScope, entityId,
-                        version );
+                        version, false );
 
         final MutationBatch newBatch = mock( MutationBatch.class );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
index 42b10c4..56abfd8 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV1_3Test.java
@@ -34,9 +34,12 @@ import org.apache.usergrid.persistence.core.test.UseModules;
 
 import com.google.inject.Inject;
 
+import net.jcip.annotations.NotThreadSafe;
+
 
 @RunWith( ITRunner.class )
 @UseModules( TestCollectionModule.class )
+@NotThreadSafe//anything that changes the system version state is not safe to be run concurrently
 public class MvccEntitySerializationStrategyProxyV1_3Test extends MvccEntitySerializationStrategyImplTest
{
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
index da496f7..b372fbf 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyProxyV2_3Test.java
@@ -34,9 +34,12 @@ import org.apache.usergrid.persistence.core.test.UseModules;
 
 import com.google.inject.Inject;
 
+import net.jcip.annotations.NotThreadSafe;
+
 
 @RunWith( ITRunner.class )
 @UseModules( TestCollectionModule.class )
+@NotThreadSafe//anything that changes the system version state is not safe to be run concurrently
 public class MvccEntitySerializationStrategyProxyV2_3Test extends MvccEntitySerializationStrategyV2Test
{
 
     @Inject

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
index 4e0c8cc..b0dba5d 100644
--- a/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
+++ b/stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/serialization/impl/MvccEntitySerializationStrategyV1ImplTest.java
@@ -49,6 +49,8 @@ import com.google.common.base.Optional;
 import com.google.inject.Inject;
 import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
 
+import net.jcip.annotations.NotThreadSafe;
+
 
 @RunWith( ITRunner.class )
 @UseModules( TestCollectionModule.class )

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/762e43e1/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/GraphManagerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/GraphManagerFactoryImpl.java
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/GraphManagerFactoryImpl.java
index 732f0bf..7c88c33 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/GraphManagerFactoryImpl.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/GraphManagerFactoryImpl.java
@@ -26,6 +26,8 @@ import com.google.common.cache.LoadingCache;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import com.google.inject.assistedinject.Assisted;
+
+import org.apache.usergrid.persistence.core.metrics.MetricsFactory;
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.GraphFig;
 import org.apache.usergrid.persistence.graph.GraphManager;
@@ -51,29 +53,28 @@ public class GraphManagerFactoryImpl implements GraphManagerFactory {
     private final GraphFig graphFig;
     private final EdgeDeleteListener edgeDeleteListener;
     private final NodeDeleteListener nodeDeleteListener;
+    private final MetricsFactory metricsFactory;
 
     private LoadingCache<ApplicationScope, GraphManager> gmCache =
         CacheBuilder.newBuilder().maximumSize( 1000 ).build( new CacheLoader<ApplicationScope,
GraphManager>() {
             public GraphManager load(
                 ApplicationScope scope ) {
-                return new GraphManagerImpl(edgeMetadataSerialization,edgeSerialization,nodeSerialization,graphFig,edgeDeleteListener,nodeDeleteListener,scope);
+                return new GraphManagerImpl(edgeMetadataSerialization,edgeSerialization,nodeSerialization,graphFig,edgeDeleteListener,nodeDeleteListener,scope,
metricsFactory);
             }
         } );
 
     @Inject
-    public GraphManagerFactoryImpl(final EdgeMetadataSerialization edgeMetadataSerialization,
-                                   final EdgeSerialization edgeSerialization,
-                                   final NodeSerialization nodeSerialization,
-                                   final GraphFig graphFig,
-                                   final EdgeDeleteListener edgeDeleteListener,
-                                   final NodeDeleteListener nodeDeleteListener
-    ){
+    public GraphManagerFactoryImpl( final EdgeMetadataSerialization edgeMetadataSerialization,
final
+    EdgeSerialization edgeSerialization,
+                                    final NodeSerialization nodeSerialization, final GraphFig
graphFig, final EdgeDeleteListener edgeDeleteListener,
+                                    final NodeDeleteListener nodeDeleteListener, final MetricsFactory
metricsFactory ){
         this.edgeMetadataSerialization = edgeMetadataSerialization;
         this.edgeSerialization = edgeSerialization;
         this.nodeSerialization = nodeSerialization;
         this.graphFig = graphFig;
         this.edgeDeleteListener = edgeDeleteListener;
         this.nodeDeleteListener = nodeDeleteListener;
+        this.metricsFactory = metricsFactory;
     }
 
     @Override


Mime
View raw message