Ambari: relation "unq_users_0" already exists

La actualización de Ambari 2.2.1 a 2.4.1 falla con la siguiente excepción:

Exception in thread "main" org.apache.ambari.server.AmbariException: ERROR: relation "unq_users_0" already exists
        at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:207)
        at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:347)
Caused by: org.postgresql.util.PSQLException: ERROR: relation "unq_users_0" already exists
        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:827)
        at org.apache.ambari.server.orm.DBAccessorImpl.executeQuery(DBAccessorImpl.java:819)
        at org.apache.ambari.server.orm.DBAccessorImpl.addUniqueConstraint(DBAccessorImpl.java:518)
        at org.apache.ambari.server.upgrade.UpgradeCatalog230.executeDDLUpdates(UpgradeCatalog230.java:110)
        at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:889)
        at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:204)
        ... 1 more

En ambari-server.log vemos el origen del problema:

Error executing query
: ALTER TABLE users ADD CONSTRAINT UNQ_users_0 UNIQUE (user_name, user_type)

Solución:

Eliminar esa "constraint":

su - postgres
psql
alter table ambari.users drop constraint unq_users_0;
\q

Y volver a intentar la actualización.

Deja un comentario

El código HTML se muestra como texto y las direcciones web se transforman automáticamente.

Arriba