diff mbox series

[ovs-dev] raft: Report disconnected in cluster/status if candidate retries election.

Message ID 20210223131651.53640-1-i.maximets@ovn.org
State Accepted
Headers show
Series [ovs-dev] raft: Report disconnected in cluster/status if candidate retries election. | expand

Commit Message

Ilya Maximets Feb. 23, 2021, 1:16 p.m. UTC
If election times out for a server in 'candidate' role it sets
'candidate_retrying' flag that notifies that storage is disconnected
and client should re-connect.  However, cluster/status command
reports 'Status: cluster member' and that is misleading.
Reporting "disconnected from the cluster (election timeout)" instead.

Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 ovsdb/raft.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Han Zhou Feb. 25, 2021, 7:14 a.m. UTC | #1
On Tue, Feb 23, 2021 at 5:16 AM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> If election times out for a server in 'candidate' role it sets
> 'candidate_retrying' flag that notifies that storage is disconnected
> and client should re-connect.  However, cluster/status command
> reports 'Status: cluster member' and that is misleading.
> Reporting "disconnected from the cluster (election timeout)" instead.
>
> Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered
databases.")

candidate_retrying flag was introduced in a patch later than the above one
:)

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

> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>  ovsdb/raft.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/ovsdb/raft.c b/ovsdb/raft.c
> index 0fb1420fb..192f7f0a9 100644
> --- a/ovsdb/raft.c
> +++ b/ovsdb/raft.c
> @@ -4498,6 +4498,8 @@ raft_unixctl_status(struct unixctl_conn *conn,
>                    : raft->leaving ? "leaving cluster"
>                    : raft->left ? "left cluster"
>                    : raft->failed ? "failed"
> +                  : raft->candidate_retrying
> +                      ? "disconnected from the cluster (election
timeout)"
>                    : "cluster member");
>      if (raft->joining) {
>          ds_put_format(&s, "Remotes for joining:");
> --
> 2.26.2
>
Ilya Maximets Feb. 25, 2021, 1:01 p.m. UTC | #2
On 2/25/21 8:14 AM, Han Zhou wrote:
> 
> 
> On Tue, Feb 23, 2021 at 5:16 AM Ilya Maximets <i.maximets@ovn.org <mailto:i.maximets@ovn.org>> wrote:
>>
>> If election times out for a server in 'candidate' role it sets
>> 'candidate_retrying' flag that notifies that storage is disconnected
>> and client should re-connect.  However, cluster/status command
>> reports 'Status: cluster member' and that is misleading.
>> Reporting "disconnected from the cluster (election timeout)" instead.
>>
>> Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
> 
> candidate_retrying flag was introduced in a patch later than the above one :)

Yeah, I know. :)
But the same logic was there.  raft_is_connected() was 'false' for a
RAFT_CANDIDATE while cluster/status reported 'cluster member'.
TBH, I'm not going to backport that far anyway.

> 
> Acked-by: Han Zhou <hzhou@ovn.org <mailto:hzhou@ovn.org>>
> 
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org <mailto:i.maximets@ovn.org>>
>> ---
>>  ovsdb/raft.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/ovsdb/raft.c b/ovsdb/raft.c
>> index 0fb1420fb..192f7f0a9 100644
>> --- a/ovsdb/raft.c
>> +++ b/ovsdb/raft.c
>> @@ -4498,6 +4498,8 @@ raft_unixctl_status(struct unixctl_conn *conn,
>>                    : raft->leaving ? "leaving cluster"
>>                    : raft->left ? "left cluster"
>>                    : raft->failed ? "failed"
>> +                  : raft->candidate_retrying
>> +                      ? "disconnected from the cluster (election timeout)"
>>                    : "cluster member");
>>      if (raft->joining) {
>>          ds_put_format(&s, "Remotes for joining:");
>> --
>> 2.26.2
>>
Ilya Maximets March 1, 2021, 8:20 p.m. UTC | #3
On 2/25/21 8:14 AM, Han Zhou wrote:
> 
> 
> On Tue, Feb 23, 2021 at 5:16 AM Ilya Maximets <i.maximets@ovn.org <mailto:i.maximets@ovn.org>> wrote:
>>
>> If election times out for a server in 'candidate' role it sets
>> 'candidate_retrying' flag that notifies that storage is disconnected
>> and client should re-connect.  However, cluster/status command
>> reports 'Status: cluster member' and that is misleading.
>> Reporting "disconnected from the cluster (election timeout)" instead.
>>
>> Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
> 
> candidate_retrying flag was introduced in a patch later than the above one :)
> 
> Acked-by: Han Zhou <hzhou@ovn.org <mailto:hzhou@ovn.org>>

Thanks!
Applied to master and backported down to 2.12.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/ovsdb/raft.c b/ovsdb/raft.c
index 0fb1420fb..192f7f0a9 100644
--- a/ovsdb/raft.c
+++ b/ovsdb/raft.c
@@ -4498,6 +4498,8 @@  raft_unixctl_status(struct unixctl_conn *conn,
                   : raft->leaving ? "leaving cluster"
                   : raft->left ? "left cluster"
                   : raft->failed ? "failed"
+                  : raft->candidate_retrying
+                      ? "disconnected from the cluster (election timeout)"
                   : "cluster member");
     if (raft->joining) {
         ds_put_format(&s, "Remotes for joining:");