Bug 848384

Summary: ORA-02049 (locking issue) during upgrade of AS7 plugin with Oracle
Product: [Other] RHQ Project Reporter: Jay Shaughnessy <jshaughn>
Component: Core ServerAssignee: Jay Shaughnessy <jshaughn>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: urgent Docs Contact:
Priority: high    
Version: 4.4CC: fbrychta, hrupp, jshaughn, mazz
Target Milestone: ---   
Target Release: RHQ 4.5.0   
Hardware: i386   
OS: All   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 846353 Environment:
Last Closed: 2013-09-01 06:03:58 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 846353    
Bug Blocks:    

Comment 1 Jay Shaughnessy 2012-08-15 09:15:59 EDT
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.
    - 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.
Comment 2 Heiko W. Rupp 2013-09-01 06:03:58 EDT
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.