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 C5DD5178B2 for ; Thu, 12 Mar 2015 22:41:09 +0000 (UTC) Received: (qmail 80526 invoked by uid 500); 12 Mar 2015 22:41:09 -0000 Delivered-To: apmail-usergrid-commits-archive@usergrid.apache.org Received: (qmail 80487 invoked by uid 500); 12 Mar 2015 22:41:09 -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 79927 invoked by uid 99); 12 Mar 2015 22:41:09 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2015 22:41:09 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 42471E09B2; Thu, 12 Mar 2015 22:41:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: grey@apache.org To: commits@usergrid.apache.org Date: Thu, 12 Mar 2015 22:41:33 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [26/38] incubator-usergrid git commit: Moved add alias and test new index into try so we don't keep moving the index alias Moved add alias and test new index into try so we don't keep moving the index alias Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/fc07d9aa Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/fc07d9aa Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/fc07d9aa Branch: refs/heads/USERGRID-396 Commit: fc07d9aa85e8c01cd0e3f122e0ac7375ec43a7a3 Parents: 3b409f6 Author: Todd Nine Authored: Sun Mar 8 20:14:37 2015 -0600 Committer: Todd Nine Committed: Sun Mar 8 21:07:58 2015 -0600 ---------------------------------------------------------------------- .../persistence/index/impl/EsEntityIndexImpl.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/fc07d9aa/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 d980401..80fede9 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 @@ -216,14 +216,26 @@ public class EsEntityIndexImpl implements AliasedEntityIndex { .execute() .actionGet(); timeNewIndexCreation.stop(); + + //ONLY add the alias if we create the index, otherwise we're going to overwrite production settings + + /** + * DO NOT MOVE THIS LINE OF CODE UNLESS YOU REALLY KNOW WHAT YOU'RE DOING!!!! + */ + + //We do NOT want to create an alias if the index already exists, we'll overwrite the indexes that + //may have been set via other administrative endpoint + addAlias(normalizedSuffix); + + testNewIndex(); + logger.info("Created new Index Name [{}] ACK=[{}]", indexName, cir.isAcknowledged()); } catch (IndexAlreadyExistsException e) { logger.info("Index Name [{}] already exists", indexName); } - addAlias(normalizedSuffix); - testNewIndex(); + } catch (IndexAlreadyExistsException expected) { // this is expected to happen if index already exists, it's a no-op and swallow } catch (IOException e) {