arangodb / arangojs

The official ArangoDB JavaScript driver.
https://arangodb.github.io/arangojs
Apache License 2.0
600 stars 106 forks source link

[Cluster] Clean dead server #711

Closed orgrimarr closed 2 years ago

orgrimarr commented 3 years ago

Environment

Description

Arangojs connected to a cluster in ROUND_ROBIN mode does not clean dead servers from the host list.

Arangojs provide a method : acquireHostList but this function append new coordinator to the host list using addToHostList function.

I suggest to change the acquireHostList function to replace the host list with the list of available server from /_api/cluster/endpoints

pluma commented 3 years ago

This would be a breaking change, but I think a compromise would be to add an alternative method (say, updateHostList) that replaces rather than updates the known hosts.

One issue with this is that right now the hosts list is an array and thus hosts are identified by their index, which will cause problems if e.g. a cursor is created from a host which is then removed from the list. This probably requires some internal changes.