diff mbox

[ovs-dev,02/30] ovsdb-idl: Wake up ovsdb_idl_loop when a transaction commits.

Message ID 1470642309-18995-3-git-send-email-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff Aug. 8, 2016, 7:44 a.m. UTC
There is a fair amount of code that defers modifying the database when a
transaction cannot be created (because there is already one outstanding).
This code tends to assume that the main loop will wake up again when it
becomes possible again to modify the database, but the actual ovsdb_id_loop
implementation only did this if the database had changed.  This is too
conservative a policy and may account for some failures I've seen in tests.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 lib/ovsdb-idl.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Ryan Moats Aug. 8, 2016, 3:20 p.m. UTC | #1
"dev" <dev-bounces@openvswitch.org> wrote on 08/08/2016 02:44:41 AM:

> From: Ben Pfaff <blp@ovn.org>
> To: dev@openvswitch.org
> Cc: Ben Pfaff <blp@ovn.org>
> Date: 08/08/2016 02:45 AM
> Subject: [ovs-dev] [PATCH 02/30] ovsdb-idl: Wake up ovsdb_idl_loop
> when a transaction commits.
> Sent by: "dev" <dev-bounces@openvswitch.org>
>
> There is a fair amount of code that defers modifying the database when a
> transaction cannot be created (because there is already one outstanding).
> This code tends to assume that the main loop will wake up again when it
> becomes possible again to modify the database, but the actual
ovsdb_id_loop
> implementation only did this if the database had changed.  This is too
> conservative a policy and may account for some failures I've seen in
tests.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---

Ok, I get it now...

Acked-by: Ryan Moats <rmoats@us.ibm.com>
diff mbox

Patch

diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 816cc70..38110c9 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -3712,13 +3712,10 @@  ovsdb_idl_loop_commit_and_wait(struct ovsdb_idl_loop *loop)
                 break;
 
             case TXN_SUCCESS:
-                /* If the database has already changed since we started the
-                 * commit, re-evaluate it immediately to avoid missing a change
-                 * for a while. */
+                /* Possibly some work on the database was deferred because no
+                 * further transaction could proceed.  Wake up again. */
                 loop->cur_cfg = loop->next_cfg;
-                if (ovsdb_idl_get_seqno(loop->idl) != loop->precommit_seqno) {
-                    poll_immediate_wake();
-                }
+                poll_immediate_wake();
                 break;
 
             case TXN_UNCHANGED: