[
https://issues.apache.org/jira/browse/CASSANDRA-18999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17798271#comment-17798271
]
Stefan Miklosovic edited comment on CASSANDRA-18999 at 12/18/23 4:20 PM:
-------------------------------------------------------------------------
I am not sure what to do about this in 5.0. It feels "wrong" to have a method
there like this:
{code:java}
/**
* Returns {@code false} only if the information about the version of each node
in the cluster is available and
* ALL the nodes are on 4.0+ (regardless of the patch version).
*/
public boolean hasMajorVersion3OrUnknownNodes()
{
return isUpgradingFromVersionLowerThan(CassandraVersion.CASSANDRA_4_0) ||
// this is quite obvious
// however if we discovered only nodes at current version so far (in
particular only this node),
// but still there are nodes with unknown version, we also want to
report that the cluster may have nodes at 3.x
hasNodeWithUnknownVersion;
} {code}
Is not it impossible to have 3.x nodes from 5.0 perspective in one cluster?
This is not supported, right?
So I can see an argument for completely removing this in 5.0, but on the other
hand, there is also this "or unknown nodes" and that is still valid question to
ask. Hence, would not it be more appropriate to remove
"isUpgradingFromVersionLowerThan" and base this method just on
"hasNodeWithUnknownVersion" ?
[~brandon.williams] [~mck] what do you think?
On the other hand, for simplicity, we could just leave it as it is proposed in
5.0 PR ...
was (Author: smiklosovic):
I am not sure what to do about this in 5.0. It feels "wrong" to have a method
there like this:
{code:java}
/**
* Returns {@code false} only if the information about the version of each node
in the cluster is available and
* ALL the nodes are on 4.0+ (regardless of the patch version).
*/
public boolean hasMajorVersion3OrUnknownNodes()
{
return isUpgradingFromVersionLowerThan(CassandraVersion.CASSANDRA_4_0) ||
// this is quite obvious
// however if we discovered only nodes at current version so far (in
particular only this node),
// but still there are nodes with unknown version, we also want to
report that the cluster may have nodes at 3.x
hasNodeWithUnknownVersion;
} {code}
Is not it impossible to have 3.x nodes from 5.0 perspective in one cluster?
This is not supported, right?
So I can see an argument for completely removing this in 5.0, but on the other
hand, there is also this "or unknown nodes" and that is still valid question to
ask. Hence, would not it be more appropriate to remove
"isUpgradingFromVersionLowerThan" and base this method just on
"hasNodeWithUnknownVersion" ?
> Gossiper::hasMajorVersion3Nodes returns true when a cluster is upgrading
> patch version without Cassandra 3 nodes.
> -----------------------------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-18999
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18999
> Project: Cassandra
> Issue Type: Bug
> Components: Legacy/Distributed Metadata
> Reporter: Isaac Reath
> Assignee: Isaac Reath
> Priority: Low
> Labels: lhf
> Fix For: 4.0.x, 4.1.x, 5.0.x
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> When working on https://issues.apache.org/jira/browse/CASSANDRA-18968 we
> found that {{Gossiper::hasMajorVersion3Nodes}} will return true when the
> cluster is undergoing an upgrade from a patch version even if the cluster has
> no Cassandra 3 nodes in it.
> This can be reproduced by running this Gossiper test:
> {code:java}
> @Test
> public void
> testHasVersion3NodesShouldReturnFalseWhenNoVersion3NodesDetectedAndCassandra4UpgradeInProgress()
> throws Exception
> {
> Gossiper.instance.start(0);
> Gossiper.instance.expireUpgradeFromVersion();
> VersionedValue.VersionedValueFactory factory = new
> VersionedValue.VersionedValueFactory(null);
> EndpointState es = new EndpointState((HeartBeatState) null);
> es.addApplicationState(ApplicationState.RELEASE_VERSION,
> factory.releaseVersion(CURRENT_VERSION.toString()));
>
> Gossiper.instance.endpointStateMap.put(InetAddressAndPort.getByName("127.0.0.1"),
> es);
>
> Gossiper.instance.liveEndpoints.add(InetAddressAndPort.getByName("127.0.0.1"));
> es = new EndpointState((HeartBeatState) null);
> String previousPatchVersion = String.valueOf(CURRENT_VERSION.major) +
> '.' + (CURRENT_VERSION.minor) + '.' + (CURRENT_VERSION.patch - 1);
> es.addApplicationState(ApplicationState.RELEASE_VERSION,
> factory.releaseVersion(previousPatchVersion));
>
> Gossiper.instance.endpointStateMap.put(InetAddressAndPort.getByName("127.0.0.2"),
> es);
>
> Gossiper.instance.liveEndpoints.add(InetAddressAndPort.getByName("127.0.0.2"));
> assertFalse(Gossiper.instance.hasMajorVersion3Nodes());
> }
> {code}
> This seems to be because of
> [https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/gms/Gossiper.java#L2360],
> where an upgrade in progress is possible but we are not upgrading from a
> lower family version (i.e from 4.1.1 to 4.1.2).
> From the comment in this function, it seems instead of the existing check, we
> would want to iterate over all known endpoints in gossip and return true if
> any of them do not have a version (similar to
> [https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/gms/Gossiper.java#L227-L236)
>
> |https://github.com/apache/cassandra/blob/cassandra-4.1/src/java/org/apache/cassandra/gms/Gossiper.java#L227-L236).]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]