@@ -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