Read from node with master partition


#1

Hi Jan,

We are facing data inconsistency in some of our read calls. Aerospike client get request is returning nil for a newly set key. We think this is because the client is reading from a slave node which has not yet sync’ed with the master node. Our write policy is set to COMMIT_MASTER and therefore the write request doesn’t wait for the commit on all nodes. The solution, we think, is to make the client read from the node which has the master partition. This can be done in Java client using the master replica policy but in the ruby client I could not find any such thing. Please help us achieve this. Will there be an update any time soon for this?


#2

Hi Himanshu,

You are right: The Ruby client currently does not support the Replica policy. However, the client will always attempt to read records from the master node by default. There may be rare cases where the client does not know the current master for a partition, e.g. if the master has just changed and the client has not yet received the updated partition table from the new master. In such cases, the client will send the read request to a random cluster node instead. If that nodes does not have a replica of the partition, it will proxy the request to the master node. Under stable cluster conditions – no recent node additions/removals or split-brain scenarios – the client should always read from the master.