Backport #791 and remove ambiguity in Cassandra and DSE versions in tests#805
Conversation
Motivation: Many tests are failing when using recent versions of C* or DSE. Modifications: 1) Bump the default C* version to 3.8 2) Redesign @CassandraVersion and @DseVersion to be able to fully accept tick-tock releases and correctly compare them. 3) Reduce log verbosity for Scassandra tests 4) Prevent thrift from being enabled for C* >= 4.0 5) Fix decommission tests with C* >= 3.12 This commit contains contributions by Andrew Tolbert (@tolbertam). Result: All tests should pass.
adutra
left a comment
There was a problem hiding this comment.
I love your ideas! I just wonder if we go down this path, why not go even further and distinguish DSE from C* from the very top of the stack, i.e. starting with system properties themselves (see my comment in the review).
| private static final Logger logger = LoggerFactory.getLogger(CCMBridge.class); | ||
|
|
||
| private static final String CASSANDRA_VERSION; | ||
| private static final String INPUT_CASSANDRA_VERSION; |
There was a problem hiding this comment.
This is actually only used in the static block below and could be turned into a local variable.
|
|
||
| static { | ||
| CASSANDRA_VERSION = System.getProperty("cassandra.version"); | ||
| INPUT_CASSANDRA_VERSION = System.getProperty("cassandra.version"); |
There was a problem hiding this comment.
What about distinguishing two different system properties for default versions to use: one for OSS C*, one for DSE?
One could e.g. specify that tests requiring DSE should by default use 5.0.3, but tests requiring OSS C* should rather use 3.10.
In this case, the dse system property is useless and the mapping from a DSE version to an OSS C* one should only be used when determining the corresponding C* version of a DSE version (which might be different than the "global" C* version).
I can give it a try myself if you don't mind.
There was a problem hiding this comment.
I didn't want to change the existing system properties, I'll think on this for a bit
There was a problem hiding this comment.
Discussion for system properties is on the consistentTestVersioning-adu branch didn't want to address that here.
| private static final String CASSANDRA_VERSION; | ||
| private static final String INPUT_CASSANDRA_VERSION; | ||
|
|
||
| private static final VersionNumber CASSANDRA_VERSION_NUMBER; |
There was a problem hiding this comment.
How about calling these constants GLOBAL_XXX to match their getter method names?
| * | ||
| * @return The version of this CCM cluster. | ||
| */ | ||
| VersionNumber getDSEVersion(); |
There was a problem hiding this comment.
Not sure how much it makes sense to have a CCM cluster instance reporting two different versions. A CCMAccess is a bridge to either a DSE cluster or a C* cluster, not both.
There was a problem hiding this comment.
Oh my bad, I see it now, getCassandraVersion() is filled automatically with the corresponding C* version if this instance is a DSE cluster, correct? If so, please disregard my previous comment.
There was a problem hiding this comment.
👍 in the case the dse version is provided, the cassandra version is just the derived cassandra verson from dse for deriving test behavior based on that version. I'll update the comments to reflect that.
| /** | ||
| * @return The desired target protocol version based on the 'cassandra.version' System property. | ||
| */ | ||
| ProtocolVersion getDesiredProtocolVersion(); |
There was a problem hiding this comment.
Suggestion: replace "desired" – its meaning is quite unclear here – with "target", e.g. getTargetProtocolVersion os even simply getProtocolVersion.
The javadocs need to be updated, here the returned version is the version that matches this specific instance, not the global system property.
There was a problem hiding this comment.
I would describe it as the highest version common to the driver and the server, is that accurate?
There was a problem hiding this comment.
Yep, that is the intent of this
There was a problem hiding this comment.
Ah I see that the documentation doesn't completely reflect that, i'll fix that up:
The target protocol version based on the 'cassandra.version' System property.
|
|
||
| @Override | ||
| public ProtocolVersion getDesiredProtocolVersion() { | ||
| VersionNumber version = getCassandraVersion(); |
There was a problem hiding this comment.
this is only checking cassandra versions, shouldn't it be checking dse versions as well? Anyway as per my previous comment I think a single CCMBridge instance should carry only one version, and a boolean flag to indicate if it is a DSE cluster or not.
There was a problem hiding this comment.
For now the Cassandra version (which is the compatible cassandra version when DSE version is provided) is adequate for determining the protocol version.
| */ | ||
| public Builder withoutDSE() { | ||
| this.isDSE = false; | ||
| public Builder withCassandraVersion(VersionNumber versionNumber) { |
There was a problem hiding this comment.
Again, not sure this makes sense, since withCassandraVersion and withDSEVersion are mutually exclusive (see assertions) why not keep just one method withVersion?
There was a problem hiding this comment.
Agreed, reverting this back as it isn't necessary in this particular case.
|
woops, didn't mean to delete this 🤦♂️ |
adutra
left a comment
There was a problem hiding this comment.
Looks great, only minor remarks 👍
| @Override | ||
| @SuppressWarnings("SimplifiableIfStatement") | ||
| public boolean equals(Object o) { | ||
| // do not include cluster name and start, only |
There was a problem hiding this comment.
I think we should keep the comment about cluster name because indeed a cluster name is unique, but two CCM instances should still be considered equal if their characteristics are identical. As for the start property, I am not sure anymore, but I think we can include it the computation of equals() and hashcode().
There was a problem hiding this comment.
Good catch will fix
There was a problem hiding this comment.
Hrmm it doesn't look like cluster name is even part of the builder anymore since this is randomly generated, so maybe that comment isn't relevant anymore?
| /** | ||
| * Helper for generating a DynamicCompositeType {@link ByteBuffer} from the given parameters. | ||
| * | ||
| * <p> |
There was a problem hiding this comment.
This is minor but I think the convention is to use <p/>
There was a problem hiding this comment.
Ah, good catch, IntelliJ's autoformatter behaves differently between when you have JDK 8 configured and otherwise. For some reason with JDK 8 it omits /. I'll fix it.
Motivation: Originally CCMBridge was developed targeting running Apache Cassandra clusters using CCM. Over time this has changed to also work with DataStax Enterprise. There are some cases where there was ambiguity with regards to whether the DSE or Cassandra version was used. This attempts to fix this. Also, there were some places where the globally configured Cassandra/DSE version was used (passed in via -Dcassandra.version) instead of a locally configured one for a particular test. This commit also fixes this. In Addition, TestUtils.getDesiredProtocolVersion was made available to determine the ProtocolVersion to use based on the globally configured Cassandra version. This functionality has been moved to CCMAccess, so one can get the ProtocolVersion tied to the version of Cassandra used scoped to the test. Finally, update default cassandra.version used in tests to 3.10. Modifications: Break out CCMAccess.getVersion() into two methods, CCMAccess.getCassandraVersion() and CCMAccess.getDSEVersion(). If DSE is not configured getDSEVersion() returns null, if it is configured getCassandraVersion() returns the mapped version of Cassandra from DSE. Move TestUtils.getDesiredProtocolVersion to CCMAccess. Rename CCMBridge.CASSANDRA_VERSION to CCMBridge.INPUT_CASSANDRA_VERSION. Add CCMBridge.CASSANDRA_VERSION_NUMBER and CCMBridge.DSE_VERSION_NUMBER. Rename CCMBridge.getCassandraVersion() and getDSEVersion() to CCMBridge.getGlobalCassandraVersion() and CCMBridge.getGlobalDSEVersion(). These methods return VersionNumber instead of String. Result: Ambiguity removed between Cassandra and DSE versions. Annotations that call out CCM remain unchanged.
9a61173 to
202770e
Compare
|
Squashed the |
Backports test changes from #791 and also removes ambiguity in Cassandra and DSE versions in tests (see b2e51ab for details).
If accepted, will need to make changes on each upstream branch as we go upwards. I've tested this change on all upstream branches and made the individual fixes, so I should be able to do that quickly when the time comes.