-
Hi, I use MicroRaft to create distributed storage (thanks for the great library) I am now using MicroRaft to implement the Three Phase Commit and would like to "get a list of RaftEndpoints that are currently online." Is there a way? Specifically, if you have RaftEndpoints with nodes (or TERMINATED) that suddenly can't communicate, you want to get only the nodes that are currently online. This is caused by the following issues when doing transactions using Three Phase Commit when some nodes have lost communication.
I would like to know if there is a good way. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
HI @bootjp Thank you for building your use case with MicroRaft. In MicroRaft, followers only track the liveliness of the leader, and the leader tracks the liveliness of the followers. However, for replication, it is not clear to me why do you need liveness of each node. Normally, you just need to discover the leader node. Can you please elaborate why do you need to know liveliness of the individual nodes for committing your operations? I am trying to understand your need. Do you need to identify the current leader to replicate your operation while there are some offline nodes in the system? Normally, you can query RaftNodeReport on some nodes and discover the leader via RaftTerm#getLeaderEndpoint.
About this point, RaftNode#replicate() returns a Future which is completed when your operation is committed. The returned object also provides the commit index of the operation. So if you want to check if some nodes also executed this commit, you can query their If it will be useful, I can consider adding a method like Cheers, |
Beta Was this translation helpful? Give feedback.
-
MicroRaft/microraft/src/main/java/io/microraft/report/RaftNodeReport.java Lines 147 to 178 in 2487b9b |
Beta Was this translation helpful? Give feedback.
MicroRaft/microraft/src/main/java/io/microraft/report/RaftNodeReport.java
Lines 147 to 178 in 2487b9b