ovs-vsctl: Fix performance problem.
authorBen Pfaff <blp@nicira.com>
Wed, 9 Dec 2009 21:29:02 +0000 (13:29 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 9 Dec 2009 21:29:02 +0000 (13:29 -0800)
lib/ovsdb-idl.c
lib/ovsdb-idl.h
tests/test-ovsdb.c
utilities/ovs-vsctl.c

index 9bb1201..e0c5406 100644 (file)
@@ -28,6 +28,7 @@
 #include "ovsdb-data.h"
 #include "ovsdb-error.h"
 #include "ovsdb-idl-provider.h"
+#include "poll-loop.h"
 #include "shash.h"
 #include "util.h"
 
@@ -800,6 +801,14 @@ ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *txn)
     free(txn);
 }
 
+void
+ovsdb_idl_txn_wait(const struct ovsdb_idl_txn *txn)
+{
+    if (txn->status != TXN_INCOMPLETE) {
+        poll_immediate_wake();
+    }
+}
+
 static struct json *
 where_uuid_equals(const struct uuid *uuid)
 {
index cfc729e..5915a1b 100644 (file)
@@ -42,6 +42,7 @@ const char *ovsdb_idl_txn_status_to_string(enum ovsdb_idl_txn_status);
 
 struct ovsdb_idl_txn *ovsdb_idl_txn_create(struct ovsdb_idl *);
 void ovsdb_idl_txn_destroy(struct ovsdb_idl_txn *);
+void ovsdb_idl_txn_wait(const struct ovsdb_idl_txn *);
 enum ovsdb_idl_txn_status ovsdb_idl_txn_commit(struct ovsdb_idl_txn *);
 void ovsdb_idl_txn_abort(struct ovsdb_idl_txn *);
 
index 1f697b4..4f44afe 100644 (file)
@@ -1479,6 +1479,7 @@ idl_set(struct ovsdb_idl *idl, char *commands, int step)
     while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
         ovsdb_idl_run(idl);
         ovsdb_idl_wait(idl);
+        ovsdb_idl_txn_wait(txn);
         poll_block();
     }
     printf("%03d: commit, status=%s\n",
index d94308c..0f6abf3 100644 (file)
@@ -954,6 +954,7 @@ do_vsctl(int argc, char *argv[], struct ovsdb_idl *idl)
     while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
         ovsdb_idl_run(idl);
         ovsdb_idl_wait(idl);
+        ovsdb_idl_txn_wait(txn);
         poll_block();
     }
     ovsdb_idl_txn_destroy(txn);