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

[Curp] Fix concurrent bug #86

Merged
merged 1 commit into from
Nov 28, 2022
Merged

Conversation

markcty
Copy link
Contributor

@markcty markcty commented Nov 23, 2022

The bug will happen in the following situation:

  1. A client proposes a command to all servers.
  2. The leader receives the command, sync to others, and committed the command.
  3. When a follower has not yet received the proposal from the client, it notices that the command is committed and executes it. When the execution is over, it will need to remove the command from spec pool. However, since the follower has not yet received a proposal from the client, it will find no such command in the spec pool.

Suggested fix:
When a follower tries to remove a non-exist command from spec pool, it will register the command id in an internal buffer. When the proposal is finally received, it will directly remove the command. (The ready pool needs to gc after some time)

@markcty markcty changed the title Fix concurrent bug [Curp] Fix concurrent bug Nov 23, 2022
curp/src/server.rs Outdated Show resolved Hide resolved
@rogercloud
Copy link
Collaborator

Please add a test to coverage the error.

curp/src/server.rs Outdated Show resolved Hide resolved
curp/src/server.rs Outdated Show resolved Hide resolved
curp/src/server.rs Outdated Show resolved Hide resolved
The bug will happen in the following situation:
1. A client proposes a command to all servers.
2. The leader receives the command, sync to others, and committed the command.
3. A follower it notices that the command is committed and executes it. When the execution is over, it will need to remove the command from spec pool. However, since the follower may have not yet received the proposal from the client, it will find no such command in the spec pool and panic.
Suggested fix:
When a follower tries to remove a non-exist command from spec pool, it will register the command id in an internal buffer(ready). When the proposal is finally received, it will directly remove the command. The ready pool needs gc periodically since the proposal may never arrive.
@mergify mergify bot merged commit f816289 into xline-kv:master Nov 28, 2022
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

Successfully merging this pull request may close these issues.

2 participants