You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/10/02 18:18:27 UTC

[1/4] git commit: Fix to prevent infinite recursion in IndexRebuild.

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o b644cc0aa -> 878d634ca


Fix to prevent infinite recursion in IndexRebuild.


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

Branch: refs/heads/two-dot-o
Commit: e939b05c5e21b25a95905dec84d54a955d00f756
Parents: b2b8886
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Oct 2 10:14:23 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Oct 2 10:14:23 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        | 26 ++++++++++++++------
 1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/e939b05c/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 38453e1..f7df6c0 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
@@ -33,6 +33,7 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Stack;
 import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.UUID;
@@ -2857,7 +2858,11 @@ public class CpEntityManager implements EntityManager {
      * Completely reindex the application associated with this EntityManager.
      */
     public void reindex( EntityManagerFactory.ProgressObserver po ) throws Exception {
-        indexEntityConnectionsAndCollections( getApplication(), po );
+
+        Stack stack = new Stack();
+        stack.push( getApplication() );
+
+        indexEntityConnectionsAndCollections( getApplication(), po, stack );
     }
 
 
@@ -2865,8 +2870,8 @@ public class CpEntityManager implements EntityManager {
      * Recursively index (or reindex) all of the collections and connections of a 
      * specified entity, and all of the collected and connected entities as well.
      */
-    private void indexEntityConnectionsAndCollections( 
-            final EntityRef entity, final EntityManagerFactory.ProgressObserver po ) {
+    private void indexEntityConnectionsAndCollections( final EntityRef entity, 
+            final EntityManagerFactory.ProgressObserver po, final Stack stack ) {
 
         final GraphManager gm = managerCache.getGraphManager(applicationScope);
 
@@ -2961,8 +2966,12 @@ public class CpEntityManager implements EntityManager {
                             po.onProgress( entity, ref, edge.getType());
 
                             // recursion
-                            indexEntityConnectionsAndCollections( new SimpleEntityRef(
-                                memberEntity.getId().getType(), memberEntity.getId().getUuid()),po);
+                            if ( !stack.contains( ref )) {
+                                stack.push( ref );
+                                indexEntityConnectionsAndCollections( ref, po, stack );
+                                stack.pop(); 
+                            }
+
 
                         } else if ( isConnectionEdgeType( edge.getType() )) {
 
@@ -2998,8 +3007,11 @@ public class CpEntityManager implements EntityManager {
                             po.onProgress( entity, ref, edge.getType());
 
                             // recursion
-                            indexEntityConnectionsAndCollections( new SimpleEntityRef(
-                                targetEntity.getId().getType(), targetEntity.getId().getUuid()),po);
+                            if ( !stack.contains( ref )) {
+                                stack.push( ref );
+                                indexEntityConnectionsAndCollections( ref, po, stack );
+                                stack.pop(); 
+                            }
                         }
                     }
 


[3/4] git commit: Additional debugging.

Posted by sn...@apache.org.
Additional debugging.


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

Branch: refs/heads/two-dot-o
Commit: 1073f11588a55f0718325ec66f23800546aeda8f
Parents: a6665f1
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Oct 2 12:17:52 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Oct 2 12:17:52 2014 -0400

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        | 88 +++++++++++++-------
 .../corepersistence/CpEntityManagerFactory.java |  2 -
 2 files changed, 59 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1073f115/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 8d3940d..f618a80 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
@@ -2846,20 +2846,20 @@ public class CpEntityManager implements EntityManager {
                             org.apache.usergrid.persistence.model.entity.Entity collEntity = 
                                 collMgr.load( edge.getSourceNode() ).toBlockingObservable().last();
 
-//                            if (collEntity == null) {
-//                                if (logger.isDebugEnabled()) {
-//                                    logger.error("FAILED to load entity {}:{} "
-//                                            + "from scope\n   app {}\n   owner {}\n   name {}",
-//                                            new Object[]{
-//                                                edge.getSourceNode().getType(), 
-//                                                edge.getSourceNode().getUuid(),
-//                                                collScope.getApplication(),
-//                                                collScope.getOwner(),
-//                                                collScope.getName()
-//                                            });
-//                                }
-//                                return;
-//                            }
+                            if (collEntity == null) {
+                                if (logger.isDebugEnabled()) {
+                                    logger.error("FAILED to load entity {}:{} "
+                                            + "from scope\n   app {}\n   owner {}\n   name {}",
+                                            new Object[]{
+                                                edge.getSourceNode().getType(), 
+                                                edge.getSourceNode().getUuid(),
+                                                collScope.getApplication(),
+                                                collScope.getOwner(),
+                                                collScope.getName()
+                                            });
+                                }
+                                return;
+                            }
 
                             CollectionScope memberScope = new CollectionScopeImpl(
                                 applicationScope.getApplication(),
@@ -2871,20 +2871,20 @@ public class CpEntityManager implements EntityManager {
                             org.apache.usergrid.persistence.model.entity.Entity memberEntity = 
                                 memberMgr.load( edge.getTargetNode()).toBlockingObservable().last();
 
-//                            if (memberEntity == null) {
-//                                if (logger.isDebugEnabled()) {
-//                                    logger.error("FAILED to load entity {}:{} "
-//                                            + "from scope\n   app {}\n   owner {}\n   name {}",
-//                                            new Object[]{
-//                                                edge.getTargetNode().getType(), 
-//                                                edge.getTargetNode().getUuid(),
-//                                                memberScope.getApplication(),
-//                                                memberScope.getOwner(),
-//                                                memberScope.getName()
-//                                            });
-//                                }
-//                                return;
-//                            }
+                            if (memberEntity == null) {
+                                if (logger.isDebugEnabled()) {
+                                    logger.error("FAILED to load entity {}:{} "
+                                            + "from scope\n   app {}\n   owner {}\n   name {}",
+                                            new Object[]{
+                                                edge.getTargetNode().getType(), 
+                                                edge.getTargetNode().getUuid(),
+                                                memberScope.getApplication(),
+                                                memberScope.getOwner(),
+                                                memberScope.getName()
+                                            });
+                                }
+                                return;
+                            }
 
                             indexEntityIntoCollections( collEntity, memberEntity, collName, true );
 
@@ -2914,7 +2914,22 @@ public class CpEntityManager implements EntityManager {
                                 managerCache.getEntityCollectionManager(sourceScope);
 
                             org.apache.usergrid.persistence.model.entity.Entity sourceEntity = 
-                                sourceEcm.load( fromEntityId ).toBlockingObservable().last();
+                                sourceEcm.load( edge.getSourceNode() ).toBlockingObservable().last();
+
+                            if (sourceEntity == null) {
+                                if (logger.isDebugEnabled()) {
+                                    logger.error("FAILED to load entity {}:{} "
+                                            + "from scope\n   app {}\n   owner {}\n   name {}",
+                                            new Object[]{
+                                                edge.getSourceNode().getType(), 
+                                                edge.getSourceNode().getUuid(),
+                                                sourceScope.getApplication(),
+                                                sourceScope.getOwner(),
+                                                sourceScope.getName()
+                                            });
+                                }
+                                return;
+                            }
 
                             CollectionScope targetScope = new CollectionScopeImpl(
                                 applicationScope.getApplication(),
@@ -2926,6 +2941,21 @@ public class CpEntityManager implements EntityManager {
                             org.apache.usergrid.persistence.model.entity.Entity targetEntity = 
                                 targetEcm.load( edge.getTargetNode() ).toBlockingObservable().last();
 
+                            if (targetEntity == null) {
+                                if (logger.isDebugEnabled()) {
+                                    logger.error("FAILED to load entity {}:{} "
+                                            + "from scope\n   app {}\n   owner {}\n   name {}",
+                                            new Object[]{
+                                                edge.getTargetNode().getType(), 
+                                                edge.getTargetNode().getUuid(),
+                                                targetScope.getApplication(),
+                                                targetScope.getOwner(),
+                                                targetScope.getName()
+                                            });
+                                }
+                                return;
+                            }
+
                             indexEntityIntoConnection( 
                                     sourceEntity, targetEntity, targetEntityType, connType );
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/1073f115/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 845d798..26f4234 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
@@ -52,8 +52,6 @@ import org.apache.usergrid.persistence.graph.GraphManagerFactory;
 import org.apache.usergrid.persistence.graph.SearchByEdgeType;
 import org.apache.usergrid.persistence.graph.impl.SimpleSearchByEdgeType;
 import org.apache.usergrid.persistence.index.EntityIndexFactory;
-import org.apache.usergrid.persistence.index.IndexScope;
-import org.apache.usergrid.persistence.index.impl.IndexScopeImpl;
 import org.apache.usergrid.persistence.index.query.Query;
 import org.apache.usergrid.persistence.model.entity.Id;
 import org.apache.usergrid.persistence.model.entity.SimpleId;


[2/4] git commit: Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o

Posted by sn...@apache.org.
Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: a6665f113d2955a5d4cdc5dd0d3eddccc8967b50
Parents: e939b05 38885fa
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Oct 2 10:14:35 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Oct 2 10:14:35 2014 -0400

----------------------------------------------------------------------
 .../CpEntityIndexDeleteListener.java            |  11 +-
 .../corepersistence/CpEntityManager.java        | 247 +++-----
 .../corepersistence/CpEntityManagerFactory.java |  29 +-
 .../corepersistence/CpManagerCache.java         |  12 +-
 .../usergrid/corepersistence/CpNamingUtils.java | 106 ++++
 .../corepersistence/CpRelationManager.java      | 229 +++----
 .../CpEntityIndexDeleteListenerTest.java        |  18 +-
 .../usergrid/persistence/CollectionIT.java      |   3 -
 .../PerformanceEntityRebuildIndexTest.java      |   7 +-
 .../collection/impl/CollectionScopeImpl.java    |   6 +-
 .../core/scope/ApplicationScopeImpl.java        |   6 +-
 .../serialization/EdgeSerializationTest.java    |   3 +
 .../usergrid/persistence/index/EntityIndex.java |  38 +-
 .../persistence/index/EntityIndexBatch.java     |  71 +++
 .../persistence/index/EntityIndexFactory.java   |   4 +-
 .../usergrid/persistence/index/IndexScope.java  |   2 +-
 .../index/impl/EsEntityIndexBatchImpl.java      | 396 ++++++++++++
 .../index/impl/EsEntityIndexImpl.java           | 628 ++++---------------
 .../persistence/index/impl/EsQueryVistor.java   |  35 +-
 .../persistence/index/impl/IndexScopeImpl.java  |   8 +-
 .../persistence/index/impl/IndexingUtils.java   | 107 ++++
 .../usergrid/persistence/index/query/Query.java |   2 +-
 .../index/query/tree/AndOperand.java            |   2 +-
 .../persistence/index/query/tree/Property.java  |   2 +-
 .../index/query/tree/StringLiteral.java         |   2 +-
 .../index/utils/IndexValidationUtils.java       |   3 +-
 .../index/impl/CorePerformanceIT.java           |  97 +--
 .../impl/EntityConnectionIndexImplTest.java     |  16 +-
 .../persistence/index/impl/EntityIndexTest.java | 144 +++--
 .../apache/usergrid/rest/PartialUpdateTest.java | 120 ++--
 30 files changed, 1326 insertions(+), 1028 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a6665f11/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --cc stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index f7df6c0,d729c97..8d3940d
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@@ -2966,17 -2888,13 +2893,17 @@@ public class CpEntityManager implement
                              po.onProgress( entity, ref, edge.getType());
  
                              // recursion
 -                            indexEntityConnectionsAndCollections( new SimpleEntityRef(
 -                                memberEntity.getId().getType(), memberEntity.getId().getUuid()),po);
 +                            if ( !stack.contains( ref )) {
 +                                stack.push( ref );
 +                                indexEntityConnectionsAndCollections( ref, po, stack );
 +                                stack.pop(); 
 +                            }
 +
  
-                         } else if ( isConnectionEdgeType( edge.getType() )) {
+                         } else if ( CpNamingUtils.isConnectionEdgeType( edge.getType() )) {
  
-                             String connType = getConnectionType(edgeType);
-                             String targetEntityType = getConnectedEntityType(edgeType);
+                             String connType = CpNamingUtils.getConnectionType( edgeType );
+                             String targetEntityType = edge.getTargetNode().getType();
                              String sourceEntityType = entity.getType();
  
                              CollectionScope sourceScope = new CollectionScopeImpl(


[4/4] git commit: Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o

Posted by sn...@apache.org.
Merge branch 'two-dot-o' of https://git-wip-us.apache.org/repos/asf/incubator-usergrid into two-dot-o


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

Branch: refs/heads/two-dot-o
Commit: 878d634ca26c152f7112fd312d27321afe05a891
Parents: 1073f11 b644cc0
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Oct 2 12:18:14 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Oct 2 12:18:14 2014 -0400

----------------------------------------------------------------------
 stack/pom.xml                                               | 2 +-
 .../java/org/apache/usergrid/rest/PartialUpdateTest.java    | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------