[ovs-dev] [PATCH ovn 2/3] ovn-northd: Don't trigger recompute for transactions that are in progress.

Dumitru Ceara dceara at redhat.com
Fri Nov 19 15:56:22 UTC 2021


Most of the times ovsdb_idl_loop_commit_and_wait() will return -1
indicating that the newly initiated transaction is still in progress.

That's not an error condition and it shouldn't trigger a forced
recompute.  Moreover, arguably, we shouldn't clear tracked rows only
when the transaction is successful.  We should probably do it
unconditionally in every iteration, to avoid processing the same update
twice.

Fixes: 4597317f16d1 ("northd: Introduce incremental processing for northd")
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
---
 northd/ovn-northd.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 5bbfa03df..2b58bfcec 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -1112,18 +1112,20 @@ main(int argc, char *argv[])
         }
 
         /* If there are any errors, we force a full recompute in order to
-           ensure we handle any new tracked changes. */
-        if (ovsdb_idl_loop_commit_and_wait(&ovnnb_idl_loop) != 1) {
+           ensure we handle all changes. */
+        if (!ovsdb_idl_loop_commit_and_wait(&ovnnb_idl_loop)) {
+            VLOG_INFO("OVNNB commit failed, force recompute next time.");
             recompute = true;
-        } else  {
-            ovsdb_idl_track_clear(ovnnb_idl_loop.idl);
         }
-        if (ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop) != 1) {
+
+        if (!ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop)) {
+            VLOG_INFO("OVNSB commit failed, force recompute next time.");
             recompute = true;
-        } else {
-            ovsdb_idl_track_clear(ovnsb_idl_loop.idl);
         }
 
+        ovsdb_idl_track_clear(ovnnb_idl_loop.idl);
+        ovsdb_idl_track_clear(ovnsb_idl_loop.idl);
+
         unixctl_server_run(unixctl);
         unixctl_server_wait(unixctl);
         memory_wait();



More information about the dev mailing list