next_cfg updates are used as a way to know if transaction with sb got poperly
committed.
Before this patch, next_cfg was only updated if ovsdb_idl_loop_commit_and_wait
returned
TXN_SUCCESS, i.e. if there was not new transaction in fly.
We might have had the following case:
- Loop 1: - A transaction is sent; ovsdb_idl_loop_commit_and_wait return -1
(in_progress).
- Loop 2: - The transaction completes (in ovsdb_idl_loop_run), and a new
transaction is sent.
- ovsdb_idl_loop_commit_and_wait return -1 (new txn is in_progress).
- next_cfg was not updated despite the fact that the first
transaction succeeded.
Note that next_cfg is (still) updated when there is no commit in fly, and no
transaction occurs
in the loop.
Fixes: a6b0007918f4 ("controller: Remove only commited virtual port binding
requests.")
Signed-off-by: Xavier Simonart <[email protected]>
Signed-off-by: Ales Musil <[email protected]>
---
controller/ovn-controller.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index eb47ce082..bb7d6c3b2 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -5495,6 +5495,16 @@ br_int_remote_update(struct br_int_remote *remote,
remote->probe_interval = MIN(probe_interval / 1000, INT_MAX);
}
+static void
+ovsdb_idl_loop_next_cfg_inc(struct ovsdb_idl_loop *idl_loop)
+{
+ if (idl_loop->next_cfg == INT64_MAX) {
+ idl_loop->next_cfg = 0;
+ } else {
+ idl_loop->next_cfg++;
+ }
+}
+
int
main(int argc, char *argv[])
{
@@ -6117,6 +6127,7 @@ main(int argc, char *argv[])
VLOG_INFO("OVN internal version is : [%s]", ovn_version);
/* Main loop. */
+ int ovnsb_txn_status = 1;
bool sb_monitor_all = false;
struct tracked_acl_ids *tracked_acl_ids = NULL;
while (!exit_args.exiting) {
@@ -6167,6 +6178,9 @@ main(int argc, char *argv[])
= ovsdb_idl_loop_run(&ovnsb_idl_loop);
unsigned int new_ovnsb_cond_seqno
= ovsdb_idl_get_condition_seqno(ovnsb_idl_loop.idl);
+ if (ovnsb_idl_txn && ovnsb_txn_status == -1) {
+ ovsdb_idl_loop_next_cfg_inc(&ovnsb_idl_loop);
+ }
if (new_ovnsb_cond_seqno != ovnsb_cond_seqno) {
if (!new_ovnsb_cond_seqno) {
VLOG_INFO("OVNSB IDL reconnected, force recompute.");
@@ -6600,16 +6614,12 @@ main(int argc, char *argv[])
poll_immediate_wake();
}
- int ovnsb_txn_status = ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop);
+ ovnsb_txn_status = ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop);
if (!ovnsb_txn_status) {
VLOG_INFO("OVNSB commit failed, force recompute next time.");
engine_set_force_recompute_immediate();
} else if (ovnsb_txn_status == 1) {
- if (ovnsb_idl_loop.next_cfg == INT64_MAX) {
- ovnsb_idl_loop.next_cfg = 0;
- } else {
- ovnsb_idl_loop.next_cfg++;
- }
+ ovsdb_idl_loop_next_cfg_inc(&ovnsb_idl_loop);
} else if (ovnsb_txn_status == -1) {
/* The commit is still in progress */
} else {
--
2.47.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev