Return-Path: X-Original-To: apmail-usergrid-commits-archive@minotaur.apache.org Delivered-To: apmail-usergrid-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 55C4E17493 for ; Mon, 29 Sep 2014 20:52:41 +0000 (UTC) Received: (qmail 5622 invoked by uid 500); 29 Sep 2014 20:52:41 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 5566 invoked by uid 500); 29 Sep 2014 20:52:41 -0000 Mailing-List: contact commits-help@usergrid.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@usergrid.incubator.apache.org Delivered-To: mailing list commits@usergrid.incubator.apache.org Received: (qmail 5374 invoked by uid 99); 29 Sep 2014 20:52:41 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Sep 2014 20:52:41 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D7077A02121; Mon, 29 Sep 2014 20:52:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: toddnine@apache.org To: commits@usergrid.apache.org Date: Mon, 29 Sep 2014 20:52:51 -0000 Message-Id: <8a6dd12b8c714be5803735f5545ddda3@git.apache.org> In-Reply-To: <7790c1409f70410eb994e492e76eb7ce@git.apache.org> References: <7790c1409f70410eb994e492e76eb7ce@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/52] [abbrv] git commit: Remove dependency on collections manager, tone down some of the debug logging. Remove dependency on collections manager, tone down some of the debug logging. Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f6f3f5e2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f6f3f5e2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f6f3f5e2 Branch: refs/heads/eventsystem Commit: f6f3f5e250cb006a4d83fb456f910af7311bbe1b Parents: 483abce Author: Dave Johnson Authored: Wed Sep 24 11:45:00 2014 -0400 Committer: Dave Johnson Committed: Wed Sep 24 11:45:00 2014 -0400 ---------------------------------------------------------------------- .../index/impl/EsEntityIndexImpl.java | 36 ++++++++------------ 1 file changed, 15 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f6f3f5e2/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 025c268..58c3726 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 @@ -33,7 +33,6 @@ import java.util.TreeSet; import java.util.UUID; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.lang3.time.StopWatch; -import org.apache.usergrid.persistence.collection.EntityCollectionManagerFactory; import org.apache.usergrid.persistence.core.util.ValidationUtils; import org.apache.usergrid.persistence.index.EntityIndex; import org.apache.usergrid.persistence.index.IndexFig; @@ -75,7 +74,7 @@ import org.slf4j.LoggerFactory; /** - * Implements index using ElasticSearch Java API and Core Persistence Collections. + * Implements index using ElasticSearch Java API. */ public class EsEntityIndexImpl implements EntityIndex { @@ -93,8 +92,6 @@ public class EsEntityIndexImpl implements EntityIndex { // of attempting to init them again. Used in the initType() method. private Set knownTypes = new TreeSet(); - protected EntityCollectionManagerFactory ecmFactory; - private final boolean refresh; private final int cursorTimeout; @@ -104,7 +101,6 @@ public class EsEntityIndexImpl implements EntityIndex { public static final String ANALYZED_SUFFIX = "_ug_analyzed"; public static final String GEO_SUFFIX = "_ug_geo"; -// public static final String COLLECTION_SCOPE_FIELDNAME = "zzz__collectionscope__zzz"; public static final String ENTITYID_FIELDNAME = "zzz_entityid_zzz"; public static final String DOC_ID_SEPARATOR = "|"; @@ -121,8 +117,7 @@ public class EsEntityIndexImpl implements EntityIndex { public EsEntityIndexImpl( @Assisted final IndexScope indexScope, IndexFig config, - EsProvider provider, - EntityCollectionManagerFactory factory + EsProvider provider ) { IndexValidationUtils.validateIndexScope( indexScope ); @@ -131,7 +126,6 @@ public class EsEntityIndexImpl implements EntityIndex { this.indexScope = indexScope; this.client = provider.getClient(); - this.ecmFactory = factory; this.indexName = createIndexName( config.getIndexPrefix(), indexScope); this.indexType = createCollectionScopeTypeName( indexScope ); @@ -157,9 +151,7 @@ public class EsEntityIndexImpl implements EntityIndex { } catch (InterruptedException ex) {} } catch (IndexAlreadyExistsException ignored) { - if ( log.isDebugEnabled() ) { - log.debug("Keyspace already exists: " + indexName, ignored); - } + // expected } } @@ -185,18 +177,19 @@ public class EsEntityIndexImpl implements EntityIndex { admin.indices().prepareGetMappings(indexName) .addTypes(typeName).execute().actionGet(); - log.debug("Created new type mapping"); - log.debug(" Scope application: " + indexScope.getApplication()); - log.debug(" Scope owner: " + indexScope.getOwner()); - log.debug(" Type name: " + typeName); +// log.debug("Created new type mapping"); +// log.debug(" Scope application: " + indexScope.getApplication()); +// log.debug(" Scope owner: " + indexScope.getOwner()); +// log.debug(" Type name: " + typeName); knownTypes.add( typeName ); - } catch (Exception ex) { - // probably means type or mapping already exists, which is no problem - if ( log.isDebugEnabled() ) { - log.debug("Problem creating mapping for type: " + typeName, ex); - } + } catch (IndexAlreadyExistsException ignored) { + // expected + } + catch (IOException ex) { + throw new RuntimeException("Exception initing type " + typeName + + " in app " + indexScope.getApplication().toString()); } } @@ -504,7 +497,8 @@ public class EsEntityIndexImpl implements EntityIndex { // index in lower case because Usergrid queries are case insensitive entityMap.put(field.getName().toLowerCase(), ((String) field.getValue()).toLowerCase()); - entityMap.put(field.getName().toLowerCase() + ANALYZED_SUFFIX, ((String) field.getValue()).toLowerCase()); + entityMap.put(field.getName().toLowerCase() + + ANALYZED_SUFFIX, ((String) field.getValue()).toLowerCase()); } else if (f instanceof LocationField) { LocationField locField = (LocationField) f;