Comments (4)
一个entry log会被提交给状态机的前提是已经被group接受了, 所以只需要leader sm apply即可。
from sofa-jraft.
你好,感谢关注
这段代码看起来像是只要Leader执行成功了,就会向Client发送“执行成功”的response。
StateMachine#onApply() 是在 raft log 被复制到多数派以后才会调用
所以向客户端发送 “执行成功” 的 response 是在 日志已形成多数派并且在 leader 上执行执行成功 这个时间节点
但实际情况不应该是Task在RaftGroup中成功后(不仅仅是在leader执行成功)才去向client返回response;
这个不太准确,见上面回复
而且这个回调理论上不应该是RAFT框架来调用的吗?为什么需要用户在这个地方来调用?
CounterStateMachine 是业务的状态机,在 jraft 中需要你自己来处理 client 响应
from sofa-jraft.
谢谢解答
from sofa-jraft.
补充下,还有个一个额外的接口 TaskClosure
,可以用于在日志提交到组内多数派之后,应用到状态机之前回调
public interface TaskClosure extends Closure {
/**
* Called when task is committed to majority peers of the RAFT group but before it is applied to state machine.
*
* <strong>Note: user implementation should not block this method and throw any exceptions.</strong>
*/
void onCommitted();
}
from sofa-jraft.
Related Issues (20)
- 希望尽快适配高版本jdk,目前尝试改动源代码升级到jdk21.启动集群正常,但是CliService工具异常,提示Connection is null when do check! HOT 5
- 能否对新加入的参与者提供自认证机制。或者预留自认证机制接口,让用户自己实现 HOT 15
- 对于rheakv分为:kv数据存储目录以及raft log存储目录。但是参与者之间数据同步处理的是日志目录。那kv数据目录怎么同步了 HOT 1
- 请教个问题:任务应用到多数派状态机决定条件是怎样的???对于kv系统是否因为这个导致数据丢失。 HOT 5
- 请教个问题:有没有配置或者一种机制(比如多长时间后),对于离线的节点,leader心跳检测临时抛弃 HOT 5
- 节点重启有机率出现No locks available,不知道这正常吗?? HOT 3
- 能否通过spi开放集群成员合法性校验,同时允许成员携带额外信息(用户自行实现成员合法性校验时使用) HOT 13
- AssertionError in AppendEntriesRequestProcessor HOT 1
- Commit index may be smaller than snapshot index HOT 1
- 请教问题:jraft的log目录会不会随着系统运行时间而无限增加,有没有清空策略 HOT 4
- 请教个问题:应用到多数派方式是不是可能导致数据丢失。 HOT 1
- fowlloe
- 集群重启时,follower启动失败
- what's the best way to re-add an existing node to the cluster in EKS
- How to verify the legitimacy of a member? HOT 2
- ReadIndex frequently times out. HOT 4
- Unrecycled RPC threads cause OOM HOT 2
- Deadlock on configuration application in NodeImpl when disruptors are full HOT 9
- 压测性能耗时较高,200多ms HOT 2
- 在这种情况下是不是会出现死锁? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sofa-jraft.