instance_create() DB API method implicitly creates additional DB transactions

Bug #1362233 reported by Roman Podoliaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Roman Podoliaka
Icehouse
Fix Released
Undecided
Unassigned

Bug Description

In DB API code we have a notion of 'public' and 'private' methods. The former are conceptually executed within a *single* DB transaction and the latter can either create a new transaction or participate in the existing one. The whole point is to be able to roll back the results of DB API methods easily and be able to retry method calls on connection failures. We had a bp (https://blueprints.launchpad.net/nova/+spec/db-session-cleanup) in which all DB API have been re-factored to maintain these properties.

instance_create() is one of the methods that currently violates the rules of 'public' DB API methods and creates a concurrent transaction implicitly.

Changed in nova:
assignee: nobody → Roman Podoliaka (rpodolyaka)
Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/115255
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=dbc46b99cc85402c087bb214c120bce2c65dfea9
Submitter: Jenkins
Branch: master

commit dbc46b99cc85402c087bb214c120bce2c65dfea9
Author: Roman Podoliaka <email address hidden>
Date: Tue Aug 19 14:05:50 2014 +0300

    Add _security_group_ensure_default() DBAPI method

    According to the convention we use for DB API methods, every public
    method should have a private counterpart. The difference between
    those two is that the latter accepts an optional 'session' argument,
    which makes it possible for the method to participate in the existing
    database transaction.

    security_group_ensure_default() was called inside instance_create()
    and thus implicitly created a new concurrent db transaction, which
    is now fixed by making a call to a private counterpart and passing
    the session instance.

    Closes-Bug: #1362233

    Change-Id: Ifa1b6430328fde1ab0984f726bd8392bbd3f7ee5

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-rc1 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/134928

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/icehouse)

Reviewed: https://review.openstack.org/134928
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f78165661e5ce0bd7287124b75f6c60845b9a3c1
Submitter: Jenkins
Branch: stable/icehouse

commit f78165661e5ce0bd7287124b75f6c60845b9a3c1
Author: Roman Podoliaka <email address hidden>
Date: Tue Aug 19 14:05:50 2014 +0300

    Add _security_group_ensure_default() DBAPI method

    According to the convention we use for DB API methods, every public
    method should have a private counterpart. The difference between
    those two is that the latter accepts an optional 'session' argument,
    which makes it possible for the method to participate in the existing
    database transaction.

    security_group_ensure_default() was called inside instance_create()
    and thus implicitly created a new concurrent db transaction, which
    is now fixed by making a call to a private counterpart and passing
    the session instance.

    Closes-Bug: #1362233

    Change-Id: Ifa1b6430328fde1ab0984f726bd8392bbd3f7ee5
    (cherry picked from commit dbc46b99cc85402c087bb214c120bce2c65dfea9)

tags: added: in-stable-icehouse
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.