Closed JerryYangSH closed 4 years ago
Client对RaftKV写操作,ApplyOperation 没有等commit完成, 如何保证正确性的?
你应该没有注意到 ApplyOperation 时有一个 closure 回调,closure 在写成功后才会被回调
我注意到了那个closure, 但是那closure也未见有操作commit index。请明示, 谢谢
@JerryYangSH closure 由 jraft 状态机在应用了当前 log 后调用,可以看下 KVStoreStateMachine
你所说的 commit index 是 raft 的概念,这个是在 jraft 内部维护和更新的
rheakv 里 raft 相关只需关注两个地方:
committedIndex 推进相关代码见这里(commitAt 方法),建议你在这里打一个断点 debug 一下, jraft 为了减少 block, 设计为一个 callback 为核心的模型,硬看不容易看懂,最好时不时 debug 一下
非常感谢!
Your question
I looked into the code in DefaultRegionKVService.java#handleXXXRequest, I don't see the commit index is advanced right after write op done. and in RaftRawKVStore.java# delete(key, closure), the call just return applyOperation, but no commit was seen. Describe your question clearly Client对RaftKV写操作,ApplyOperation 没有等commit完成, 如何保证正确性的?
Your scenes
Describe your use scenes (why need this feature) Curious
Your advice
Describe the advice or solution you'd like
Environment
Latest branch.
java -version
):uname -a
):