diff options
author | Ilya Maximets <i.maximets@ovn.org> | 2021-06-29 12:56:18 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2021-07-15 21:04:49 +0200 |
commit | 00dda78ed43b55e65948e935e6715d2d82615d30 (patch) | |
tree | a58c6a5c978b6b24854b37a058e28944e5352836 /lib/svec.c | |
parent | 73259ea70374ea94330e03eb18824a03b2a8db23 (diff) | |
download | openvswitch-00dda78ed43b55e65948e935e6715d2d82615d30.tar.gz |
ovsdb-cs: Avoid unnecessary re-connections when updating remotes.
If a new database server added to the cluster, or if one of the
database servers changed its IP address or port, then you need to
update the list of remotes for the client. For example, if a new
OVN_Southbound database server is added, you need to update the
ovn-remote for the ovn-controller.
However, in the current implementation, the ovsdb-cs module always
closes the current connection and creates a new one. This can lead
to a storm of re-connections if all ovn-controllers will be updated
simultaneously. They can also start re-dowloading the database
content, creating even more load on the database servers.
Correct this by saving an existing connection if it is still in the
list of remotes after the update.
'reconnect' module will report connection state updates, but that
is OK since no real re-connection happened and we only updated the
state of a new 'reconnect' instance.
If required, re-connection can be forced after the update of remotes
with ovsdb_cs_force_reconnect().
Acked-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Han Zhou <hzhou@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/svec.c')
-rw-r--r-- | lib/svec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/svec.c b/lib/svec.c index c1b986bab..6ea96384b 100644 --- a/lib/svec.c +++ b/lib/svec.c @@ -247,6 +247,17 @@ svec_contains(const struct svec *svec, const char *name) return svec_find(svec, name) != SIZE_MAX; } +bool +svec_contains_unsorted(const struct svec *svec, const char *name) +{ + for (size_t i = 0; i < svec->n; i++) { + if (!strcmp(svec->names[i], name)) { + return true; + } + } + return false; +} + size_t svec_find(const struct svec *svec, const char *name) { |