Skip to content

Commit

Permalink
ovsdb-idl: Fix expected condition seqno when changes are pending.
Browse files Browse the repository at this point in the history
Commit 17f22fe tried to address this but only covered some of the
cases.

The correct way to report the expected seqno is to take into account if
there already is a condition change that was requested to the server but
not acked yet.  In that case, the new condition change request will be
sent only after the already requested one is acked.  That is, expected
condition seqno when conditions are up to date is db->cond_seqno + 2 in
this case.

Fixes: 17f22fe ("ovsdb-idl: Return correct seqno from ovsdb_idl_db_set_condition().")
Suggested-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
dceara authored and igsilya committed Dec 4, 2020
1 parent 35454eb commit 97dbef6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/ovsdb-idl.c
Expand Up @@ -1564,6 +1564,7 @@ ovsdb_idl_db_set_condition(struct ovsdb_idl_db *db,
{
struct ovsdb_idl_condition *table_cond;
struct ovsdb_idl_table *table = ovsdb_idl_db_table_from_class(db, tc);
unsigned int curr_seqno = db->cond_seqno;

/* Compare the new condition to the last known condition which can be
* either "new" (not sent yet), "requested" or "acked", in this order.
Expand All @@ -1581,14 +1582,11 @@ ovsdb_idl_db_set_condition(struct ovsdb_idl_db *db,
ovsdb_idl_condition_clone(&table->new_cond, condition);
db->cond_changed = true;
poll_immediate_wake();
return db->cond_seqno + 1;
} else if (table_cond != table->ack_cond) {
/* 'condition' was already set but has not been "acked" yet. The IDL
* will be up to date when db->cond_seqno gets incremented. */
return db->cond_seqno + 1;
}

return db->cond_seqno;
/* Conditions will be up to date when we receive replies for already
* requested and new conditions, if any. */
return curr_seqno + (table->new_cond ? 1 : 0) + (table->req_cond ? 1 : 0);
}

/* Sets the replication condition for 'tc' in 'idl' to 'condition' and
Expand Down

0 comments on commit 97dbef6

Please sign in to comment.