You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by gr...@apache.org on 2016/04/08 22:21:07 UTC

[20/36] usergrid git commit: Changed the seemingly not working delay to 50 millisecond , moved the collection reindexing timer updating code to be easier to follow.

Changed the seemingly not working delay to 50 millisecond , moved the collection reindexing timer updating code to be easier to follow.


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

Branch: refs/heads/release-2.1.1
Commit: 899e4646f8990188840d7361fd37522abf1daf62
Parents: 0feeebb
Author: George Reyes <gr...@apache.org>
Authored: Tue Mar 29 16:43:02 2016 -0700
Committer: George Reyes <gr...@apache.org>
Committed: Tue Mar 29 16:43:02 2016 -0700

----------------------------------------------------------------------
 .../corepersistence/CpEntityManager.java        |  2 --
 .../index/ReIndexServiceImpl.java               | 27 +++++++++++---------
 .../rest/applications/CollectionResource.java   |  2 +-
 3 files changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/899e4646/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 2c97bc6..78e52ef 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
@@ -2737,8 +2737,6 @@ public class CpEntityManager implements EntityManager {
         // add to and index in collection of the application
         if ( !is_application ) {
 
-            //maybe a check here to see if it exists in the column family and if it doesn't then SEND IT ON THROUGHH
-
             String collectionName = Schema.defaultCollectionName( eType );
             CpRelationManager cpr = ( CpRelationManager ) getRelationManager( getApplication() );
             cpr.addToCollection( collectionName, entity );

http://git-wip-us.apache.org/repos/asf/usergrid/blob/899e4646/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
index 42067f5..22ec9d9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/ReIndexServiceImpl.java
@@ -138,24 +138,27 @@ public class ReIndexServiceImpl implements ReIndexService {
             reIndexRequestBuilder.getCollectionName(), cursorSeek.getSeekValue() )
             .buffer( indexProcessorFig.getReindexBufferSize());
 
-        if(delayTimer.isPresent()){
+        //Check to see if we have a selective indexing schema, if we do then update its reindexing time, otherwise
+        //don't update or create anything.
+        if(reIndexRequestBuilder.getCollectionName().isPresent()) {
+            String collectionName =  InflectionUtils.pluralize( CpNamingUtils.getNameFromEdgeType(reIndexRequestBuilder.getCollectionName().get() ));
+            MapManager collectionMapStorage = mapManagerFactory.createMapManager( CpNamingUtils.getEntityTypeMapScope( appId.get().getApplication()  ) );
+            String jsonSchemaMap = collectionMapStorage.getString( collectionName );
+
 
-            if(reIndexRequestBuilder.getCollectionName().isPresent()) {
-                String collectionName =  InflectionUtils.pluralize( CpNamingUtils.getNameFromEdgeType(reIndexRequestBuilder.getCollectionName().get() ));
-                MapManager collectionMapStorage = mapManagerFactory.createMapManager( CpNamingUtils.getEntityTypeMapScope( appId.get().getApplication()  ) );
-                String jsonSchemaMap = collectionMapStorage.getString( collectionName );
+            //If we do have a schema then parse it and add it to a list of properties we want to keep.Otherwise return.
+            if ( jsonSchemaMap != null ) {
 
+                Map jsonMapData = ( Map ) JsonUtils.parse( jsonSchemaMap );
 
-                //If we do have a schema then parse it and add it to a list of properties we want to keep.Otherwise return.
-                if ( jsonSchemaMap != null ) {
+                jsonMapData.put( "lastReindexed", Instant.now().toEpochMilli() );
+                collectionMapStorage.putString( collectionName,JsonUtils.mapToJsonString(jsonMapData )  );
+            }
 
-                    Map jsonMapData = ( Map ) JsonUtils.parse( jsonSchemaMap );
+        }
 
-                    jsonMapData.put( "lastReindexed", Instant.now().toEpochMilli() );
-                    collectionMapStorage.putString( collectionName,JsonUtils.mapToJsonString(jsonMapData )  );
-                }
+        if(delayTimer.isPresent()){
 
-            }
             if(timeUnitOptional.isPresent()){
                 runningReIndex = runningReIndex.delay( delayTimer.get(),timeUnitOptional.get() );
             }

http://git-wip-us.apache.org/repos/asf/usergrid/blob/899e4646/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
index 8f4bdf0..80ed36b 100644
--- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
+++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/CollectionResource.java
@@ -178,7 +178,7 @@ public class CollectionResource extends ServiceResource {
 
         final ReIndexRequestBuilder request =
             createRequest().withApplicationId( services.getApplicationId() ).withCollection(
-                String.valueOf( getServiceParameters().get( 0 ) ) ).withDelay( 1, TimeUnit.SECONDS );
+                String.valueOf( getServiceParameters().get( 0 ) ) ).withDelay( 50, TimeUnit.MILLISECONDS );
 
         return executeAndCreateResponse( request, callback );
     }