返回信息流实在不知道发哪个版,只好发这个版了再刷MIT的6.824,里面在讲paxos得时候,给出的acceptor的伪代码如下:
acceptor's prepare(n) handler:
if n > np
np = n
reply prepare_ok(n, na, va)
else
reply prepare_reject
其中na和va是acceptor记录的最高的n和v。为什么acceptor需要将n和v返回给proposer?感觉proposer不需要这些啊?
这是一条镜像帖。来源:北邮人论坛 / java / #44143同步于 2015/9/15
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Java机器人发帖
关于paxos的问题
hyx2011
2015/9/15镜像同步13 回复
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
Orz。。。有啥相关推荐读物或视频么?
【 在 shixiaotian 的大作中提到: 】
: 不把当前的最大值发给proposer,proposer怎么知道应该发什么才能让acceptor同意呢?
You can see proposer's handler in 6.824 web
proposer(v):
while not decided:
choose n, unique and higher than any n seen so far
send prepare(n) to all servers including self
if prepare_ok(n, n_a, v_a) from majority:
v' = v_a with highest n_a; choose own v otherwise
send accept(n, v') to all
if accept_ok(n) from majority:
send decided(v') to all
-----------------------------------------
so, if acceptor's accpted number > proposer's accepted number, the proposer should update its accepted number and accepted value
但是就算不发给proposer,提出最大值的proposer在收到大部分acceptor的prepare_ok之后也会发送accept给acceptor,协议也可以完成。发给proposer会让获得返回值的proposer发送重复的消息给acceptor,这不会浪费网络IO么?
【 在 shixiaotian 的大作中提到: 】
: 不把当前的最大值发给proposer,proposer怎么知道应该发什么才能让acceptor同意呢?
But I don't think proposer need to update its n and v. The accepted number and value seems useless for proposer
【 在 lizz 的大作中提到: 】
: You can see proposer's handler in 6.824 web
: proposer(v):
: while not decided:
: ...................
If there is only one proposer, you're right.
But, There may be many proposers at the same time, so they must record the accepted value,
otherwise these proposer only known the propose has been accepted but don't know what exactly the accepted value is. So they might send different decision value and break this protocol.
You can see test case about it in the lab, If you don't record accepted value you won't pass the lab.
【 在 hyx2011 的大作中提到: 】
: But I don't think proposer need to update its n and v. The accepted number and value seems useless for proposer
你这个只能保证在一次成功的情况下可用啊,如果都不过半数怎么办呢……
【 在 hyx2011 的大作中提到: 】
: 但是就算不发给proposer,提出最大值的proposer在收到大部分acceptor的prepare_ok之后也会发送accept给acceptor,协议也可以完成。发给proposer会让获得返回值的proposer发送重复的消息给acceptor,这不会浪费网络IO么?
随便找本书看卡就行了,细节我也搞不懂,没写过协议……
【 在 aiquestion 的大作中提到: 】
: Orz。。。有啥相关推荐读物或视频么?