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.
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