Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5B4A0200D21 for ; Mon, 16 Oct 2017 11:14:03 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5A177160BE9; Mon, 16 Oct 2017 09:14:03 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A8FAA1609EC for ; Mon, 16 Oct 2017 11:14:02 +0200 (CEST) Received: (qmail 27900 invoked by uid 500); 16 Oct 2017 09:14:01 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 27882 invoked by uid 99); 16 Oct 2017 09:14:01 -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; Mon, 16 Oct 2017 09:14:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 96E38DF9F1; Mon, 16 Oct 2017 09:14:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dmitriusan@apache.org To: commits@ambari.apache.org Date: Mon, 16 Oct 2017 09:14:01 -0000 Message-Id: <2f358b4c6c8740e3999bf677b3d8738a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] ambari git commit: AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade - workaround (dlysnichenko) archived-at: Mon, 16 Oct 2017 09:14:03 -0000 Repository: ambari Updated Branches: refs/heads/branch-2.6 34dc30941 -> f8c66dd05 refs/heads/trunk df1081378 -> e219186ea AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade - workaround (dlysnichenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f8c66dd0 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f8c66dd0 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f8c66dd0 Branch: refs/heads/branch-2.6 Commit: f8c66dd050dd29e769e3300831ca1e25dba46233 Parents: 34dc309 Author: Lisnichenko Dmitro Authored: Mon Oct 16 12:13:01 2017 +0300 Committer: Lisnichenko Dmitro Committed: Mon Oct 16 12:13:01 2017 +0300 ---------------------------------------------------------------------- .../ambari/server/upgrade/UpgradeCatalog260.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f8c66dd0/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java index c701bdb..6f37985 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java @@ -79,6 +79,7 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog { public static final String DESIRED_REPO_VERSION_ID_COLUMN = "desired_repo_version_id"; public static final String REPO_STATE_COLUMN = "repo_state"; public static final String FK_SCDS_DESIRED_STACK_ID = "FK_scds_desired_stack_id"; + public static final String FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID = "FK_servicecomponentdesiredstate_desired_stack_id"; public static final String FK_SCDS_DESIRED_REPO_ID = "FK_scds_desired_repo_id"; public static final String REPO_VERSION_TABLE = "repo_version"; @@ -151,6 +152,9 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog { public static final String STALE_POSTGRESS_USERS_LDAP_USER_KEY = "users_ldap_user_key"; public static final String SHORT_URL_COLUMN = "short_url"; public static final String FK_INSTANCE_URL_ID = "FK_instance_url_id"; + public static final String FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID = "FK_servicedesiredstate_desired_stack_id"; + public static final String FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID = "FK_hostcomponentdesiredstate_desired_stack_id"; + public static final String FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID = "FK_hostcomponentstate_current_stack_id"; /** @@ -186,6 +190,7 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog { @Override protected void executeDDLUpdates() throws AmbariException, SQLException { int currentVersionID = getCurrentVersionID(); + dropBrokenFK(); updateServiceComponentDesiredStateTable(currentVersionID); updateServiceDesiredStateTable(currentVersionID); addSelectedCollumsToClusterconfigTable(); @@ -202,6 +207,20 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog { removeStaleConstraints(); } + /** + * Drop broken FK + * {@value #FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID} + * {@value #FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID} + * {@value #FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID} + * {@value #FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID} + */ + private void dropBrokenFK() throws SQLException { + dbAccessor.dropFKConstraint(SERVICE_COMPONENT_DESIRED_STATE_TABLE, FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID); + dbAccessor.dropFKConstraint(SERVICE_DESIRED_STATE_TABLE, FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID); + dbAccessor.dropFKConstraint(HOST_COMPONENT_DESIRED_STATE_TABLE, FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID); + dbAccessor.dropFKConstraint(HOST_COMPONENT_STATE_TABLE, FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID); + } + /** * Updates {@value #VIEWURL_TABLE} table.