if (getCassandraVersion().compareTo(PARTITION_FETCH_WITH_IN_PREDICATE_VERSION) > 0) { log.debug("Using IN predicate to fetch partitions."); rows = queryPartitionKeysWithInClauses(table, filterPrefixes);
if (predicateString.contains(" IN (") && cassandraVersion.compareTo(VersionNumber.parse("2.2.0")) < 0 && currentClusteringColumn != (clusteringColumns.size() - 1)) { break;
private static boolean isThriftSupported(VersionNumber cassandraVersion) { return cassandraVersion.compareTo(VersionNumber.parse("4.0")) < 0; }
@Override public ProtocolVersion getProtocolVersion() { VersionNumber version = getCassandraVersion(); if (version.compareTo(VersionNumber.parse("2.0")) < 0) { return ProtocolVersion.V1; } else if (version.compareTo(VersionNumber.parse("2.1")) < 0) { return ProtocolVersion.V2; } else if (version.compareTo(VersionNumber.parse("2.2")) < 0) { return ProtocolVersion.V3; } else { return ProtocolVersion.V4; } }
@Override public void decommission(int n) { logger.debug( String.format( "Decommissioning: node %s (%s%s:%s) from %s", n, ipPrefix, n, binaryPort, this)); // Special case for C* 3.12+, DSE 5.1+, force decommission (see CASSANDRA-12510) String cmd = CCM_COMMAND + " node%d decommission"; if (this.cassandraVersion.compareTo(VersionNumber.parse("3.12")) >= 0 || (this.dseVersion != null && this.dseVersion.compareTo(VersionNumber.parse("5.1.0")) >= 0)) { cmd += " --force"; } execute(cmd, n); }
boolean supports(ProtocolVersion version) { return getCassandraVersion() == null || version.minCassandraVersion().compareTo(getCassandraVersion().nextStable()) <= 0; }
private static void versionCheck( VersionNumber current, VersionNumber required, String skipString) { if (current == null) { throw new SkipException("Skipping test because provided version is null"); } else { if (current.compareTo(required) < 0) { throw new SkipException( String.format( "Version >= %s required, but found %s. Justification: %s", required, current, skipString)); } } } }
private void assertOrder(String version1, String version2, int expected) { assertThat(VersionNumber.parse(version1).compareTo(VersionNumber.parse(version2))) .isEqualTo(expected); } }
/** @jira_ticket JAVA-1367 */ @Test(groups = "short") public void should_fail_when_version_provided_and_too_high() throws Exception { if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("2.2")) >= 0) { throw new SkipException("Server supports protocol V4"); } UnsupportedProtocolVersionException e = connectWithUnsupportedVersion(V4); assertThat(e.getUnsupportedVersion()).isEqualTo(V4); // pre-CASSANDRA-11464: server replies with its own version assertThat(e.getServerVersion()).isEqualTo(protocolVersion); }
/** @jira_ticket JAVA-1367 */ @Test(groups = "short") public void should_fail_when_beta_allowed_and_too_high() throws Exception { if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("3.10")) >= 0) { throw new SkipException("Server supports protocol protocol V5 beta"); } UnsupportedProtocolVersionException e = connectWithUnsupportedBetaVersion(); assertThat(e.getUnsupportedVersion()).isEqualTo(V5); }
/** * Throws a {@link SkipException} if the input {@link CCMAccess} does not support compact storage * (C* 4.0+) * * @param ccm cluster to check against */ public static void compactStorageSupportCheck(CCMAccess ccm) { if (ccm.getCassandraVersion().compareTo(VersionNumber.parse("4.0.0")) >= 0) { throw new SkipException( "Compact tables are not allowed in Cassandra starting with 4.0 version"); } } }
@Override public void start(int n) { logger.debug( String.format("Starting: node %s (%s%s:%s) in %s", n, ipPrefix, n, binaryPort, this)); try { String cmd = CCM_COMMAND + " node%d start " + jvmArgs + getStartWaitArguments(); if (isWindows() && this.cassandraVersion.compareTo(VersionNumber.parse("2.2.4")) >= 0) { cmd += " --quiet-windows"; } execute(cmd, n); // Wait for binary interface InetSocketAddress addr = new InetSocketAddress(ipOfNode(n), binaryPort); logger.debug("Waiting for binary protocol to show up for {}", addr); TestUtils.waitUntilPortIsUp(addr); } catch (CCMException e) { logger.error(String.format("Could not start node %s in %s", n, this), e); logger.error("CCM output:\n{}", e.getOut()); setKeepLogs(true); String errors = checkForErrors(); if (errors != null) logger.error("CCM check errors:\n{}", errors); throw e; } }
@Override public void beforeTestClass(Object testInstance) throws Exception { if (CCMBridge.getGlobalCassandraVersion().compareTo(VersionNumber.parse("3.0")) >= 0) { throw new SkipException("C* 3.0+ does not support Protocol V1"); } super.beforeTestClass(testInstance); }
if (version != null && version.compareTo(requirement) < 0) { LOGGER.debug( "Skipping inclusion of '{}' in cassandra.yaml since it requires >= C* {} and {} "
@Override public void onTestContextInitialized() { is21 = ccm().getCassandraVersion().compareTo(VersionNumber.parse("2.1.3")) > 0; // only add tuples / nested collections at > 2.1.3. execute( "CREATE TABLE codec_mapping (k int PRIMARY KEY, " + "v int, l list<int>, m map<int,int>" + (is21 ? ", t tuple<int,int>, s set<frozen<list<int>>>)" : ")")); }
@Override public void onTestContextInitialized() { ProtocolVersion protocolVersion = ccm().getProtocolVersion(); samples = PrimitiveTypeSamples.samples(protocolVersion); tables = allTables(); Host host = cluster().getMetadata().getAllHosts().iterator().next(); cassandraVersion = host.getCassandraVersion().nextStable(); List<String> statements = Lists.newArrayList(); for (TestTable table : tables) { if (cassandraVersion.compareTo(table.minCassandraVersion) < 0) logger.debug( "Skipping table because it uses a feature not supported by Cassandra {}: {}", cassandraVersion, table.createStatement); else statements.add(table.createStatement); } execute(statements); }
try { String cmd = CCM_COMMAND + " start " + jvmArgs + getStartWaitArguments(); if (isWindows() && this.cassandraVersion.compareTo(VersionNumber.parse("2.2.4")) >= 0) { cmd += " --quiet-windows";
public void should_debounce_and_coalesce_multiple_alter_events_on_same_table_into_refresh_table() throws Exception { if (ccm().getCassandraVersion().compareTo(VersionNumber.parse("2.2")) >= 0) throw new SkipException("Disabled in Cassandra 2.2+ because of CASSANDRA-9996");
if (cassandraVersion.compareTo(table.minCassandraVersion) < 0) continue;
@Override public void onTestContextInitialized() { protocolVersion = cluster().getConfiguration().getProtocolOptions().getProtocolVersion(); String createTable = "CREATE TABLE indexing (" + "id int," + "id2 int," + "map_values map<text, int>," + "map_keys map<text, int>," + "map_entries map<text, int>," + "map_all map<text, int>," + "text_column text, " + "\"MixedCaseColumn\" list<text>," + // Frozen collections was introduced only in C* 2.1.3 (ccm().getCassandraVersion().compareTo(VersionNumber.parse("2.1.3")) >= 0 ? ", map_full frozen<map<text, int>>," + "set_full frozen<set<text>>," + "list_full frozen<list<text>>," : "") + "PRIMARY KEY (id, id2));"; execute(createTable); }