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

Dumitru Ceara dceara at redhat.com
Fri Mar 12 12:07:56 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>
---
 lib/ovsdb-idl.c    |    3 +++
 tests/ovsdb-idl.at |    1 +
 2 files changed, 4 insertions(+)

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 1542da9..9f8378a 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -196,6 +196,8 @@ static void ovsdb_idl_remove_from_indexes(const struct ovsdb_idl_row *);
 static int ovsdb_idl_try_commit_loop_txn(struct ovsdb_idl_loop *loop,
                                          bool *may_need_wakeup);
 
+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
@@ -1380,6 +1382,7 @@ ovsdb_idl_process_orphans(struct ovsdb_idl *db)
 
     LIST_FOR_EACH_SAFE (row, next, track_node, &db->orphan_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 7ac3c20..38f1020 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



More information about the dev mailing list