Repository: incubator-usergrid Updated Branches: refs/heads/two-dot-o-dev ae1267aae -> 11e40ce37
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8f18e266/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java ---------------------------------------------------------------------- diff --git a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java index 46c6b6a..777fa0d 100644 --- a/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java +++ b/stack/core/src/test/java/org/apache/usergrid/persistence/query/IteratingQueryIT.java @@ -689,7 +689,7 @@ public class IteratingQueryIT { LOG.info( "Writes took {} ms", stop - start ); - Query query = Query.fromQL( "select * where searched = true sort by created" ); + Query query = Query.fromQL( "select * where searched = true order by created" ); query.setLimit( queryLimit ); int count = 0; http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8f18e266/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 dcda045..c2bb441 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 @@ -351,15 +351,15 @@ public class EsEntityIndexImpl implements AliasedEntityIndex,VersionedData { } catch ( Exception e ) { logger.error( "Unable to execute operation, retrying", e ); + try { + Thread.sleep( WAIT_TIME ); + } catch ( InterruptedException ie ) { + //swallow it + } } - try { - Thread.sleep( WAIT_TIME ); - } - catch ( InterruptedException e ) { - //swallow it - } + } } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8f18e266/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java index 3f2a56f..5aa1f4e 100644 --- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java +++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexRefreshCommandImpl.java @@ -85,6 +85,7 @@ public class IndexRefreshCommandImpl implements IndexRefreshCommand { @Override public Observable<IndexRefreshCommandInfo> execute() { + final long start = System.currentTimeMillis(); Timer.Context refreshTimer = timer.time(); //id to hunt for @@ -124,7 +125,6 @@ public class IndexRefreshCommandImpl implements IndexRefreshCommand { //start our processing immediately final Observable<IndexRefreshCommandInfo> future = Async.toAsync( () -> { - long start = System.currentTimeMillis(); IndexRefreshCommandInfo info; try { for ( int i = 0; i < indexFig.maxRefreshSearches(); i++ ) { http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/8f18e266/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 f0a1630..550b26b 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 @@ -90,10 +90,6 @@ public class EntityIndexTest extends BaseIT { @Inject @Rule - public MigrationManagerRule migrationManagerRule; - - @Inject - @Rule public ElasticSearchRule elasticSearchRule; @@ -111,7 +107,6 @@ public class EntityIndexTest extends BaseIT { insertJsonBlob( entityIndex, entityType, searchEdge, "/sample-large.json", 101, 0 ); - ei.refreshAsync().toBlocking().last(); testQueries( searchEdge, searchTypes, entityIndex ); } @@ -257,6 +252,7 @@ public class EntityIndexTest extends BaseIT { @Test public void testAddMultipleIndexes() throws IOException { + Id appId = new SimpleId( "application" ); ApplicationScope applicationScope = new ApplicationScopeImpl( appId ); @@ -266,24 +262,23 @@ public class EntityIndexTest extends BaseIT { final String entityType = "thing"; IndexEdge searchEdge = new IndexEdgeImpl( appId, "things", SearchEdge.NodeType.SOURCE, 10 ); - final SearchTypes searchTypes = SearchTypes.fromTypes( entityType ); + final SearchTypes searchTypes = SearchTypes.fromTypes(entityType); - insertJsonBlob( entityIndex, entityType, searchEdge, "/sample-large.json", 101, 0 ); + insertJsonBlob(entityIndex, entityType, searchEdge, "/sample-large.json", 101, 0); - ei.refreshAsync().toBlocking().last(); - testQueries( searchEdge, searchTypes, entityIndex ); - - ei.addIndex( "v2", 1, 0, "one" ); + testQueries(searchEdge, searchTypes, entityIndex); - insertJsonBlob( entityIndex, entityType, searchEdge, "/sample-large.json", 101, 100 ); + ei.addIndex("v2", 1, 0, "one"); - ei.refreshAsync().toBlocking().last(); + insertJsonBlob(entityIndex, entityType, searchEdge, "/sample-large.json", 101, 100); //Hilda Youn testQuery( searchEdge, searchTypes, entityIndex, "name = 'Hilda Young'", 1 ); testQuery( searchEdge, searchTypes, entityIndex, "name = 'Lowe Kelley'", 1 ); + + log.info("hi"); } @@ -302,13 +297,11 @@ public class EntityIndexTest extends BaseIT { insertJsonBlob( entityIndex, entityType, searchEdge, "/sample-large.json", 1, 0 ); - ei.refreshAsync().toBlocking().last(); ei.addIndex( "v2", 1, 0, "one" ); insertJsonBlob( entityIndex, entityType, searchEdge, "/sample-large.json", 1, 0 ); - ei.refreshAsync().toBlocking().last(); CandidateResults crs = testQuery( searchEdge, searchTypes, entityIndex, "name = 'Bowers Oneil'", 2 ); EntityIndexBatch entityIndexBatch = entityIndex.createBatch(); @@ -330,7 +323,9 @@ public class EntityIndexTest extends BaseIT { EntityIndexBatch batch = entityIndex.createBatch(); insertJsonBlob( sampleJson, batch, entityType, indexEdge, max, startIndex ); batch.execute().get(); - ei.refreshAsync().toBlocking().last(); + IndexRefreshCommandImpl.IndexRefreshCommandInfo info = ei.refreshAsync().toBlocking().last(); + long time = info.getExecutionTime(); + log.info("refresh took ms:"+time); } @@ -356,8 +351,6 @@ public class EntityIndexTest extends BaseIT { EntityUtils.setVersion( entity, UUIDGenerator.newTimeUUID() ); entity.setField( new UUIDField( IndexingUtils.ENTITY_ID_FIELDNAME, UUID.randomUUID() ) ); batch.index( indexEdge, entity ); - batch.execute().get(); - if ( ++count > max ) { break; @@ -418,8 +411,7 @@ public class EntityIndexTest extends BaseIT { StopWatch timer = new StopWatch(); timer.start(); - CandidateResults candidateResults = null; - candidateResults = entityIndex.search( scope, searchTypes, queryString, num + 1 ); + CandidateResults candidateResults = entityIndex.search( scope, searchTypes, queryString, num + 1 ); timer.stop(); @@ -626,14 +618,9 @@ public class EntityIndexTest extends BaseIT { @Test public void healthTest() { Id appId = new SimpleId( "entityindextest" ); - Id ownerId = new SimpleId( "multivaluedtype" ); - ApplicationScope applicationScope = new ApplicationScopeImpl( appId ); assertNotEquals( "cluster should be ok", Health.RED, ei.getClusterHealth() ); assertEquals( "index should be ready", Health.GREEN, ei.getIndexHealth() ); - ApplicationEntityIndex entityIndex = eif.createApplicationEntityIndex( applicationScope ); - ei.refreshAsync().toBlocking().last(); - assertNotEquals( "cluster should be fine", Health.RED, ei.getIndexHealth() ); assertNotEquals( "cluster should be ready now", Health.RED, ei.getClusterHealth() ); }