Description of problem: When attempting to delete a bundle deployment from a destination that has multiple bundle deployments, the deletion fails if the target deployment isn't the latest. Version-Release number of selected component (if applicable): 3.1.2.GA How reproducible: Always Steps to Reproduce: 1. Start JBoss ON 3.1.2 system. 2. Commit _platform_ resource to inventory. 3. Create _compatible resource group_ that contains the _platform_ resource. 4. Create _provisioning bundle_ using `helloworld-bundle.zip`. 5. Deploy _helloworld-bundle_ to a destination: * *Destination Name*: `TestDestination` * *Resource Group*: _Platform Resources_ * *Deployment Directory*: `/tmp/helloworld-TestDestination` * *Deploy Options*: _Latest Version [1.0]_ 6. Select _TestDestination_ from the _helloworld-bundle_ navigation tree. 7. Click the _Deploy_ button: * *Deploy Options*: _Latest Version [1.0]_ 8. Select _Deployment [1] of Version [1.0] to [TestDestination]_ from the _helloworld-bundle_ navigation tree. 9. From the summary panel, click the _Delete_ button. 10. Select _Yes_ when prompted to confirm deletion of the bundle deployment. Actual results: Message: Failed to delete the bundle deployment [Deployment [1] of Version [1.0] to [TestDestination]] Server log contains: WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 23503 ERROR [org.hibernate.util.JDBCExceptionReporter] Batch entry 0 delete from RHQ_BUNDLE_DEPLOYMENT where ID='10041' was aborted. Call getNextException to see the cause. WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 23503 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: update or delete on table "rhq_bundle_deployment" violates foreign key constraint "rhq_bundle_deployment_replaced_bundle_deployment_id_fkey" on table "rhq_bundle_deployment" Detail: Key (id)=(10041) is still referenced from table "rhq_bundle_deployment". ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:254) ... Caused by: java.sql.BatchUpdateException: Batch entry 0 delete from RHQ_BUNDLE_DEPLOYMENT where ID='10041' was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737) ... Expected results: Deletion should be successful Additional info: It seems that the child constraint is due to the latest or live deployment referencing the previous version. This is actually true for all versions. It is like a linked list. The only deployment that doesn't reference another is the first one of the destination. What this means is that you can always delete the latest because it isn't referenced by any other deployment. However, this defeats the purpose of cleaning out the old database entries.
branch: master link: http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=08b1215bd time: 2014-02-14 19:13:59 +0100 commit: 08b1215bd377333c118b7dce88c09b30f37de409 author: Jirka Kremser - jkremser message: [BZ 1040712] - Attempting to delete a previous bundle deployment from a destination fails due to database foreign key constraint violation - Redirecting the reference of replaced bundle to the doomed one (just like removing a element from a linked list). Adding an itest for this use case.
branch: master link: http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=c52692223 time: 2014-02-14 23:26:56 +0100 commit: c52692223c019967238adb531c23114cf2991850 author: Jirka Kremser - jkremser message: [BZ 1040712] - Attempting to delete a previous bundle deployment from a destination fails due to database foreign key constraint violation - Removing an unused finder constant.
commits in release branch: 32091e4e94f8afe6571684933690c93e59f4b393 06d3d6daa19a1548ff4294ca39d5ff957ec2d481
Moving to ON_QA as available for testing in the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=340294 Note: the installed version is still JON 3.2.0.GA by design and this represents part of the payload for JON 3.2.1 also known as cumulative patch 1 for 3.2.0.GA. How this will be delivered to customers is still being discussed.
verified JON 3.2.1 DR2
JON 3.2.1 released week of 5/5/2014