DbSetCommand on a map column can race

Bug #1867652 reported by Terry Wilson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ovsdbapp
Fix Released
Undecided
Unassigned

Bug Description

I do not have a concrete example of this happening, but calling db_set() on a map column will take the value that was set, update some keys, then write that value to the whole column. If something else has updated the same column, even though we may think we are just appending values, we will overwrite that existing change. The row.verify() method is used to detect that issue and retry the transaction after reading the update that we missed. We should be using setkey() but there is currently a bug with it for some columns which hopefully will be fixed with https://patchwork.ozlabs.org/patch/1254735/

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

Reviewed: https://review.opendev.org/713286
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=b92d8742bf3f5e436bcb9160618b343e3c4595fa
Submitter: Zuul
Branch: master

commit b92d8742bf3f5e436bcb9160618b343e3c4595fa
Author: Terry Wilson <email address hidden>
Date: Mon Mar 16 11:20:05 2020 -0500

    Call row.verify() when updating map columns with db_set

    The verify() method will ensure that if the row's column in the db
    has changed since we set it, that we will be notified and try the
    transaction again with new values. This is important when we do a
    read-update operation like we do for map columns in db_set. Since
    we read the values add a few keys, then overwrite the whole value,
    it is important that we don't do that if we have stale data.

    Since ovs 2.6, there has been a setkey() operation that would
    allow modifying a map w/o overwriting the whole value, but there
    is a bug where it doesn't handle maps that have a refTable value
    like Qos.queues. So using that before it is fixed [1] and all
    packages have picked it up would cause breakage.

    [1] https://patchwork.ozlabs.org/patch/1254735/

    Closes-bug: #1867652
    Change-Id: Ic898cefb4ced76e9e169b9f5d6caaace600abb0c

Changed in ovsdbapp:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ovsdbapp 1.1.0

This issue was fixed in the openstack/ovsdbapp 1.1.0 release.

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

Fix proposed to branch: stable/train
Review: https://review.opendev.org/718745

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

Reviewed: https://review.opendev.org/718745
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=5fec1d724461e24206e2c1f66ad6ba8e342d4879
Submitter: Zuul
Branch: stable/train

commit 5fec1d724461e24206e2c1f66ad6ba8e342d4879
Author: Terry Wilson <email address hidden>
Date: Mon Mar 16 11:20:05 2020 -0500

    Call row.verify() when updating map columns with db_set

    The verify() method will ensure that if the row's column in the db
    has changed since we set it, that we will be notified and try the
    transaction again with new values. This is important when we do a
    read-update operation like we do for map columns in db_set. Since
    we read the values add a few keys, then overwrite the whole value,
    it is important that we don't do that if we have stale data.

    Since ovs 2.6, there has been a setkey() operation that would
    allow modifying a map w/o overwriting the whole value, but there
    is a bug where it doesn't handle maps that have a refTable value
    like Qos.queues. So using that before it is fixed [1] and all
    packages have picked it up would cause breakage.

    [1] https://patchwork.ozlabs.org/patch/1254735/

    Closes-bug: #1867652
    Change-Id: Ic898cefb4ced76e9e169b9f5d6caaace600abb0c
    (cherry picked from commit b92d8742bf3f5e436bcb9160618b343e3c4595fa)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ovsdbapp (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/723713

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

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/723714

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

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/723715

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

Reviewed: https://review.opendev.org/723713
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=22a309e76981246da3b329b335c30ada570eda0b
Submitter: Zuul
Branch: stable/stein

commit 22a309e76981246da3b329b335c30ada570eda0b
Author: Terry Wilson <email address hidden>
Date: Mon Mar 16 11:20:05 2020 -0500

    Call row.verify() when updating map columns with db_set

    The verify() method will ensure that if the row's column in the db
    has changed since we set it, that we will be notified and try the
    transaction again with new values. This is important when we do a
    read-update operation like we do for map columns in db_set. Since
    we read the values add a few keys, then overwrite the whole value,
    it is important that we don't do that if we have stale data.

    Since ovs 2.6, there has been a setkey() operation that would
    allow modifying a map w/o overwriting the whole value, but there
    is a bug where it doesn't handle maps that have a refTable value
    like Qos.queues. So using that before it is fixed [1] and all
    packages have picked it up would cause breakage.

    [1] https://patchwork.ozlabs.org/patch/1254735/

    Closes-bug: #1867652
    Change-Id: Ic898cefb4ced76e9e169b9f5d6caaace600abb0c
    (cherry picked from commit b92d8742bf3f5e436bcb9160618b343e3c4595fa)
    (cherry picked from commit 5fec1d724461e24206e2c1f66ad6ba8e342d4879)

tags: added: in-stable-stein
tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ovsdbapp (stable/queens)

Reviewed: https://review.opendev.org/723715
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=e4ba59dcd54604d27e5be946ade9ee4f750f78dd
Submitter: Zuul
Branch: stable/queens

commit e4ba59dcd54604d27e5be946ade9ee4f750f78dd
Author: Terry Wilson <email address hidden>
Date: Mon Mar 16 11:20:05 2020 -0500

    Call row.verify() when updating map columns with db_set

    The verify() method will ensure that if the row's column in the db
    has changed since we set it, that we will be notified and try the
    transaction again with new values. This is important when we do a
    read-update operation like we do for map columns in db_set. Since
    we read the values add a few keys, then overwrite the whole value,
    it is important that we don't do that if we have stale data.

    Since ovs 2.6, there has been a setkey() operation that would
    allow modifying a map w/o overwriting the whole value, but there
    is a bug where it doesn't handle maps that have a refTable value
    like Qos.queues. So using that before it is fixed [1] and all
    packages have picked it up would cause breakage.

    [1] https://patchwork.ozlabs.org/patch/1254735/

    Closes-bug: #1867652
    Change-Id: Ic898cefb4ced76e9e169b9f5d6caaace600abb0c
    (cherry picked from commit b92d8742bf3f5e436bcb9160618b343e3c4595fa)
    (cherry picked from commit 5fec1d724461e24206e2c1f66ad6ba8e342d4879)

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

Reviewed: https://review.opendev.org/723714
Committed: https://git.openstack.org/cgit/openstack/ovsdbapp/commit/?id=3f4eb90968a3299ad50603266207cad9d98424e8
Submitter: Zuul
Branch: stable/rocky

commit 3f4eb90968a3299ad50603266207cad9d98424e8
Author: Terry Wilson <email address hidden>
Date: Mon Mar 16 11:20:05 2020 -0500

    Call row.verify() when updating map columns with db_set

    The verify() method will ensure that if the row's column in the db
    has changed since we set it, that we will be notified and try the
    transaction again with new values. This is important when we do a
    read-update operation like we do for map columns in db_set. Since
    we read the values add a few keys, then overwrite the whole value,
    it is important that we don't do that if we have stale data.

    Since ovs 2.6, there has been a setkey() operation that would
    allow modifying a map w/o overwriting the whole value, but there
    is a bug where it doesn't handle maps that have a refTable value
    like Qos.queues. So using that before it is fixed [1] and all
    packages have picked it up would cause breakage.

    [1] https://patchwork.ozlabs.org/patch/1254735/

    Closes-bug: #1867652
    Change-Id: Ic898cefb4ced76e9e169b9f5d6caaace600abb0c
    (cherry picked from commit b92d8742bf3f5e436bcb9160618b343e3c4595fa)
    (cherry picked from commit 5fec1d724461e24206e2c1f66ad6ba8e342d4879)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/ovsdbapp queens-eol

This issue was fixed in the openstack/ovsdbapp queens-eol release.

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

This issue was fixed in the openstack/ovsdbapp rocky-eol 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.