zhebrak/raftos

Retrieving Replicated value on Follower node

Closed this issue · 5 comments

on leader

counter = raftos.Replicated(name='counter')
await counter.set(42)

on follower, how do I retrieve the value above

counter = raftos.Replicated(name='counter')
value = await counter.get() # errors outs saying it requires the node to be leader

The idea is that all data communication should be done from a Leader node. Followers are there to receive updates from the Leader and initiate an election if the Leader is down.

That seems like a missed opportunity. I understand only having the leader as a writer, but the protocol doesn't really have any limitations on multiple readers, i.e. etcd, Pysyncobj. Are there any technical issues that prevent the get_value() on the state object from working on follower nodes?

Getting values from 2 different Followers may result in 2 different values :) There is no guarantee of any consistency, are you OK with this?

Once the value is committed in the leader we are sure it'll still be committed if this leader fails and there will be a new one. Raft algorithm ensures consistency among all possible leaders.