[ovs-dev] [PATCH branch-2.13 4/4] ovsdb-idl: Mark arc sources as updated when destination is deleted.

Dumitru Ceara dceara at redhat.com
Fri Apr 2 15:49:34 UTC 2021


Considering two DB rows, 'a' from table A and 'b' from table B (with
column 'ref_a' a reference to table A):
a = {A._uuid=<U1>}
b = {B._uuid=<U2>, B.ref_a=<U1>}

When the IDL client processes an update that deletes row 'a', row 'b'
is also marked as 'updated' if change tracking is enabled for table B.

Fixes: 102781cc02c6 ("ovsdb-idl: Track changes for table references.")
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
Acked-by: Han Zhou <hzhou at ovn.org>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
(cherry picked from commit ac85cdb38c1f33e7952bc4c0347d6c7873fb56a1)
---
 lib/ovsdb-idl.c    |    3 +++
 tests/ovsdb-idl.at |    2 ++
 2 files changed, 5 insertions(+)

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index d6439a2151..2fc8a91e37 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -445,6 +445,8 @@ ovsdb_idl_db_init(struct ovsdb_idl_db *db, const struct ovsdb_idl_class *class,
     ovs_list_init(&db->deleted_untracked_rows);
 }
 
+static void add_tracked_change_for_references(struct ovsdb_idl_row *);
+
 /* Creates and returns a connection to database 'remote', which should be in a
  * form acceptable to jsonrpc_session_open().  The connection will maintain an
  * in-memory replica of the remote database whose schema is described by
@@ -2561,6 +2563,7 @@ ovsdb_idl_reparse_deleted(struct ovsdb_idl_db *db)
 
     LIST_FOR_EACH_SAFE (row, next, track_node, &db->deleted_untracked_rows) {
         ovsdb_idl_row_untrack_change(row);
+        add_tracked_change_for_references(row);
         ovsdb_idl_row_reparse_backrefs(row);
 
         /* Orphan rows that are still unreferenced or are part of tables that
diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at
index 97c3ff5d76..a1daf9a137 100644
--- a/tests/ovsdb-idl.at
+++ b/tests/ovsdb-idl.at
@@ -1286,6 +1286,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, orphan rows, cond
 003: table simple: inserted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
 003: table simple: updated columns: s
 004: change conditions
+005: table simple6: name=first_row weak_ref=[] uuid=<0>
 005: table simple: deleted row: i=0 r=0 b=false s=row0_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<1>
 005: table simple: inserted row: i=0 r=0 b=false s=row1_s u=<2> ia=[] ra=[] ba=[] sa=[] ua=[] uuid=<3>
 005: table simple: updated columns: s
@@ -1497,6 +1498,7 @@ OVSDB_CHECK_IDL_TRACK([track, simple idl, initially populated, strong references
 001: table simple4: inserted row: name=row0_s4 uuid=<0>
 001: table simple4: updated columns: name
 002: change conditions
+003: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1>
 003: table simple4: deleted row: name=row0_s4 uuid=<0>
 004: {"error":null,"result":[{"uuid":["uuid","<2>"]}]}
 005: table simple3: name=row0_s3 uset=[] uref=[] uuid=<1>



More information about the dev mailing list