Tencent / phxpaxos

The Paxos library implemented in C++ that has been used in the WeChat production environment.
Other
3.36k stars 863 forks source link

OnSendCheckpoint_End 为什么要结束线程 #163

Closed zhouyuze closed 5 years ago

zhouyuze commented 5 years ago

https://github.com/Tencent/phxpaxos/blob/c6c8806c3497cabe6e74dc09aa4487b6fd2057f7/src/algorithm/learner.cpp#L821-L823 学习源码过程中遇到的问题,这里应该是从IOLoop::OneLoop一路调用下来,请问 Checkpoint 同步结束之后为什么要结束线程

wankai commented 5 years ago

@zhouyuze 为了简化编程,如果不退出重启的话,逻辑会非常复杂

zhouyuze commented 5 years ago

@zhouyuze 为了简化编程,如果不退出重启的话,逻辑会非常复杂

@wankai 请问是需要手动重启吗?可否解释下为什么逻辑会非常复杂

wankai commented 5 years ago

@zhouyuze 大公司都有自动重启的机制 Learner相当于同步binlog的过程, 本来同步的好好的, 突然对方说我这里没有binlog了, 你得接收checkpoint. 一旦接收checkpoint,整个statemachine就得变化,非常复杂,不如重启.

要说清楚,得长篇大论了,可以加我weixin聊聊,wankai_zhang

zhouyuze commented 5 years ago

@wankai 明白了,非常感谢