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

CopysetNode epoch_的值更新有问题 #2872

Closed
historyliao opened this issue Nov 7, 2023 · 3 comments
Closed

CopysetNode epoch_的值更新有问题 #2872

historyliao opened this issue Nov 7, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@historyliao
Copy link

historyliao commented Nov 7, 2023

Describe the bug (描述bug)
一个新启动的chunkserver,初始epoch_为0。假设在0-T时间内发生了两次的transfer_leader行为,则epoch_会变为2。紧接着到了snapshot的触发时间,开始做snapshot,epoch_被持久化到文件。 假设在raft未完成log删除之前chunkserver断电又快速重启了,重启后的chunkserver在on_snapshot_load中会从文件中加载epoch_,然后回放raft log,回放完成后epoch_会变为4。 这里不应该是4应该是2。导致的后果是同一个raft group的其它Node上报的数据由于epoch较小会被忽略。

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本)
OS:
Compiler:
branch:
commit id:

Additional context/screenshots (更多上下文/截图)

@historyliao historyliao added the bug Something isn't working label Nov 7, 2023
@wu-hanqing
Copy link
Contributor

@historyliao

  1. transfer leader 不会经过配置变更,所以 epoch 不会增加
  2. 重启之后,从 snapshot load 之后,只回放 snapshot index 之后的 raft log

@historyliao
Copy link
Author

@historyliao

  1. transfer leader 不会经过配置变更,所以 epoch 不会增加
  2. 重启之后,从 snapshot load 之后,只回放 snapshot index 之后的 raft log

第2点你说的对,所以这个epoch更新没问题。 不过第1点 transfer leader是会导致重新选举产生新term的,配置会变更,实际测试也是这样。

@wu-hanqing
Copy link
Contributor

@historyliao

  1. transfer leader 不会经过配置变更,所以 epoch 不会增加
  2. 重启之后,从 snapshot load 之后,只回放 snapshot index 之后的 raft log

第2点你说的对,所以这个epoch更新没问题。 不过第1点 transfer leader是会导致重新选举产生新term的,配置会变更,实际测试也是这样。

第 1 点是在重新选举出 leader 之后,需要提交一个 NOOP 才能提供服务,braft 在实现的时候,利用一个空的配置变更实现的(A,B,C) -> (A,B,C),所以导致了 epoch 增加。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants