Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 080D818A67 for ; Thu, 28 May 2015 17:53:58 +0000 (UTC) Received: (qmail 95239 invoked by uid 500); 28 May 2015 17:47:18 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 95208 invoked by uid 500); 28 May 2015 17:47:18 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 95196 invoked by uid 99); 28 May 2015 17:47:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 May 2015 17:47:18 +0000 Date: Thu, 28 May 2015 17:47:18 +0000 (UTC) From: "Alejandro Fernandez (JIRA)" To: dev@ambari.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AMBARI-11409) UpgradeCatalog210 fails because older schemas used different FK names for host columns MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMBARI-11409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alejandro Fernandez updated AMBARI-11409: ----------------------------------------- Fix Version/s: 2.1.0 > UpgradeCatalog210 fails because older schemas used different FK names for host columns > -------------------------------------------------------------------------------------- > > Key: AMBARI-11409 > URL: https://issues.apache.org/jira/browse/AMBARI-11409 > Project: Ambari > Issue Type: Bug > Components: ambari-server > Affects Versions: 2.1.0 > Reporter: Alejandro Fernandez > Assignee: Alejandro Fernandez > Fix For: 2.1.0 > > Attachments: AMBARI-11409.fix.patch, AMBARI-11409.patch > > > When upgrading Ambari from 1.7.0 to 2.0.0 to 2.1.0, it fails because in older schemas the FK names of columns related to the host_name changed over time. > UpgradeCatalog210 should include the older FK names, and perform a CASCADE DELETE on the hosts PK just for good measure. > {code} > 24 May 2015 16:57:20,845 INFO [main] SchemaUpgradeHelper:260 - Upgrading schema to target version = 2.1.0 > 24 May 2015 16:57:20,889 INFO [main] SchemaUpgradeHelper:269 - Upgrading schema from source version = 2.0.0 > 24 May 2015 16:57:20,890 INFO [main] SchemaUpgradeHelper:142 - Upgrade path: [{ upgradeCatalog: sourceVersion = 2.0.0, targetVersion = 2.1.0 }, { upgradeCatalog: sourceVersion = null, targetVersion = 2.1.0 }] > 24 May 2015 16:57:20,891 INFO [main] SchemaUpgradeHelper:177 - Executing DDL upgrade... > 24 May 2015 16:57:20,891 INFO [main] DBAccessorImpl:556 - Executing query: ALTER SCHEMA ambari OWNER TO "ambari"; > 24 May 2015 16:57:20,892 INFO [main] DBAccessorImpl:556 - Executing query: ALTER ROLE "ambari" SET search_path to 'ambari'; > 24 May 2015 16:57:20,904 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE alert_current ALTER COLUMN latest_text TYPE TEXT > 24 May 2015 16:57:21,273 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hosts ADD host_id BIGINT > 24 May 2015 16:57:21,295 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 1 WHERE host_name = 'cn105-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,328 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 2 WHERE host_name = 'cn105.l42scl.hortonworks.com' > 24 May 2015 16:57:21,337 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 3 WHERE host_name = 'cn106-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,345 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 4 WHERE host_name = 'cn107-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,353 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 5 WHERE host_name = 'cn108-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,361 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 6 WHERE host_name = 'cn109-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,370 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 7 WHERE host_name = 'cn110-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,378 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 8 WHERE host_name = 'cn111-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,386 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 9 WHERE host_name = 'cn112-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,395 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 10 WHERE host_name = 'cn113-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,403 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 11 WHERE host_name = 'cn114-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,411 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 12 WHERE host_name = 'cn115-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,420 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 13 WHERE host_name = 'cn116-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,428 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 14 WHERE host_name = 'cn117-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,437 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 15 WHERE host_name = 'cn118-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,445 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 16 WHERE host_name = 'cn119-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,453 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 17 WHERE host_name = 'cn120-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,462 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 18 WHERE host_name = 'cn121-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,470 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 19 WHERE host_name = 'cn122-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,478 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 20 WHERE host_name = 'cn123-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,487 INFO [main] DBAccessorImpl:556 - Executing query: UPDATE hosts SET host_id = 21 WHERE host_name = 'cn124-10.l42scl.hortonworks.com' > 24 May 2015 16:57:21,495 INFO [main] DBAccessorImpl:556 - Executing query: INSERT INTO ambari_sequences (sequence_name, sequence_value) VALUES ('host_id_seq', 21) > 24 May 2015 16:57:21,520 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hosts ALTER COLUMN host_id TYPE BIGINT > 24 May 2015 16:57:21,655 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hostcomponentstate DROP CONSTRAINT hostcomponentstate_host_name > 24 May 2015 16:57:21,729 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hostcomponentdesiredstate DROP CONSTRAINT hstcmponentdesiredstatehstname > 24 May 2015 16:57:21,779 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE host_role_command DROP CONSTRAINT FK_host_role_command_host_name > 24 May 2015 16:57:21,821 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hoststate DROP CONSTRAINT FK_hoststate_host_name > 24 May 2015 16:57:21,863 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE host_version DROP CONSTRAINT FK_host_version_host_name > 24 May 2015 16:57:21,901 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE configgrouphostmapping DROP CONSTRAINT FK_cghm_hname > 24 May 2015 16:57:21,938 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE kerberos_principal_host DROP CONSTRAINT FK_krb_pr_host_hostname > 24 May 2015 16:57:21,946 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE kerberos_principal_host DROP CONSTRAINT FK_krb_pr_host_principalname > 24 May 2015 16:57:21,988 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hostconfigmapping DROP CONSTRAINT FK_hostconfmapping_host_name > 24 May 2015 16:57:22,030 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE ClusterHostMapping DROP CONSTRAINT ClusterHostMapping_host_name > 24 May 2015 16:57:22,071 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE ClusterHostMapping DROP CONSTRAINT ClusterHostMapping_cluster_id > 24 May 2015 16:57:22,102 INFO [main] DBAccessorImpl:390 - Foreign Key constraint FK_clhostmapping_cluster_id already exists, skipping > 24 May 2015 16:57:22,102 INFO [main] DBAccessorImpl:556 - Executing query: ALTER TABLE hosts DROP CONSTRAINT hosts_pkey > 24 May 2015 16:57:22,110 ERROR [main] DBAccessorImpl:562 - Error executing query: ALTER TABLE hosts DROP CONSTRAINT hosts_pkey > org.postgresql.util.PSQLException: ERROR: cannot drop constraint hosts_pkey on table hosts because other objects depend on it > Detail: constraint fk_hostcomponentdesiredstate_host_name on table hostcomponentdesiredstate depends on index hosts_pkey > constraint fk_configgrouphostmapping_host_name on table configgrouphostmapping depends on index hosts_pkey > constraint fk_kerberos_principal_host_host_name on table kerberos_principal_host depends on index hosts_pkey > constraint fk_hostcomponentstate_host_name on table hostcomponentstate depends on index hosts_pkey > constraint fk_clusterhostmapping_host_name on table clusterhostmapping depends on index hosts_pkey > Hint: Use DROP ... CASCADE to drop the dependent objects too. > at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161) > at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890) > at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) > at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559) > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403) > at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:395) > at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:559) > at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:545) > at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeHostsDDLUpdates(UpgradeCatalog210.java:356) > at org.apache.ambari.server.upgrade.UpgradeCatalog210.executeDDLUpdates(UpgradeCatalog210.java:152) > at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:377) > at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:182) > at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:274) > 24 May 2015 16:57:22,114 ERROR [main] SchemaUpgradeHelper:184 - Upgrade failed. > org.postgresql.util.PSQLException: ERROR: cannot drop constraint hosts_pkey on table hosts because other objects depend on it > Detail: constraint fk_hostcomponentdesiredstate_host_name on table hostcomponentdesiredstate depends on index hosts_pkey > constraint fk_configgrouphostmapping_host_name on table configgrouphostmapping depends on index hosts_pkey > constraint fk_kerberos_principal_host_host_name on table kerberos_principal_host depends on index hosts_pkey > constraint fk_hostcomponentstate_host_name on table hostcomponentstate depends on index hosts_pkey > constraint fk_clusterhostmapping_host_name on table clusterhostmapping depends on index hosts_pkey > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)