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/10 17:11:38 UTC
git commit: Minor formatting and renaming changes,
also made stale entity test do fewer updates (it still fails).
Repository: incubator-usergrid
Updated Branches:
refs/heads/two-dot-o 9d96f4cc3 -> befcdcab6
Minor formatting and renaming changes, also made stale entity test do fewer updates (it still fails).
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/befcdcab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/befcdcab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/befcdcab
Branch: refs/heads/two-dot-o
Commit: befcdcab6f7f1c83dbcb2a24eddb055c9297d59f
Parents: 9d96f4c
Author: Dave Johnson <dm...@apigee.com>
Authored: Fri Oct 10 11:11:27 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Fri Oct 10 11:11:27 2014 -0400
----------------------------------------------------------------------
.../corepersistence/CpRelationManager.java | 15 ++-------------
.../corepersistence/results/FilteringLoader.java | 12 ++++++------
.../corepersistence/StaleIndexCleanupTest.java | 19 ++++++++++---------
3 files changed, 18 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/befcdcab/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index 00c48c3..76b8930 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -925,9 +925,11 @@ public class CpRelationManager implements RelationManager {
CandidateResults crs = ei.search( indexScope, query );
if ( results == null ) {
+ logger.debug("Calling build results 1");
results = buildResults( query, crs, collName );
} else {
+ logger.debug("Calling build results 2");
Results newResults = buildResults( query, crs, collName );
results.merge( newResults );
}
@@ -1321,19 +1323,6 @@ public class CpRelationManager implements RelationManager {
raw = buildResults( query , crs, query.getConnectionType() );
}
-// if ( Level.REFS.equals(level ) ) {
-// List<EntityRef> refList = new ArrayList<EntityRef>( raw.getEntities() );
-// return Results.fromRefList( refList );
-// }
-// if ( Level.IDS.equals(level ) ) {
-// // TODO: someday this should return a list of Core Persistence Ids
-// List<UUID> idList = new ArrayList<UUID>();
-// for ( EntityRef ref : raw.getEntities() ) {
-// idList.add( ref.getUuid() );
-// }
-// return Results.fromIdList( idList );
-// }
-
if ( Level.ALL_PROPERTIES.equals(level ) ) {
List<Entity> entities = new ArrayList<Entity>();
for ( EntityRef ref : raw.getEntities() ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/befcdcab/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
index bb41070..9e5ad55 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/results/FilteringLoader.java
@@ -61,15 +61,15 @@ public class FilteringLoader implements ResultsLoader {
private static final Logger logger = LoggerFactory.getLogger( FilteringLoader.class );
private final CpManagerCache managerCache;
- private final ResultsVerifier resultsLoader;
+ private final ResultsVerifier resultsVerifier;
private final Id ownerId;
private final ApplicationScope applicationScope;
- protected FilteringLoader( final CpManagerCache managerCache, final ResultsVerifier resultsLoader,
+ protected FilteringLoader( final CpManagerCache managerCache, final ResultsVerifier resultsVerifier,
final EntityRef ownerId, final ApplicationScope applicationScope ) {
this.managerCache = managerCache;
- this.resultsLoader = resultsLoader;
+ this.resultsVerifier = resultsVerifier;
this.ownerId = new SimpleId( ownerId.getUuid(), ownerId.getType() );
this.applicationScope = applicationScope;
}
@@ -195,7 +195,7 @@ public class FilteringLoader implements ResultsLoader {
//load the results into the loader for this scope for validation
- resultsLoader.loadResults( idsToLoad, ecm );
+ resultsVerifier.loadResults( idsToLoad, ecm );
//now let the loader validate each candidate. For instance, the "max" in this candidate
//could still be a stale result, so it needs validated
@@ -204,7 +204,7 @@ public class FilteringLoader implements ResultsLoader {
final CandidateResult cr = maxCandidateMapping.get( requestedId );
//ask the loader if this is valid, if not discard it and de-index it
- if ( !resultsLoader.isValid( cr ) ) {
+ if ( !resultsVerifier.isValid( cr ) ) {
deIndex( indexBatch, ownerId, cr );
continue;
}
@@ -220,7 +220,7 @@ public class FilteringLoader implements ResultsLoader {
//execute the cleanup
indexBatch.execute();
- return resultsLoader.getResults( sortedResults.values() );
+ return resultsVerifier.getResults( sortedResults.values() );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/befcdcab/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
index 1645ddf..159144d 100644
--- a/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
+++ b/stack/core/src/test/java/org/apache/usergrid/corepersistence/StaleIndexCleanupTest.java
@@ -107,8 +107,8 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
final EntityManager em = app.getEntityManager();
- final int numEntities = 100;
- final int numUpdates = 5;
+ final int numEntities = 10;
+ final int numUpdates = 3;
// create lots of entities
final List<Entity> things = new ArrayList<Entity>(numEntities);
@@ -163,28 +163,29 @@ public class StaleIndexCleanupTest extends AbstractCoreIT {
int thingCount = 0;
String cursor = null;
-
-
int index = 0;
do {
Results results = em.searchCollection( em.getApplicationRef(), "things", q);
+ thingCount += results.size();
+
+ logger.debug("Retrieved total of {} entities", thingCount );
+
cursor = results.getCursor();
- if ( cursor != null ) {
+ if ( cursor != null && thingCount < numEntities ) {
assertEquals( limit, results.size() );
}
- thingCount += results.size();
- for(int i = 0; i < results.size(); i ++, index++){
+ for (int i = 0; i < results.size(); i ++, index++){
+
final Entity returned = results.getEntities().get( i);
+
//last entities appear first
final Entity expected = maxVersions.get( index );
-
assertEquals("correct entity returned", expected, returned);
}
-
} while ( cursor != null );
assertEquals( "Expect no stale candidates", numEntities, thingCount );