AsyncClient (async 3.2.1 version) - getNodes() method returns "Node" already down


#1

Hi, I’ve started my work with Aerospike and tried identify client-server disconnection by polling AerospikeClient.getNodes() method. When I’ve stopped all DB instances, observed that AerospikeClient.getNodes() returns Node array(with size 1) contains last node that I stopped (i.e actually client disconnected from all DB servers but getNodes() method still returns one Node). Why?

Thanks


#2

If the client drops to one node and periodic info requests to that node fails, the seeds are checked. If a seed succeeds, the final node will be dropped and the seed will replace it. Otherwise the node remains. There is no real benefit to removing it from the cluster at this point.

That said, it might be cleaner to just remove the node for accounting purposes. We will look at this in a future release.


#3

Thanks for your reply. In case when client connected to few instances, how to find out disconnection from one of them? (according to your answer I cannot rely on getNodes() method because it returns Node that actually disconnected) and from AyncClient instance I don’t have access to private fields and methods of Cluster class and other relevant classes. What would you suggest to me? (how to find out disconnection from one of nodes?)

Thanks


#4

getNodes() will return active nodes in the cluster in all cases except the single node case. For the single node case, the client will never know for sure if the node has either stopped running or temporarily did not respond to tend requests within the 1 second timeout.

You can check if any nodes are connected by calling client.isConnected(). This method returns false when there are no nodes in the cluster or the nodes that exist have not responded to 5 consecutive tend requests. Cluster tends requests are made once a second to existing nodes.