Skip to content

Fix snapshot installation CRC failure #369

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

Merged
merged 2 commits into from
May 10, 2023
Merged

Fix snapshot installation CRC failure #369

merged 2 commits into from
May 10, 2023

Conversation

kjnilsson
Copy link
Contributor

@kjnilsson kjnilsson commented May 9, 2023

Due to the unwise use of term_to_binary rather than using the original binary data in the replication of snapshot states.

This change:

Introduces a new optional ra_snapshot callback: context/0

This is called by the sending Ra leader node to discover context and capabilities of the receiver. In this case it is used to indicate if the receiver is capabable of receiving the entire snapshot file.

Receiving the entire file is the updated approach that ensures the CRC check will be done on the same binary data it was generated from.

If the receiver does not have the context/0 callback or does not indicate support the old approach of sending the deserialised metat data map and any data following that is used.

When a snapshot is received from an old node (i.e. not including the entire file) the receiver will not validate the checksum (as it may fail due to differences in map serialisation) and instead patch up it's local file with it's own calculcated checksum.

The scenario where a snapshot taken by a newer version of OTP and is then sent to a member using the old code cannot be handled and the old node will fail at snapshot checksum validation.

Fixes #368

Due to the unwise use of term_to_binary rather than using the original
binary data in the replication of snapshot states.

This change:

Introduces a new optional ra_snapshot callback: context/0

This is called by the sending Ra leader node to discover context and
capabilities of the receiver. In this case it is used to indicate if
the receiver is capabable of receiving the entire snapshot file.

Receiving the entire file is the updated approach that ensures the
CRC check will be done on the same binary data it was generated from.

If the receiver does not have the context/0 callback or does not indicate
support the old approach of sending the deserialised metat data map and any
data following that is used.

When a snapshot is received from an old node (i.e. _not_ including
the entire file) the receiver will not validate the checksum (as it may
fail due to differences in map serialisation) and instead patch up it's
local file with it's own calculcated checksum.

The scenario where a snapshot taken by a newer version of OTP and is then
sent to a member using the old code cannot be handled and the old node will
fail at snapshot checksum validation.
Before tryign to send a snapshot we check if the target node is
connected and if not update the peer's status to the new
"disconnected" state. This state is reverted to "normal" on all
nodeup events.
@kjnilsson kjnilsson marked this pull request as ready for review May 10, 2023 14:30
@michaelklishin michaelklishin modified the milestone: 2.6.0 May 10, 2023
@michaelklishin
Copy link
Contributor

rabbitmq/rabbitmq-server#8143 makes rolling upgrades to Erlang 26 succeed under a constant load involving QQs.

@michaelklishin michaelklishin added this to the 2.6.1 milestone May 11, 2023
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.

ra_log_snapshot fails CRC check on OTP 26
2 participants