Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

跟随者(follower)append分析问题 #320

Open
leehom opened this issue Jul 10, 2024 · 0 comments
Open

跟随者(follower)append分析问题 #320

leehom opened this issue Jul 10, 2024 · 0 comments

Comments

@leehom
Copy link

leehom commented Jul 10, 2024

首先分析一下pendingMap的状态

image

pengding请求过时,writeIndex调回到水位线+1作为写入点,

  • 上图的上部分是初始状态
    writeIndex1 第一个批次请求;writeIndex2第二个批次请求,并已发送,pendingMap有两个数据
  • 上图的下部分,writeIndex1超时,调和writeIndex,请求重新发送,但批次数量会有所不同,形成新的writeIndex1(覆盖原有),writeIndex2-x,而且writeIndex1的批量比原writeIndex1大,writeIndex2-x比原writeIndex2大,pendingMap有3个数据
    此时有两条发送线,不能说writeIndex2已废弃,可能跟随者已处理了原writeIndex1,只是回复失败,处理写入分析跟随者怎样处理

再看跟随者的处理
image
3.1.1 处理有点不解,按pendingMap分析,writeIndex2那批可能被返回不一致,处理没错,但本人认为更好的处理应该是保证写入点连续性即好,过期的请求删去就可以,一直走第二部分请求,若返回不一致,领导者进入比对,降低效率

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant