``ovn_revision_bumbers_db._ensure_revision_row_exist`` is mixing DB contexts

Bug #1975837 reported by Rodolfo Alonso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Rodolfo Alonso

Bug Description

The method ``ovn_revision_bumbers_db._ensure_revision_row_exist`` creates a DB reader decorator to check if the "OVNRevisionNumbers" register exists, based on the resource ID. If it doesn't, the method calls ``create_initial_revision``, that creates a DB writer context inside the reader one.

In older versions (networking-ovn Train for example), the error is even worst, as described in [1]. Inside the DB reader context we catch a DB exception without ending this transaction or rolling back. Then we call the ``create_initial_revision`` method, opening a new write context inside the reader one.

Related Bugzilla: [1]

[1]https://bugzilla.redhat.com/show_bug.cgi?id=2090757

Changed in neutron:
assignee: nobody → Rodolfo Alonso (rodolfo-alonso-hernandez)
importance: Undecided → High
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/843478

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/neutron/+/843480

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/neutron/+/843481

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/neutron/+/843482

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/neutron/+/843484

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/neutron/+/843485

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

Reviewed: https://review.opendev.org/c/openstack/neutron/+/843480
Committed: https://opendev.org/openstack/neutron/commit/e2a2cc243f1c103dd3643592ec04ca9635774a4d
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit e2a2cc243f1c103dd3643592ec04ca9635774a4d
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sun May 15 01:28:32 2022 +0000

    Refactor the OVN revision module to access the DB correctly

    Method ``_ensure_revision_row_exist`` creates a DB reader context
    when called from ``bump_revision``. This call is always done from
    inside a DB write context. This method removes the unneded reader
    context.

    Closes-Bug: #1975837
    Change-Id: Ifb500eef5513e930bf3a22d99183ca348e5fc427
    (cherry picked from commit 39d751a33265e8780828b3aca10a781726d0a300)

tags: added: in-stable-yoga
tags: added: in-stable-xena
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/xena)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/843481
Committed: https://opendev.org/openstack/neutron/commit/40433a081f1bfd18b5ab1138347987e2c2e9da28
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 40433a081f1bfd18b5ab1138347987e2c2e9da28
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sun May 15 01:28:32 2022 +0000

    Refactor the OVN revision module to access the DB correctly

    Method ``_ensure_revision_row_exist`` creates a DB reader context
    when called from ``bump_revision``. This call is always done from
    inside a DB write context. This method removes the unneded reader
    context.

    Closes-Bug: #1975837
    Change-Id: Ifb500eef5513e930bf3a22d99183ca348e5fc427
    (cherry picked from commit 39d751a33265e8780828b3aca10a781726d0a300)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/843478
Committed: https://opendev.org/openstack/neutron/commit/39d751a33265e8780828b3aca10a781726d0a300
Submitter: "Zuul (22348)"
Branch: master

commit 39d751a33265e8780828b3aca10a781726d0a300
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sun May 15 01:28:32 2022 +0000

    Refactor the OVN revision module to access the DB correctly

    Method ``_ensure_revision_row_exist`` creates a DB reader context
    when called from ``bump_revision``. This call is always done from
    inside a DB write context. This method removes the unneded reader
    context.

    Closes-Bug: #1975837
    Change-Id: Ifb500eef5513e930bf3a22d99183ca348e5fc427

Changed in neutron:
status: In Progress → Fix Released
tags: added: ovn
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/843482
Committed: https://opendev.org/openstack/neutron/commit/51f277f7e728c4f1acfb647571ab5604e7a5cbfc
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 51f277f7e728c4f1acfb647571ab5604e7a5cbfc
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sun May 15 01:28:32 2022 +0000

    Refactor the OVN revision module to access the DB correctly

    Method ``_ensure_revision_row_exist`` creates a DB reader context
    when called from ``bump_revision``. This call is always done from
    inside a DB write context. This method removes the unneded reader
    context.

    Closes-Bug: #1975837
    Change-Id: Ifb500eef5513e930bf3a22d99183ca348e5fc427
    (cherry picked from commit 39d751a33265e8780828b3aca10a781726d0a300)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/843484
Committed: https://opendev.org/openstack/neutron/commit/41a3bf7f0faed846dceb09e614553fc82fae476b
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit 41a3bf7f0faed846dceb09e614553fc82fae476b
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sun May 15 01:28:32 2022 +0000

    Refactor the OVN revision module to access the DB correctly

    Method ``_ensure_revision_row_exist`` creates a DB reader context
    when called from ``bump_revision``. This call is always done from
    inside a DB write context. This method removes the unneded reader
    context.

    Conflicts:
        neutron/db/ovn_revision_numbers_db.py

    Closes-Bug: #1975837
    Change-Id: Ifb500eef5513e930bf3a22d99183ca348e5fc427
    (cherry picked from commit 39d751a33265e8780828b3aca10a781726d0a300)

tags: added: in-stable-victoria
tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/843485
Committed: https://opendev.org/openstack/neutron/commit/ef61c09c29b633eefcc5f47da480697b8e1e0b47
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit ef61c09c29b633eefcc5f47da480697b8e1e0b47
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Sun May 15 01:28:32 2022 +0000

    Refactor the OVN revision module to access the DB correctly

    Method ``_ensure_revision_row_exist`` creates a DB reader context
    when called from ``bump_revision``. This call is always done from
    inside a DB write context. This method removes the unneded reader
    context.

    Conflicts:
        neutron/db/ovn_revision_numbers_db.py

    Closes-Bug: #1975837
    Change-Id: Ifb500eef5513e930bf3a22d99183ca348e5fc427
    (cherry picked from commit 39d751a33265e8780828b3aca10a781726d0a300)
    (cherry picked from commit 41a3bf7f0faed846dceb09e614553fc82fae476b)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 18.5.0

This issue was fixed in the openstack/neutron 18.5.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 19.4.0

This issue was fixed in the openstack/neutron 19.4.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 20.2.0

This issue was fixed in the openstack/neutron 20.2.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 21.0.0.0rc1

This issue was fixed in the openstack/neutron 21.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/networking-ovn train-eol

This issue was fixed in the openstack/networking-ovn train-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron ussuri-eol

This issue was fixed in the openstack/neutron ussuri-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron victoria-eom

This issue was fixed in the openstack/neutron victoria-eom release.

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.