mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
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>
This commit is contained in:
11
lib/svec.c
11
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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user