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 2014/08/21 05:31:24 UTC

[6/8] git commit: Fix to ES index refresh logic.

Fix to ES index refresh logic.


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

Branch: refs/heads/two-dot-o-push-notifications
Commit: 7bf22d65a633406d868840b5d122a382a741d9c2
Parents: aa5f24d
Author: Dave Johnson <dm...@apigee.com>
Authored: Wed Aug 20 14:22:46 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Wed Aug 20 14:22:46 2014 -0400

----------------------------------------------------------------------
 .../usergrid/corepersistence/CpEntityManagerFactory.java     | 8 ++++----
 .../org/apache/usergrid/rest/test/RefreshIndexResource.java  | 8 +++-----
 2 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7bf22d65/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 2863842..f9fe945 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
@@ -547,13 +547,13 @@ public class CpEntityManagerFactory implements EntityManagerFactory, Application
 
         // refresh special indexes without calling EntityManager refresh because stack overflow 
         IndexScope mscope = new IndexScopeImpl( 
-                new SimpleId( getManagementAppId(), "application"), 
-                new SimpleId( getManagementAppId(), "application"), "dummy");
+            new SimpleId( getManagementAppId(), "application"), 
+            new SimpleId( getManagementAppId(), "application"), "dummy");
         managerCache.getEntityIndex( mscope ).refresh();
 
         IndexScope dscope = new IndexScopeImpl( 
-                new SimpleId( getDefaultAppId(), "application"), 
-                new SimpleId( getDefaultAppId(), "application"), "dummy");
+            new SimpleId( getDefaultAppId(), "application"), 
+            new SimpleId( getDefaultAppId(), "application"), "dummy");
         managerCache.getEntityIndex( dscope ).refresh();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/7bf22d65/stack/rest/src/main/java/org/apache/usergrid/rest/test/RefreshIndexResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/test/RefreshIndexResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/test/RefreshIndexResource.java
index 27da7c2..4d0adb7 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/test/RefreshIndexResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/test/RefreshIndexResource.java
@@ -63,6 +63,9 @@ public class RefreshIndexResource extends AbstractContextResource {
                 throw new UnsupportedOperationException();
             }
 
+            // refresh the system apps or app lookup below may fail
+            emf.refreshIndex();
+
             UUID appId;
             if ( orgName != null && appName != null ) {
                 appId = emf.lookupApplication( orgName + "/" + appName );
@@ -76,11 +79,6 @@ public class RefreshIndexResource extends AbstractContextResource {
                 em.refreshIndex();
             } 
 
-            // refresh the system apps
-            emf.refreshIndex();
-            emf.getEntityManager( emf.getDefaultAppId() );
-            emf.getEntityManager( emf.getManagementAppId() );
-
         } catch (Exception e) {
             logger.error("Error in refresh", e);
             return Response.serverError().build();