Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,10 @@ pipeline {
choices: ['2.1', // Legacy Apache CassandraⓇ
'2.2', // Legacy Apache CassandraⓇ
'3.0', // Previous Apache CassandraⓇ
'3.11', // Current Apache CassandraⓇ
'4.0', // Development Apache CassandraⓇ
'3.11', // Previous Apache CassandraⓇ
'4.0', // Previous Apache CassandraⓇ
'4.1', // Current Apache CassandraⓇ
'5.0', // Development Apache CassandraⓇ
'dse-4.8.16', // Previous EOSL DataStax Enterprise
'dse-5.0.15', // Long Term Support DataStax Enterprise
'dse-5.1.35', // Legacy DataStax Enterprise
Expand Down Expand Up @@ -291,7 +293,11 @@ pipeline {
</tr>
<tr>
<td><strong>4.0</strong></td>
<td>Apache Cassandra&reg; v4.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
<td>Apache Cassandra&reg; v4.0.x</td>
</tr>
<tr>
<td><strong>4.1</strong></td>
<td>Apache Cassandra&reg; v4.1.x</td>
</tr>
<tr>
<td><strong>dse-4.8.16</strong></td>
Expand Down Expand Up @@ -445,7 +451,7 @@ pipeline {
axis {
name 'SERVER_VERSION'
values '3.11', // Latest stable Apache CassandraⓇ
'4.0', // Development Apache CassandraⓇ
'4.1', // Development Apache CassandraⓇ
'dse-6.8.30' // Current DataStax Enterprise
}
axis {
Expand Down Expand Up @@ -554,8 +560,10 @@ pipeline {
name 'SERVER_VERSION'
values '2.1', // Legacy Apache CassandraⓇ
'3.0', // Previous Apache CassandraⓇ
'3.11', // Current Apache CassandraⓇ
'4.0', // Development Apache CassandraⓇ
'3.11', // Previous Apache CassandraⓇ
'4.0', // Previous Apache CassandraⓇ
'4.1', // Current Apache CassandraⓇ
'5.0', // Development Apache CassandraⓇ
'dse-4.8.16', // Previous EOSL DataStax Enterprise
'dse-5.0.15', // Last EOSL DataStax Enterprise
'dse-5.1.35', // Legacy DataStax Enterprise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class Version implements Comparable<Version>, Serializable {
@NonNull public static final Version V2_2_0 = Objects.requireNonNull(parse("2.2.0"));
@NonNull public static final Version V3_0_0 = Objects.requireNonNull(parse("3.0.0"));
@NonNull public static final Version V4_0_0 = Objects.requireNonNull(parse("4.0.0"));
@NonNull public static final Version V4_1_0 = Objects.requireNonNull(parse("4.1.0"));
@NonNull public static final Version V5_0_0 = Objects.requireNonNull(parse("5.0.0"));
@NonNull public static final Version V6_7_0 = Objects.requireNonNull(parse("6.7.0"));
@NonNull public static final Version V6_8_0 = Objects.requireNonNull(parse("6.8.0"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,19 @@ public void should_get_virtual_metadata() {
+ " total bigint,\n"
+ " unit text,\n"
+ " PRIMARY KEY (keyspace_name, table_name, task_id)\n"
+ "); */",
// Cassandra 4.1
"/* VIRTUAL TABLE system_views.sstable_tasks (\n"
+ " keyspace_name text,\n"
+ " table_name text,\n"
+ " task_id timeuuid,\n"
+ " completion_ratio double,\n"
+ " kind text,\n"
+ " progress bigint,\n"
+ " sstables int,\n"
+ " total bigint,\n"
+ " unit text,\n"
+ " PRIMARY KEY (keyspace_name, table_name, task_id)\n"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table changed slightly with 4.1.x:

  • task_id became a timeuuid
  • sstables field was introduced

+ "); */");
// ColumnMetadata is as expected
ColumnMetadata cm = tm.getColumn("progress").get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,33 @@ public void create() {
Arrays.stream(nodes).mapToObj(n -> "" + n).collect(Collectors.joining(":")),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes in this file aim to address configuration changes in Cassandra 4.1 brought in by CASSANDRA-15234

createOptions.stream().collect(Collectors.joining(" ")));

Version cassandraVersion = getCassandraVersion();
for (Map.Entry<String, Object> conf : cassandraConfiguration.entrySet()) {
execute("updateconf", String.format("%s:%s", conf.getKey(), conf.getValue()));
String originalKey = conf.getKey();
Object originalValue = conf.getValue();
execute(
"updateconf",
String.join(
":",
getConfigKey(originalKey, originalValue, cassandraVersion),
getConfigValue(originalKey, originalValue, cassandraVersion)));
}
if (getCassandraVersion().compareTo(Version.V2_2_0) >= 0) {
execute("updateconf", "enable_user_defined_functions:true");

// If we're dealing with anything more recent than 2.2 explicitly enable UDF... but run it
// through our conversion process to make
// sure more recent versions don't have a problem.
if (cassandraVersion.compareTo(Version.V2_2_0) >= 0) {
String originalKey = "enable_user_defined_functions";
Object originalValue = "true";
execute(
"updateconf",
String.join(
":",
getConfigKey(originalKey, originalValue, cassandraVersion),
getConfigValue(originalKey, originalValue, cassandraVersion)));
}

// Note that we aren't performing any substitution on DSE key/value props (at least for now)
if (DSE_ENABLEMENT) {
for (Map.Entry<String, Object> conf : dseConfiguration.entrySet()) {
execute("updatedseconf", String.format("%s:%s", conf.getKey(), conf.getValue()));
Expand Down Expand Up @@ -463,6 +484,40 @@ private Optional<Integer> overrideJvmVersionForDseWorkloads() {
return Optional.empty();
}

private static String IN_MS_STR = "_in_ms";
private static int IN_MS_STR_LENGTH = IN_MS_STR.length();
private static String ENABLE_STR = "enable_";
private static int ENABLE_STR_LENGTH = ENABLE_STR.length();
private static String IN_KB_STR = "_in_kb";
private static int IN_KB_STR_LENGTH = IN_KB_STR.length();

@SuppressWarnings("unused")
private String getConfigKey(String originalKey, Object originalValue, Version cassandraVersion) {

// At least for now we won't support substitutions on nested keys. This requires an extra
// traversal of the string
// but we'll live with that for now
if (originalKey.contains(".")) return originalKey;
if (cassandraVersion.compareTo(Version.V4_1_0) < 0) return originalKey;
if (originalKey.endsWith(IN_MS_STR))
return originalKey.substring(0, originalKey.length() - IN_MS_STR_LENGTH);
if (originalKey.startsWith(ENABLE_STR))
return originalKey.substring(ENABLE_STR_LENGTH) + "_enabled";
if (originalKey.endsWith(IN_KB_STR))
return originalKey.substring(0, originalKey.length() - IN_KB_STR_LENGTH);
return originalKey;
}

private String getConfigValue(
String originalKey, Object originalValue, Version cassandraVersion) {

String originalValueStr = originalValue.toString();
if (cassandraVersion.compareTo(Version.V4_1_0) < 0) return originalValueStr;
if (originalKey.endsWith(IN_MS_STR)) return originalValueStr + "ms";
if (originalKey.endsWith(IN_KB_STR)) return originalValueStr + "KiB";
return originalValueStr;
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not intended to be an exhaustive set of changes required to support CASSANDRA-15234. For now I'm just worried about the set of props necessary to support the current collection of ITs; we can always update this as necessary if new configs need to be added for future test customization.


public static Builder builder() {
return new Builder();
}
Expand Down