ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Fernandez" <afernan...@hortonworks.com>
Subject Re: Review Request 36762: ambari-server upgrade from 2.0.1 to 2.1.0 failed in postgres while deleting foreign keys
Date Fri, 24 Jul 2015 22:05:59 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36762/
-----------------------------------------------------------

(Updated July 24, 2015, 10:05 p.m.)


Review request for Ambari, Jonathan Hurley, Sid Wagle, and Yusaku Sako.


Changes
-------

CASCADE drop of PK is only supported in Postgres. Tested in MySQL.


Bugs: AMBARI-12520
    https://issues.apache.org/jira/browse/AMBARI-12520


Repository: ambari


Description
-------

Ambari upgrade from 2.0.1 to 2.1.0 failed with

```
23 Jul 2015 11:37:20,869 ERROR [main] DBAccessorImpl:697 – 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_hostconfigmapping_host_name on table hostconfigmapping depends on index
hosts_pkey
Hint: Use DROP … CASCADE to drop the dependent objects too.
```

This was a postgres database, and it is possible that the name of the FK was different on
that database.
To make the code more robust, I decided to use a CASCADE DELETE.


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessor.java 9104624 
  ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java ef65853 
  ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/DbmsHelper.java bf3a87f

  ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/GenericDbmsHelper.java
39926ef 
  ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/PostgresHelper.java
10be314 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java 3c274b2


Diff: https://reviews.apache.org/r/36762/diff/


Testing
-------

Unit tests in progress.

I verified that an Ambari upgrade from 2.0.1 to 2.1.0 was successful using Postgres.


Thanks,

Alejandro Fernandez


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message