diff options
author | Dumitru Ceara <dceara@redhat.com> | 2021-11-26 13:26:22 +0100 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-11-30 13:44:47 +0100 |
commit | 91e1ff5dde396fbcc8623ac0726066e970e6de15 (patch) | |
tree | 5284ade9160f0a450dbda585809086eabd8c055a | |
parent | 149169836d16146653472e54a54f6e755169cc20 (diff) | |
download | openvswitch-91e1ff5dde396fbcc8623ac0726066e970e6de15.tar.gz |
ovsdb-idl: Don't reparse orphaned rows.
Rows that refer to rows that were inserted in the current IDL run should
only be reparsed if they don't get deleted (become orphan) in the current
IDL run.
Fixes: 7b8aeadd60c8 ("ovsdb-idl: Re-parse backrefs of inserted rows only once.")
Reported-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/ovsdb-idl.c | 7 | ||||
-rw-r--r-- | tests/ovsdb-idl.at | 26 |
2 files changed, 32 insertions, 1 deletions
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index a6323d2b8..b7ba25eca 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -1506,10 +1506,15 @@ ovsdb_idl_reparse_refs_to_inserted(struct ovsdb_idl *db) struct ovsdb_idl_row *row; LIST_FOR_EACH_POP (row, reparse_node, &db->rows_to_reparse) { + ovs_list_init(&row->reparse_node); + + /* Skip rows that have been deleted in the meantime. */ + if (ovsdb_idl_row_is_orphan(row)) { + continue; + } ovsdb_idl_row_unparse(row); ovsdb_idl_row_clear_arcs(row, false); ovsdb_idl_row_parse(row); - ovs_list_init(&row->reparse_node); } } diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 0f229b2f9..3adb9d638 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -1540,6 +1540,32 @@ OVSDB_CHECK_IDL([simple idl, initially populated, strong references, conditional 006: done ]]) +dnl This test checks that deleting a row that refers to a row that was inserted +dnl in the current IDL run works properly. +OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, strong references, insert and delete], + [], + [['["idltest", + {"op": "insert", + "table": "link1", + "uuid-name": "uuid_l1", + "row": {"i": 1, "k": ["named-uuid", "uuid_l1"]}}, + {"op": "insert", + "table": "link2", + "row": {"i": 2, "l1": ["set", [["named-uuid", "uuid_l1"]]]}} + ]' \ + '+["idltest", + {"op": "delete", + "table": "link2", + "where": [["i", "==", 2]]}]' + ]], + [[000: empty +001: {"error":null,"result":[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}]} +002: {"error":null,"result":[{"count":1}]} +003: table link1: inserted row: i=1 k=1 ka=[] l2= uuid=<0> +003: table link1: updated columns: i k +004: done +]]) + OVSDB_CHECK_IDL_TRACK([track, simple idl, initially empty, various ops], [], [['["idltest", |