fix: handle missing previous_cluster in pre_append_log_follower#600
Merged
kjnilsson merged 6 commits intorabbitmq:mainfrom Mar 26, 2026
Merged
Conversation
Contributor
|
@Qian-Cheng-nju thank you for contributing to RabbitMQ. Please add a license header to the new test module and sign our CLA when you have a moment. |
Contributor
Author
|
Thanks! @michaelklishin License header added. I've sent an email to sign the CLA. |
Contributor
Author
|
Hi all! I have signed the CLA! Please feel free to contact me if you need anything else. |
Contributor
|
@Qian-Cheng-nju I think the fix looks fine but I would like the test for it to be added to one of the existing test suites, not a new suite of it's own. |
kjnilsson
requested changes
Mar 26, 2026
Contributor
kjnilsson
left a comment
There was a problem hiding this comment.
Please add the test to one of the existing test suites
Contributor
Author
|
Thanks @kjnilsson! Moved the test into ra_server_SUITE as follower_cluster_change_overwrite. |
kjnilsson
reviewed
Mar 26, 2026
kjnilsson
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, thanks for ra!
I found a crash scenario in pre_append_log_follower and put together a fix.
When a follower receives an uncommitted cluster change entry at index I, then a new leader overwrites that index with a regular entry, pre_append_log_follower crashes with {badkey, previous_cluster}. This happens because the follower path doesn't store previous_cluster in the state map when processing cluster changes, but the overwrite path assumes it's always there.
The trigger scenario: follower gets AER with cluster change at index 4 (term 5), then gets AER from a new leader overwriting index 4 with a regular entry (term 6). The second AER crashes the follower process.