-
Notifications
You must be signed in to change notification settings - Fork 27
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
fix two twice delivery on sync #560
Conversation
Signed-off-by: Фёдор Партанский <[email protected]>
Can you please provide a unit-test which clearly demonstrates the issue you are addressing in the commit? |
So far I have not been able to create a test in which this error always appears. |
Signed-off-by: Фёдор Партанский <[email protected]>
I added a test. |
Signed-off-by: Фёдор Партанский <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Proposal delivery can come from 2 goroutines: Controller and ViewChanger.
4 places:
Goroutines are fairly independent. It is required to ensure that delivery is not at the same time and that there is no twice delivery.
To prevent at the same time delivery, all deliveries are performed from under the syncLock mutex.
To prevent twice delivery, the Checkpoint parameter is implemented. Before delivery, the code reads Checkpoint and decides if the proposal should be delivered. After delivery, the code must set a new value in Checkpoint. Without this, double delivery is possible.
Found the last place where proposals can be delivered and Checkpoint is not set. This pull request fixes this error.