@@ -441,11 +441,21 @@ ovsdb_idl_clear(struct ovsdb_idl *db)
* ovsdb_idl_get_seqno(). */
void
ovsdb_idl_run(struct ovsdb_idl *idl)
+{
+ ovsdb_idl_run_until(idl, 0);
+}
+
+void
+ovsdb_idl_run_until(struct ovsdb_idl *idl, long long deadline)
{
ovs_assert(!idl->txn);
struct ovs_list events;
- ovsdb_cs_run(idl->cs, &events);
+ if (deadline) {
+ ovsdb_cs_run_until(idl->cs, &events, deadline);
+ } else {
+ ovsdb_cs_run(idl->cs, &events);
+ }
struct ovsdb_cs_event *event;
LIST_FOR_EACH_POP (event, list_node, &events) {
@@ -4374,7 +4384,17 @@ ovsdb_idl_loop_destroy(struct ovsdb_idl_loop *loop)
struct ovsdb_idl_txn *
ovsdb_idl_loop_run(struct ovsdb_idl_loop *loop)
{
- ovsdb_idl_run(loop->idl);
+ return ovsdb_idl_loop_run_until(loop, 0);
+}
+
+struct ovsdb_idl_txn *
+ovsdb_idl_loop_run_until(struct ovsdb_idl_loop *loop, long long deadline)
+{
+ if (deadline) {
+ ovsdb_idl_run_until(loop->idl, deadline);
+ } else {
+ ovsdb_idl_run(loop->idl);
+ }
/* See if the 'committing_txn' succeeded in the meantime. */
if (loop->committing_txn && loop->committing_txn->status == TXN_SUCCESS) {
@@ -74,6 +74,7 @@ void ovsdb_idl_destroy(struct ovsdb_idl *);
void ovsdb_idl_set_leader_only(struct ovsdb_idl *, bool leader_only);
void ovsdb_idl_run(struct ovsdb_idl *);
+void ovsdb_idl_run_until(struct ovsdb_idl *, long long);
void ovsdb_idl_wait(struct ovsdb_idl *);
void ovsdb_idl_get_memory_usage(struct ovsdb_idl *, struct simap *usage);
@@ -409,6 +410,8 @@ struct ovsdb_idl_loop {
void ovsdb_idl_loop_destroy(struct ovsdb_idl_loop *);
struct ovsdb_idl_txn *ovsdb_idl_loop_run(struct ovsdb_idl_loop *);
+struct ovsdb_idl_txn *ovsdb_idl_loop_run_until(struct ovsdb_idl_loop *,
+ long long);
int ovsdb_idl_loop_commit_and_wait(struct ovsdb_idl_loop *);
/* Conditional Replication
Add timing based variants of ovsdb_idl_run() and ovsdb_idl_loop_run(), which accept an additional 'deadline' parameter. This parameter instructs the ovsdb-cs and jsonrpc layers below to process messages as long as the deadline isn't reached, allowing clients to process more OVSDB updates in one batch. Signed-off-by: Martin Morgenstern <martin.morgenstern@cloudandheat.com> --- lib/ovsdb-idl.c | 24 ++++++++++++++++++++++-- lib/ovsdb-idl.h | 3 +++ 2 files changed, 25 insertions(+), 2 deletions(-)