nvharikrishna commented on code in PR #4614:
URL: https://github.com/apache/cassandra/pull/4614#discussion_r2813596108
##########
src/java/org/apache/cassandra/tcm/transformations/Startup.java:
##########
@@ -68,6 +68,19 @@ public Kind kind()
@Override
public Result execute(ClusterMetadata prev)
{
+ // Prevent downgrade to a version that cannot read cluster metadata.
+ // This protects against restarting a node with an older binary.
+ Version clusterVersion = prev.directory.commonSerializationVersion;
+ Version newNodeVersion = nodeVersion.serializationVersion();
+ if (newNodeVersion.isBefore(clusterVersion))
Review Comment:
Isn’t it better to have this check in the NodeVersion class to avoid
duplicate code?
##########
src/java/org/apache/cassandra/tcm/transformations/Register.java:
##########
@@ -74,6 +74,22 @@ public Kind kind()
@Override
public Result execute(ClusterMetadata prev)
{
+ // Ensure the joining node can read existing cluster metadata.
+ // Skip check for empty directory (first node in a new cluster).
+ if (!prev.directory.isEmpty())
+ {
+ Version clusterVersion = prev.directory.commonSerializationVersion;
+ Version newNodeVersion = version.serializationVersion();
+ if (newNodeVersion.isBefore(clusterVersion))
+ {
+ return new Rejected(INVALID,
+ String.format("Cannot register node: this
node's metadata serialization version %s " +
Review Comment:
How to recover from this situation? Would it be possible to include the
recovery strategy in this message or a log message?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]