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/03/25 16:21:24 UTC
[25/43] git commit: Fixes to CorePersistenceIT and index impl.
Fixes to CorePersistenceIT and index impl.
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/6b7ffbeb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/6b7ffbeb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/6b7ffbeb
Branch: refs/heads/asyncqueue
Commit: 6b7ffbeb59f4b04657c874b284349675e52c4dba
Parents: b3b46e4
Author: Dave Johnson <dm...@apigee.com>
Authored: Thu Mar 20 13:19:46 2014 -0400
Committer: Dave Johnson <dm...@apigee.com>
Committed: Thu Mar 20 13:19:46 2014 -0400
----------------------------------------------------------------------
.../index/impl/EsEntityCollectionIndex.java | 13 ++++++++-----
.../index/impl/CorePerformanceIT.java | 20 ++++++++++----------
2 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6b7ffbeb/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
index 4d750a7..8e16d88 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/EsEntityCollectionIndex.java
@@ -49,7 +49,6 @@ import org.apache.usergrid.persistence.model.field.SetField;
import org.apache.usergrid.persistence.model.field.StringField;
import org.apache.usergrid.persistence.query.Query;
import org.apache.usergrid.persistence.query.Results;
-import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
@@ -119,13 +118,17 @@ public class EsEntityCollectionIndex implements EntityCollectionIndex {
this.refresh = config.isForcedRefresh();
this.cursorTimeout = config.getQueryCursorTimeout();
- // if new index then create it
AdminClient admin = client.admin();
- if (!admin.indices().exists(
- new IndicesExistsRequest(indexName)).actionGet().isExists()) {
-
+ try {
admin.indices().prepareCreate(indexName).execute().actionGet();
log.debug("Created new index: " + indexName);
+
+ } catch (Exception e) {
+ if ( log.isDebugEnabled() ) {
+ log.debug("Exception creating index, already exists?", e);
+ } else {
+ log.info(e.getMessage());
+ }
}
// if new type then create mapping
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/6b7ffbeb/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CorePerformanceIT.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CorePerformanceIT.java b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CorePerformanceIT.java
index b368b92..0008304 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CorePerformanceIT.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/CorePerformanceIT.java
@@ -107,20 +107,17 @@ public class CorePerformanceIT {
for ( int i=0; i<orgCount; i++ ) {
- String orgName = "org-${i}-${time}";
+ String orgName = "org-" + i + "-" + time;
final Id orgId = new SimpleId(orgName);
for ( int j=0; j<appCount; j++ ) {
- String appName = "app-${j}-${time}";
+ String appName = "app-" + j + "-" + time;
final Id appId = new SimpleId(appName);
CollectionScope scope = new CollectionScopeImpl( orgId, appId, "reviews" );
scopes.add( scope );
-// def scopeFile = new File("/home/ubuntu/scopes.txt")
-// scopeFile.append("Created ${orgId}, ${appId}\n")
-
Thread t = new Thread( new DataLoader( scope ));
t.start();
threads.add(t);
@@ -181,7 +178,7 @@ public class CorePerformanceIT {
results.getEntities(); // cause retrieval from Cassanda;
count += results.size();
- log.info("Read ${count} reviews in ${orgId} ${appId}");
+ log.info("Read {} reviews in {} / {} ", count, orgId, appId );
}
}
}
@@ -212,6 +209,9 @@ public class CorePerformanceIT {
Entity current = new Entity(
new SimpleId(UUIDGenerator.newTimeUUID(), "review"));
+ Id orgId = scope.getOrganization();
+ Id appId = scope.getOwner();
+
int count = 0;
try {
while ( (s = br.readLine()) != null && count < maxEntities ) {
@@ -225,7 +225,7 @@ public class CorePerformanceIT {
eci.index( current );
if ( maxEntities < 20 ) {
- log.info("Index written for ${current.getId()}");
+ log.info("Index written for {}", current.getId());
log.info("---");
}
@@ -235,7 +235,7 @@ public class CorePerformanceIT {
count++;
if (count % 100000 == 0) {
- log.info("Indexed ${count} reviews in ${orgId} ${appId}");
+ log.info("Indexed {} reviews in {} / {} ", count, orgId, appId );
}
continue;
}
@@ -245,7 +245,7 @@ public class CorePerformanceIT {
String value = s.substring( s.indexOf(":") + 1 ).trim();
if ( maxEntities < 20 ) {
- log.info("Indexing ${name} = ${value}");
+ log.info("Indexing {} = {}", name, value);
}
if ( NumberUtils.isNumber(value) && value.contains(".")) {
@@ -298,7 +298,7 @@ public class CorePerformanceIT {
public static void query( EntityCollectionIndex eci, String query ) {;
Query q = Query.fromQL(query) ;
Results results = eci.execute( q );
- log.info("${q.getQl()}: ${results.getIds().size()}");
+ log.info("size = {} returned from query {}",results.size(), q.getQl() );
}
}