diff mbox series

[ovs-dev,2/5] ovsdb: raft: Fix time intervals for multitasking while joining.

Message ID 20240315201614.236523-3-i.maximets@ovn.org
State Superseded
Headers show
Series ovsdb: raft: Fixes for cluster joining state. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets March 15, 2024, 8:14 p.m. UTC
While joining, ovsdb-server may not wake up for a duration of a join
timer, which is 1 second and is by default 3x larger than a heartbeat
timer.  This is causing unnecessary warnings from the cooperative
multitasking module that thinks that we missed the heartbeat time by
a lot.

Use join timer (1000) instead while joining.

Fixes: d4a15647b917 ("ovsdb: raft: Enable cooperative multitasking.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---

CC: Frode Nordahl <frode.nordahl@canonical.com>

 ovsdb/raft.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Han Zhou March 26, 2024, 4:29 a.m. UTC | #1
On Fri, Mar 15, 2024 at 1:15 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> While joining, ovsdb-server may not wake up for a duration of a join
> timer, which is 1 second and is by default 3x larger than a heartbeat
> timer.  This is causing unnecessary warnings from the cooperative
> multitasking module that thinks that we missed the heartbeat time by
> a lot.
>
> Use join timer (1000) instead while joining.
>
> Fixes: d4a15647b917 ("ovsdb: raft: Enable cooperative multitasking.")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>
> CC: Frode Nordahl <frode.nordahl@canonical.com>
>
>  ovsdb/raft.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/ovsdb/raft.c b/ovsdb/raft.c
> index 25f462431..57e27bf73 100644
> --- a/ovsdb/raft.c
> +++ b/ovsdb/raft.c
> @@ -2126,10 +2126,11 @@ raft_run(struct raft *raft)
>          raft_reset_ping_timer(raft);
>      }
>
> +    uint64_t interval = raft->joining
> +                        ? 1000 :
RAFT_TIMER_THRESHOLD(raft->election_timer);

nit: the hardcoded joining timer value 1000 is used at least 3 places, so
probably better to define a macro for it.

Acked-by: Han Zhou <hzhou@ovn.org>

>      cooperative_multitasking_set(
>          &raft_run_cb, (void *) raft, time_msec(),
> -        RAFT_TIMER_THRESHOLD(raft->election_timer)
> -        + RAFT_TIMER_THRESHOLD(raft->election_timer) / 10, "raft_run");
> +        interval + interval / 10, "raft_run");
>
>      /* Do this only at the end; if we did it as soon as we set
raft->left or
>       * raft->failed in handling the RemoveServerReply, then it could
easily
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 25f462431..57e27bf73 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -2126,10 +2126,11 @@  raft_run(struct raft *raft)
         raft_reset_ping_timer(raft);
     }
 
+    uint64_t interval = raft->joining
+                        ? 1000 : RAFT_TIMER_THRESHOLD(raft->election_timer);
     cooperative_multitasking_set(
         &raft_run_cb, (void *) raft, time_msec(),
-        RAFT_TIMER_THRESHOLD(raft->election_timer)
-        + RAFT_TIMER_THRESHOLD(raft->election_timer) / 10, "raft_run");
+        interval + interval / 10, "raft_run");
 
     /* Do this only at the end; if we did it as soon as we set raft->left or
      * raft->failed in handling the RemoveServerReply, then it could easily