usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mru...@apache.org
Subject usergrid git commit: Make limit for versions to search for configurable.
Date Mon, 04 Apr 2016 22:07:32 GMT
Repository: usergrid
Updated Branches:
  refs/heads/release-2.1.1 dcd8c39f3 -> 8c186a91a


Make limit for versions to search for configurable.


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

Branch: refs/heads/release-2.1.1
Commit: 8c186a91ae44fe104ddfd16338cfa7f5bb36bf74
Parents: dcd8c39
Author: Michael Russo <mrusso@apigee.com>
Authored: Mon Apr 4 15:07:07 2016 -0700
Committer: Michael Russo <mrusso@apigee.com>
Committed: Mon Apr 4 15:07:07 2016 -0700

----------------------------------------------------------------------
 .../corepersistence/asyncevents/EventBuilderImpl.java  |  4 ++--
 .../usergrid/corepersistence/index/IndexService.java   |  5 ++---
 .../corepersistence/index/IndexServiceImpl.java        | 13 +++++++++----
 .../apache/usergrid/persistence/index/EntityIndex.java |  4 ++--
 .../persistence/index/impl/EsEntityIndexImpl.java      |  5 ++---
 .../persistence/index/impl/EntityIndexTest.java        |  4 ++--
 6 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/8c186a91/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/EventBuilderImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/EventBuilderImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/EventBuilderImpl.java
index 9851936..c43b3d5 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/EventBuilderImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/EventBuilderImpl.java
@@ -128,7 +128,7 @@ public class EventBuilderImpl implements EventBuilder {
 
         if(mostRecentlyMarked != null){
             deIndexObservable =
-                indexService.deleteEntityIndexes( applicationScope, entityId, mostRecentlyMarked.getVersion()
);
+                indexService.deleteEntityIndexes( applicationScope, entityId, mostRecentlyMarked.getVersion(),
false );
 
             ecmDeleteObservable =
                 ecm.getVersions( entityId )
@@ -194,7 +194,7 @@ public class EventBuilderImpl implements EventBuilder {
             UUID latestVersion = latestVersions.getMaxVersion(entityId).getVersion();
 
             deIndexObservable =
-                indexService.deleteEntityIndexes( applicationScope, entityId, latestVersion);
+                indexService.deleteEntityIndexes( applicationScope, entityId, latestVersion,
true );
 
         }
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/8c186a91/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexService.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexService.java
index 54eb464..b48062a 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexService.java
@@ -24,13 +24,11 @@ import java.util.UUID;
 
 import org.apache.usergrid.persistence.core.scope.ApplicationScope;
 import org.apache.usergrid.persistence.graph.Edge;
-import org.apache.usergrid.persistence.index.IndexEdge;
 import org.apache.usergrid.persistence.index.impl.IndexOperationMessage;
 import org.apache.usergrid.persistence.model.entity.Entity;
 import org.apache.usergrid.persistence.model.entity.Id;
 
 import rx.Observable;
-import rx.observables.ConnectableObservable;
 
 
 /**
@@ -78,10 +76,11 @@ public interface IndexService {
      *
      * @param applicationScope
      * @param entityId
+     * @param forEntityUpdates
      * @return
      */
     Observable<IndexOperationMessage> deleteEntityIndexes(final ApplicationScope applicationScope,
final Id entityId,
-                                                         final UUID markedVersion);
+                                                          final UUID markedVersion, boolean
forEntityUpdates);
 
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/8c186a91/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
index 6c07212..38e7122 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
@@ -52,7 +52,6 @@ import rx.Observable;
 import static org.apache.usergrid.corepersistence.util.CpNamingUtils.createSearchEdgeFromSource;
 import static org.apache.usergrid.corepersistence.util.CpNamingUtils.generateScopeFromSource;
 import static org.apache.usergrid.corepersistence.util.CpNamingUtils.generateScopeFromTarget;
-import static org.apache.usergrid.persistence.Schema.getDefaultSchema;
 
 
 /**
@@ -200,13 +199,19 @@ public class IndexServiceImpl implements IndexService {
     //This should look up the entityId and delete any documents with a timestamp that comes
before
     //The edges that are connected will be compacted away from the graph.
     @Override
-    public Observable<IndexOperationMessage> deleteEntityIndexes( final ApplicationScope
applicationScope,
-                                                                  final Id entityId, final
UUID markedVersion ) {
+    public Observable<IndexOperationMessage> deleteEntityIndexes(final ApplicationScope
applicationScope,
+                                                                 final Id entityId, final
UUID markedVersion, boolean forEntityUpdates) {
 
         //bootstrap the lower modules from their caches
         final EntityIndex ei = entityIndexFactory.createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(applicationScope)
);
 
-        CandidateResults crs = ei.getAllEntityVersionsBeforeMarkedVersion( entityId, markedVersion
);
+        CandidateResults crs;
+        if(forEntityUpdates){
+            crs = ei.getAllEntityVersionsBeforeMarkedVersion( entityId, markedVersion, indexFig.getOldVersionQueryLimit()
);
+
+        }else{
+            crs = ei.getAllEntityVersionsBeforeMarkedVersion( entityId, markedVersion, indexFig.getVersionQueryLimit()
);
+        }
 
         //If we get no search results, its possible that something was already deleted or
         //that it wasn't indexed yet. In either case we can't delete anything and return
an empty observable..

http://git-wip-us.apache.org/repos/asf/usergrid/blob/8c186a91/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
index 81f900c..4f7ee72 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/EntityIndex.java
@@ -20,7 +20,6 @@
 package org.apache.usergrid.persistence.index;
 
 
-import com.google.common.base.Optional;
 import org.apache.usergrid.persistence.core.CPManager;
 import org.apache.usergrid.persistence.core.util.Health;
 import org.apache.usergrid.persistence.model.entity.Id;
@@ -117,9 +116,10 @@ public interface EntityIndex extends CPManager {
      *
      * @param entityId      The entityId to match when searching
      * @param markedVersion The version that has been marked for deletion. All version before
this one must be deleted.
+     * @param limitToDelete
      * @return
      */
-    CandidateResults getAllEntityVersionsBeforeMarkedVersion(final Id entityId, final UUID
markedVersion);
+    CandidateResults getAllEntityVersionsBeforeMarkedVersion(final Id entityId, final UUID
markedVersion, int limitToDelete);
 
     /**
      * delete all application records

http://git-wip-us.apache.org/repos/asf/usergrid/blob/8c186a91/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
index a601997..111e16b 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityIndexImpl.java
@@ -56,7 +56,6 @@ import org.elasticsearch.action.deletebyquery.DeleteByQueryResponse;
 import org.elasticsearch.action.deletebyquery.IndexDeleteByQueryResponse;
 import org.elasticsearch.action.search.SearchRequestBuilder;
 import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.action.search.SearchScrollRequestBuilder;
 import org.elasticsearch.client.AdminClient;
 import org.elasticsearch.common.settings.ImmutableSettings;
 import org.elasticsearch.common.settings.Settings;
@@ -532,7 +531,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
 
 
     @Override
-    public CandidateResults getAllEntityVersionsBeforeMarkedVersion( final Id entityId, final
UUID markedVersion ) {
+    public CandidateResults getAllEntityVersionsBeforeMarkedVersion(final Id entityId, final
UUID markedVersion, int limitToDelete) {
 
         Preconditions.checkNotNull( entityId, "entityId cannot be null" );
         Preconditions.checkNotNull(markedVersion, "markedVersion cannot be null");
@@ -544,7 +543,7 @@ public class EsEntityIndexImpl implements EntityIndex,VersionedData {
         final long markedTimestamp = markedVersion.timestamp();
 
         // never let the limit be less than 2 as there are potential indefinite paging issues
-        final int searchLimit = Math.max(2, indexFig.getOldVersionQueryLimit());
+        final int searchLimit = Math.max(2, limitToDelete);
 
         // this query will find the document for the entity itself
         final QueryBuilder entityQuery = QueryBuilders

http://git-wip-us.apache.org/repos/asf/usergrid/blob/8c186a91/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index 3978956..0896229 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@ -387,7 +387,7 @@ public class EntityIndexTest extends BaseIT {
      * Tests that we aggregate results only before the halfway version point.
      */
     @Test
-    public void testScollingDeindex() {
+    public void testScrollingDeindex() {
 
         int numberOfEntities = 1000;
         int versionToSearchFor = numberOfEntities / 2;
@@ -419,7 +419,7 @@ public class EntityIndexTest extends BaseIT {
 
         CandidateResults candidateResults = entityIndex
             .getAllEntityVersionsBeforeMarkedVersion( entity[versionToSearchFor].getId(),
-                entity[versionToSearchFor].getVersion() );
+                entity[versionToSearchFor].getVersion(), numberOfEntities );
         assertEquals( 501, candidateResults.size() );
     }
 


Mime
View raw message