Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-19984

ambari-server upgrade is not idempotent

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • ambari-server
    • None

    Description

      1. Upgraded Ambari from 2.4.0 to 2.5.0
      2. Set the version in metainfo back to 2.4.0
      3. update metainfo set metainfo_value = '2.4.0' where metainfo_key = 'version';
      4. Executed ambari-server upgrade again.

      Result:

      ERROR: Exception in thread "main" org.apache.ambari.server.AmbariException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException
      Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_permsn_roleauthorization"
      Error Code: 0
      Call: INSERT INTO permission_roleauthorization (authorization_id, permission_id) VALUES (?, ?)
      	bind => [2 parameters bound]
      	at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeDMLUpdates(SchemaUpgradeHelper.java:240)
      	at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:430)
      Caused by: javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException
      Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_permsn_roleauthorization"
      Error Code: 0
      Call: INSERT INTO permission_roleauthorization (authorization_id, permission_id) VALUES (?, ?)
      	bind => [2 parameters bound]
      	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:159)
      	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:153)
      	at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.addAuthorizationToRole(AbstractUpgradeCatalog.java:887)
      	at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.addRoleAuthorization(AbstractUpgradeCatalog.java:847)
      	at org.apache.ambari.server.upgrade.UpgradeCatalog250.addManageServiceAutoStartPermissions(UpgradeCatalog250.java:907)
      	at org.apache.ambari.server.upgrade.UpgradeCatalog250.executeDMLUpdates(UpgradeCatalog250.java:172)
      	at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeData(AbstractUpgradeCatalog.java:952)
      	at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeDMLUpdates(SchemaUpgradeHelper.java:237)
      	... 1 more
      Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException
      Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_permsn_roleauthorization"
      Error Code: 0
      Call: INSERT INTO permission_roleauthorization (authorization_id, permission_id) VALUES (?, ?)
      	bind => [2 parameters bound]
      	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1620)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:900)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:964)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:633)
      	at org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatch(ParameterizedSQLBatchWritingMechanism.java:149)
      	at org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatchedStatements(ParameterizedSQLBatchWritingMechanism.java:134)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.writesCompleted(DatabaseAccessor.java:1845)
      	at org.eclipse.persistence.internal.sessions.AbstractSession.writesCompleted(AbstractSession.java:4300)
      	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.writesCompleted(UnitOfWorkImpl.java:5592)
      	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.acquireWriteLocks(UnitOfWorkImpl.java:1646)
      	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitTransactionAfterWriteChanges(UnitOfWorkImpl.java:1614)
      	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:285)
      	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1169)
      	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:134)
      	... 8 more
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_permsn_roleauthorization"
      	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:417)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
      	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:892)
      	... 20 more
      

      Attachments

        1. AMBARI-19984_branch-2.5.patch
          27 kB
          Attila Magyar
        2. AMBARI-19984_trunk.patch
          25 kB
          Attila Magyar

        Issue Links

          Activity

            People

              amagyar Attila Magyar
              amagyar Attila Magyar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: