Skip to content

Commit 8ba9a47

Browse files
committed
Merge commit '1492d6ced9d54bdd68deb043a0bfe232eaa2a8fc' of https://github.com/apache/cassandra-java-driver into pull-upstream-4.18.1-v3
Merged in translation between older and newer variations of config keys and values. Discarded some adjustments for upstream's Jenkins setup which conflicted with adjustments for our CI.
2 parents b0ad953 + 1492d6c commit 8ba9a47

File tree

2 files changed

+60
-14
lines changed

2 files changed

+60
-14
lines changed

Jenkinsfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,10 @@ pipeline {
256256
choices: ['2.1', // Legacy Apache CassandraⓇ
257257
'2.2', // Legacy Apache CassandraⓇ
258258
'3.0', // Previous Apache CassandraⓇ
259-
'3.11', // Current Apache CassandraⓇ
260-
'4.0', // Development Apache CassandraⓇ
259+
'3.11', // Previous Apache CassandraⓇ
260+
'4.0', // Previous Apache CassandraⓇ
261+
'4.1', // Current Apache CassandraⓇ
262+
'5.0', // Development Apache CassandraⓇ
261263
'dse-4.8.16', // Previous EOSL DataStax Enterprise
262264
'dse-5.0.15', // Long Term Support DataStax Enterprise
263265
'dse-5.1.35', // Legacy DataStax Enterprise
@@ -291,7 +293,11 @@ pipeline {
291293
</tr>
292294
<tr>
293295
<td><strong>4.0</strong></td>
294-
<td>Apache Cassandra&reg; v4.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
296+
<td>Apache Cassandra&reg; v4.0.x</td>
297+
</tr>
298+
<tr>
299+
<td><strong>4.1</strong></td>
300+
<td>Apache Cassandra&reg; v4.1.x</td>
295301
</tr>
296302
<tr>
297303
<td><strong>dse-4.8.16</strong></td>
@@ -445,7 +451,7 @@ pipeline {
445451
axis {
446452
name 'SERVER_VERSION'
447453
values '3.11', // Latest stable Apache CassandraⓇ
448-
'4.0', // Development Apache CassandraⓇ
454+
'4.1', // Development Apache CassandraⓇ
449455
'dse-6.8.30' // Current DataStax Enterprise
450456
}
451457
axis {
@@ -554,8 +560,10 @@ pipeline {
554560
name 'SERVER_VERSION'
555561
values '2.1', // Legacy Apache CassandraⓇ
556562
'3.0', // Previous Apache CassandraⓇ
557-
'3.11', // Current Apache CassandraⓇ
558-
'4.0', // Development Apache CassandraⓇ
563+
'3.11', // Previous Apache CassandraⓇ
564+
'4.0', // Previous Apache CassandraⓇ
565+
'4.1', // Current Apache CassandraⓇ
566+
'5.0', // Development Apache CassandraⓇ
559567
'dse-4.8.16', // Previous EOSL DataStax Enterprise
560568
'dse-5.0.15', // Last EOSL DataStax Enterprise
561569
'dse-5.1.35', // Legacy DataStax Enterprise

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -377,22 +377,26 @@ public void create() {
377377
// Works around the behavior introduced in https://github.com/scylladb/scylla-ccm/pull/410
378378
StringBuilder updateConfArguments = new StringBuilder();
379379

380-
for (Map.Entry<String, Object> conf : cassandraConfiguration.entrySet()) {
381-
updateConfArguments.append(conf.getKey()).append(':').append(conf.getValue()).append(' ');
382-
}
380+
Version cassandraVersion = getCassandraVersion();
381+
383382
if (getCassandraVersion().compareTo(Version.V2_2_0) >= 0 && !SCYLLA_ENABLEMENT) {
384383
// @IntegrationTestDisabledScyllaJVMArgs @IntegrationTestDisabledScyllaUDF
385-
if (getCassandraVersion().compareTo(Version.V4_1_0) >= 0) {
386-
updateConfArguments.append("user_defined_functions_enabled:true").append(' ');
384+
cassandraConfiguration.put("enable_user_defined_functions", "true");
385+
}
387386

388-
} else {
389-
updateConfArguments.append("enable_user_defined_functions:true").append(' ');
390-
}
387+
for (Map.Entry<String, Object> conf : cassandraConfiguration.entrySet()) {
388+
String originalKey = conf.getKey();
389+
Object originalValue = conf.getValue();
390+
String configKey = getConfigKey(originalKey, originalValue, cassandraVersion);
391+
String configValue = getConfigValue(originalKey, originalValue, cassandraVersion);
392+
updateConfArguments.append(configKey).append(':').append(configValue).append(' ');
391393
}
392394

393395
if (updateConfArguments.length() > 0) {
394396
execute("updateconf", updateConfArguments.toString());
395397
}
398+
399+
// Note that we aren't performing any substitution on DSE key/value props (at least for now)
396400
if (DSE_ENABLEMENT) {
397401
for (Map.Entry<String, Object> conf : dseConfiguration.entrySet()) {
398402
execute("updatedseconf", String.format("%s:%s", conf.getKey(), conf.getValue()));
@@ -616,6 +620,40 @@ public String getNodeIpAddress(int nodeId) {
616620
return ipPrefix + nodeId;
617621
}
618622

623+
private static String IN_MS_STR = "_in_ms";
624+
private static int IN_MS_STR_LENGTH = IN_MS_STR.length();
625+
private static String ENABLE_STR = "enable_";
626+
private static int ENABLE_STR_LENGTH = ENABLE_STR.length();
627+
private static String IN_KB_STR = "_in_kb";
628+
private static int IN_KB_STR_LENGTH = IN_KB_STR.length();
629+
630+
@SuppressWarnings("unused")
631+
private String getConfigKey(String originalKey, Object originalValue, Version cassandraVersion) {
632+
633+
// At least for now we won't support substitutions on nested keys. This requires an extra
634+
// traversal of the string
635+
// but we'll live with that for now
636+
if (originalKey.contains(".")) return originalKey;
637+
if (cassandraVersion.compareTo(Version.V4_1_0) < 0) return originalKey;
638+
if (originalKey.endsWith(IN_MS_STR))
639+
return originalKey.substring(0, originalKey.length() - IN_MS_STR_LENGTH);
640+
if (originalKey.startsWith(ENABLE_STR))
641+
return originalKey.substring(ENABLE_STR_LENGTH) + "_enabled";
642+
if (originalKey.endsWith(IN_KB_STR))
643+
return originalKey.substring(0, originalKey.length() - IN_KB_STR_LENGTH);
644+
return originalKey;
645+
}
646+
647+
private String getConfigValue(
648+
String originalKey, Object originalValue, Version cassandraVersion) {
649+
650+
String originalValueStr = originalValue.toString();
651+
if (cassandraVersion.compareTo(Version.V4_1_0) < 0) return originalValueStr;
652+
if (originalKey.endsWith(IN_MS_STR)) return originalValueStr + "ms";
653+
if (originalKey.endsWith(IN_KB_STR)) return originalValueStr + "KiB";
654+
return originalValueStr;
655+
}
656+
619657
public static Builder builder() {
620658
return new Builder();
621659
}

0 commit comments

Comments
 (0)