ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Levas <rle...@hortonworks.com>
Subject Review Request 43950: UpgradeCatalog230 is not idempotent
Date Wed, 24 Feb 2016 16:09:49 GMT

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

Review request for Ambari, Alejandro Fernandez and Sumit Mohanty.


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


Repository: ambari


Description
-------

If ambari-server upgrade is run again, the following error is encountered. One easy way to
test it is to set the version in the DB to an older version and then call ambari-server upgrade.

e.g. `update metainfo set metainfo_value = '2.2.0' where neatinfo_key = 'version';`
 
```
Error output from schema upgrade command:
Exception in thread "main" org.apache.ambari.server.AmbariException: Exception [EclipseLink-4002]
(Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates
unique constraint "adminpermission_pkey"
Error Code: 0
Call: INSERT INTO adminpermission (permission_id, permission_label, permission_name, sort_order,
resource_type_id) VALUES (?, ?, ?, ?, ?)
	bind => [5 parameters bound]
	at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeDMLUpdates(SchemaUpgradeHelper.java:233)
	at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:307)
Caused by: javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence
Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates
unique constraint "adminpermission_pkey"
Error Code: 0
Call: INSERT INTO adminpermission (permission_id, permission_label, permission_name, sort_order,
resource_type_id) VALUES (?, ?, ?, ?, ?)
	bind => [5 parameters bound]
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:157)
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(AmbariJpaLocalTxnInterceptor.java:91)
	at org.apache.ambari.server.upgrade.UpgradeCatalog230.addNewPermissions(UpgradeCatalog230.java:144)
	at org.apache.ambari.server.upgrade.UpgradeCatalog230.executeDMLUpdates(UpgradeCatalog230.java:127)
	at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeData(AbstractUpgradeCatalog.java:659)
	at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeDMLUpdates(SchemaUpgradeHelper.java:230)
	... 1 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd):
org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: duplicate key value violates
unique constraint "adminpermission_pkey"
Error Code: 0
Call: INSERT INTO adminpermission (permission_id, permission_label, permission_name, sort_order,
resource_type_id) VALUES (?, ?, ?, ?, ?)
	bind => [5 parameters bound]
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1611)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:898)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:962)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:631)
	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:1836)
	at org.eclipse.persistence.internal.sessions.AbstractSession.writesCompleted(AbstractSession.java:4244)
```


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessor.java 8142661 
  ambari-server/src/main/java/org/apache/ambari/server/orm/DBAccessorImpl.java 329fea8 
  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RoleAuthorizationDAO.java e549416

  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog230.java eb5feb7

  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java f2055a6

  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog230Test.java
417cf66 

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


Testing
-------

Manually tested

# Local test results: 

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:01:54.942s
[INFO] Finished at: Tue Feb 23 17:37:32 EST 2016
[INFO] Final Memory: 70M/604M
[INFO] ------------------------------------------------------------------------

# Jenkins test results: PENDING


Thanks,

Robert Levas


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