ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alejandro Fernandez" <>
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:

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

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


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

Bugs: AMBARI-12520

Repository: ambari


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
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/ 9104624 
  ambari-server/src/main/java/org/apache/ambari/server/orm/ ef65853 
  ambari-server/src/main/java/org/apache/ambari/server/orm/helpers/dbms/ bf3a87f

  ambari-server/src/main/java/org/apache/ambari/server/upgrade/ 3c274b2



Unit tests in progress.

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


Alejandro Fernandez

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