Raftsimple - Simple key-value store example #376
Raftsimple - Simple key-value store example #376ntdkhiem wants to merge 21 commits intoetcd-io:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ntdkhiem The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @ntdkhiem. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
e91e416 to
aeefc80
Compare
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
- POST method doens't work at the moment. Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
- ref: etcd-io/etcd#15471 Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
|
@ahrtr I fully understand that this issue is very low in priority for you right now. If I may, what are something I can do to help facilitating your reviewing process?
|
|
Sorry, did not get time to review this recently. Before I review it sometime later, can you please
|
|
pls resolve the Go Vulnerability in a separate PR, once it's merged, then rebase this PR. thx |
|
Wait...This is weird. I accidentally pushed a new commit to resolve the vulnerability before reading your latest comment. But, when I reverted the commit and forced push, it still passed the Go Vulnerability Checker / test. Should I make a separate PR anyway? |
yes, pls |
Totally understandable! The project is located in The API allows four methods: GET, POST, PUT, DELETE to either retrieve/create a key or add/delete a Raft node. On a separate terminal: curl http://127.0.0.1:9121/foo -XPUT -d barwill add/replace the key curl http://127.0.0.1:9121/foowill retrieve the value from key curl http://127.0.0.1:9121/4 -XPOSTwill create a new Raft node and key-value store API, exposing at port 9124. Will throw curl http://127.0.0.1:9121/1 -XDELETEwill delete Raft node 1, along with its key-value store API. That means port 9121 should be no longer available. curl http://127.0.0.1:9122/1 -XPOSTwill revive Raft node 1, kicking off its snapshot reloading, along with its key-value store API at port 9121. During executing these commands, you can monitor the main terminal to see Raft in effect. |
Sorry, I'm quite confused about your comment. The vulnerability is found in the Go standard library that I use in my code. A fix would be to bump up Go version from 1.25.6 to 1.25.7 in Thank you in advance. |
|
sorry, I mixed the raftexample/go.mod with the go.mod under the root directory. You need to bump your go.mod in this PR. |
- Resolve GO-2026-4337 Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
- When a node get deleted and restored, it attempts to replay all messages which will also include the one entry removing itself. When this happens, the node is removed and the rest of the cluster panic because it couldn't send MsgHeartBeat to that node. Signed-off-by: Khiem Nguyen <ppkhiemnguyen@gmail.com>
|
I see that you reuse most of the existing source code of raftexample, which is good.
|
|
@ahrtr , I’ve simplified the network layer to run all nodes within a single process using in-memory communication. If following the exact usage, the Am I required to do that or is there some flexibility in this layer? I thought this was supposed to only demonstrate Raft and make sure everything is as simple as possible. Please advice. PS: Thanks for reminding me. I will clean up the git history and add README once everything is good to go. |
|
@ahrtr a quick nudge. |
It has been over a year since the last PR for issue #2 , so I just wanted to take a crack at it for the sake of my own learning.
The goal is to provide a clean, minimal example of implementing key-value store with Raft. I have stripped down the complexity of the existing
raftexamplefrom etcd by making all nodes run in-memory, allowing the transport layer to be as simple as possible (instead of TCP) and removing complex WAL/Snapshot persistence for now to focus on the core Raft flow. Thanks to @mhagger suggestions in etcd-io/etcd#15471, the implementation became so much simpler and easier for me to follow.At the moment, this PR
will just be a Draftis now ready to be reviewed. The basic node communication is working, but I am planning to:As a first-time contributor to this project, I am very open to feedback on the structure and approach. Does this simplified design align with what you envisioned @ahrtr ?