You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/03/17 00:35:53 UTC

[10/12] incubator-usergrid git commit: [USERGRID-396] Added a timer to track how long repairing the entities takes. Fixed params in entity manager. Removed getEntityByAlias as it was just a filler method and is no longer used. Removed some useless commen

[USERGRID-396] Added a timer to track how long repairing the entities takes.
Fixed params in entity manager.
Removed getEntityByAlias as it was just a filler method and is no longer used.
Removed some useless comments in abstract collection service.


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

Branch: refs/heads/USERGRID-466
Commit: 24a48a756dbd56094a6c75cab8befc169b730776
Parents: c45a3ed
Author: GERey <gr...@apigee.com>
Authored: Fri Mar 13 11:07:06 2015 -0700
Committer: GERey <gr...@apigee.com>
Committed: Fri Mar 13 11:07:06 2015 -0700

----------------------------------------------------------------------
 .../usergrid/corepersistence/CpEntityManager.java  | 17 +++++------------
 .../apache/usergrid/persistence/EntityManager.java | 15 ++++-----------
 .../persistence/cassandra/EntityManagerImpl.java   |  7 -------
 .../services/AbstractCollectionService.java        |  4 ----
 4 files changed, 9 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a48a75/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 0f4fdc9..a108f25 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -207,6 +207,7 @@ public class CpEntityManager implements EntityManager {
     private Timer entGetEntityCountersTimer;
     private Timer esIndexEntityCollectionTimer;
     private Timer entRevokeRolePermissionsTimer;
+    private Timer entGetRepairedEntityTimer;
 
     //    /** Short-term cache to keep us from reloading same Entity during single request. */
 //    private LoadingCache<EntityScope, org.apache.usergrid.persistence.model.entity.Entity> entityCache;
@@ -267,6 +268,8 @@ public class CpEntityManager implements EntityManager {
             .getTimer( CpEntityManager.class, "cp.entity.es.index.entity.to.collection.timer" );
         this.entRevokeRolePermissionsTimer =
             this.metricsFactory.getTimer( CpEntityManager.class, "cp.entity.revoke.role.permissions.timer");
+        this.entGetRepairedEntityTimer = this.metricsFactory
+            .getTimer( CpEntityManager.class, "get.repaired.entity.timer" );
 
         // set to false for now
         this.skipAggregateCounters = false;
@@ -814,6 +817,7 @@ public class CpEntityManager implements EntityManager {
 
         String propertyName = Schema.getDefaultSchema().aliasProperty( collName );
 
+        Timer.Context repairedEntityGet = entGetRepairedEntityTimer.time();
 
         final EntityCollectionManager ecm = managerCache.getEntityCollectionManager( collectionScope );
         //TODO: can't we just sub in the getEntityRepair method here so for every read of a uniqueEntityField we can verify it is correct?
@@ -824,6 +828,7 @@ public class CpEntityManager implements EntityManager {
 
         FieldSet fieldSet = fieldSetObservable.toBlocking().last();
 
+        repairedEntityGet.stop();
         if(fieldSet.isEmpty()) {
             return null;
         }
@@ -832,18 +837,6 @@ public class CpEntityManager implements EntityManager {
     }
 
     @Override
-    public Entity getEntityByAlias(String collectionType, String aliasType) throws Exception {
-        EntityRef newEntityRef = getAlias(collectionType,aliasType);
-
-        if(newEntityRef == null) {
-            return null;
-        }
-
-        return get( newEntityRef );
-    }
-
-
-    @Override
     public EntityRef getAlias( String aliasType, String alias ) throws Exception {
 
         return getAlias( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ), aliasType, alias );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a48a75/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
index eb6379b..5657d4f 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/EntityManager.java
@@ -17,9 +17,6 @@
 package org.apache.usergrid.persistence;
 
 
-import org.apache.usergrid.persistence.collection.CollectionScope;
-import org.apache.usergrid.persistence.collection.FieldSet;
-import org.apache.usergrid.persistence.collection.MvccEntity;
 import org.apache.usergrid.persistence.index.query.Query;
 import java.nio.ByteBuffer;
 import java.util.Collection;
@@ -28,7 +25,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import me.prettyprint.hector.api.mutation.Mutator;
-import rx.Observable;
 
 import org.apache.usergrid.persistence.cassandra.CassandraService;
 import org.apache.usergrid.persistence.cassandra.GeoIndexManager;
@@ -38,7 +34,6 @@ import org.apache.usergrid.persistence.entities.Role;
 import org.apache.usergrid.persistence.index.query.CounterResolution;
 import org.apache.usergrid.persistence.index.query.Identifier;
 import org.apache.usergrid.persistence.index.query.Query.Level;
-import org.apache.usergrid.persistence.model.field.Field;
 
 
 /**
@@ -99,14 +94,12 @@ public interface EntityManager {
 
     public void createApplicationCollection( String entityType ) throws Exception;
 
-    Entity getEntityByAlias( String collectionType, String aliasType ) throws Exception;
-
     public EntityRef getAlias( String aliasType, String alias ) throws Exception;
 
     /**
      * Get the entity ref from the value
      *
-     * @param ownerId The owner Id of the collection
+     * @param ownerRef The owner Id of the collection
      * @param collectionName The name of the collection
      * @param aliasValue The value of the alias
      */
@@ -118,7 +111,7 @@ public interface EntityManager {
     /**
      * Get aliases from the index with the given value
      *
-     * @param ownerId The id of the collection owner
+     * @param ownerRef The id of the collection owner
      * @param collectionName The name of the collection
      * @param aliases The alias property
      */
@@ -454,7 +447,7 @@ public interface EntityManager {
      * Gets the entities of the specified type connected to the specified entity, optionally
      * matching the specified connection types and/or entity types. Returns a list of entity ids.
      *
-     * @param entityId an entity reference
+     * @param entityRef an entity reference
      * @param connectionType type of connection or null.
      * @param connectedEntityType type of entity or null.
      *
@@ -471,7 +464,7 @@ public interface EntityManager {
      * <p/>
      * e.g. "get users who have favorited this place"
      *
-     * @param entityId an entity reference
+     * @param entityRef an entity reference
      * @param connectionType type of connection or null.
      * @param connectedEntityType type of entity or null.
      *

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a48a75/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
index a019e86..3993285 100644
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
@@ -1771,13 +1771,6 @@ public class EntityManagerImpl implements EntityManager {
         batchExecute( m, CassandraService.RETRY_COUNT );
     }
 
-
-    @Override
-    public Entity getEntityByAlias( final String collectionType, final String aliasType ) throws Exception {
-        throw new UnsupportedOperationException("Not supported.");
-    }
-
-
     @Override
     public EntityRef getAlias( String aliasType, String alias ) throws Exception {
         return getAlias( new SimpleEntityRef(Application.ENTITY_TYPE, applicationId), aliasType, alias );

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/24a48a75/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java b/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
index 0820737..e404321 100644
--- a/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
+++ b/stack/services/src/main/java/org/apache/usergrid/services/AbstractCollectionService.java
@@ -46,13 +46,9 @@ public class AbstractCollectionService extends AbstractService {
 
 
     public AbstractCollectionService() {
-        // addSet("indexes");
         declareMetadataType( "indexes" );
     }
 
-    // cname/id/
-
-
     @Override
     public Entity getEntity( ServiceRequest request, UUID uuid ) throws Exception {
         if ( !isRootService() ) {