[ovs-dev] [PATCH v3] ovsdb-cs: Perform forced reconnects without a backoff.

Dumitru Ceara dceara at redhat.com
Fri Jul 23 17:04:31 UTC 2021


On 7/23/21 6:39 PM, Ilya Maximets wrote:
> On 7/21/21 2:51 PM, Dumitru Ceara wrote:
>> The ovsdb-cs layer triggers a forced reconnect in various cases:
>> - when an inconsistency is detected in the data received from the
>>   remote server.
>> - when the remote server is running in clustered mode and transitioned
>>   to "follower", if the client is configured in "leader-only" mode.
>> - when explicitly requested by upper layers (e.g., by the user
>>   application, through the IDL layer).
>>
>> In such cases it's desirable that reconnection should happen as fast as
>> possible, without the current exponential backoff maintained by the
>> underlying reconnect object.  Furthermore, since 3c2d6274bcee ("raft:
>> Transfer leadership before creating snapshots."), leadership changes
>> inside the clustered database happen more often and, therefore,
>> "leader-only" clients need to reconnect more often too.
>>
>> Forced reconnects call jsonrpc_session_force_reconnect() which will not
>> reset backoff.  To make sure clients reconnect as fast as possible in
>> the afore mentioned scenarios we first call the new API,
>> jsonrpc_session_reset_backoff(), in ovsdb-cs, for sessions that are in
>> state CS_S_MONITORING (i.e., the remote is likely still alive and
>> functioning fine).
>>
>> jsonrpc_session_reset_backoff() resets the number of backoff-free
>> reconnect retries to the number of remotes configured for the session,
>> ensuring that all remotes are retried exactly once with backoff 0.
>>
>> This commit also updates the Python IDL and jsonrpc implementations.
>> The Python IDL wasn't tracking the IDL_S_MONITORING state explicitly,
>> we now do that too.  Tests were also added to make sure the IDL forced
>> reconnects happen without backoff.
>>
>> Reported-at: https://bugzilla.redhat.com/1977264
>> Suggested-by: Ilya Maximets <i.maximets at ovn.org>
>> Signed-off-by: Dumitru Ceara <dceara at redhat.com>
>> ---
>> v3:
>> - Addressed Ilya's comments:
>>   - rephrase commit log.
>>   - fix jsonrpc_session_reset_backoff() comment.
>>   - add extra backoff-free try only to connected jsonrpc sessions.
>>   - fix comment for OVSDB_CHECK_CLUSTER_IDL_PY().
>>
>> v2:
>> https://patchwork.ozlabs.org/project/openvswitch/patch/20210721105614.25498-1-dceara@redhat.com/
>> - Reworked the patch based on the discussion with Ilya:
>>   - add a new jsonrpc_session_reset_backoff() API to be used by the
>>     ovsdb-cs layer to avoid backoffs when reconnecting due to
>>     inconsistent data/remote becoming follower.
>> v1:
>> https://patchwork.ozlabs.org/project/openvswitch/patch/20210629112035.17402-1-dceara@redhat.com/
>> ---
> 
> 
> Thanks!  Applied to master.  I also backported this down to 2.15
> as it's the likely version stable versions of OVN are built with.
> 
> Best regards, Ilya Maximets.
> 

Thanks!



More information about the dev mailing list