master commit c9eb53bb8dab7393d9b5383fbe5bab99088487ed After a lot of investigation it seems that the problem occurs occasionally when we remove obsolete properties from resource configuration. It does not happen every time, in fact it's fairly rare, although for the same DB, and the same plugin update, it is repeatable. This makes it seem like the locking issue is due mainly to unpredictable locking at the db level, and likely the fact that we occasionally hit a page lock due to some other prior update to the config table. Since the config table stores so many different types of data it's not obvious how we would identify the conflict. The approach taken was to try and reduce possible conflict by increasing the granularity of metadata update transactions. Prior to this change we used a single encompassing transaction for a plugin update, that means all types were updated under one umbrella transaction. Not one transaction, because we already use nested transactions in several places, but using one umbrella transaction increases the chance of that transaction holding a lock that could affect a nested transaction. We still maintain the umbrella transaction but this commit breaks it up such that a nested transaction is used for the update of each resource type in the plugin. That means each type update will not hold any locks when it has completed. This change seems to be working as the AS7 plugin now updates successfully. Additionally: - added some more INFO level logging to give some basic progress during a plugin update. - added some more debug logging as well - removed a bunch of unnecessary em.flush calls - used the return value of some em.merge calls to ensure using the up to date entity. Test Notes: Upgrades of as many plugin plugins as possible from older versions to latest (4.5 versions) for oracle and postgres. If possible, data in inventory will make the test even more robust, although it was not necessary for the original issue.
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.