michaelsembwever commented on code in PR #3696:
URL: https://github.com/apache/cassandra/pull/3696#discussion_r2725807926
##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -4769,27 +4769,67 @@ public static long getGCLogThreshold()
public static void setGCLogThreshold(int threshold)
{
- if (threshold <= 0)
- throw new IllegalArgumentException("Threshold value for
gc_log_threshold must be greater than 0");
+ validateGCParams(threshold, getGCWarnThreshold());
+ conf.gc_log_threshold = new
DurationSpec.IntMillisecondsBound(threshold);
+ }
- long gcWarnThresholdInMs = getGCWarnThreshold();
- if (gcWarnThresholdInMs != 0 && threshold > gcWarnThresholdInMs)
- throw new IllegalArgumentException("Threshold value for
gc_log_threshold (" + threshold + ") must be less than gc_warn_threshold which
is currently "
- + gcWarnThresholdInMs);
+ public static void validateGCParams(long logThreshold, long warnThreshold)
+ {
+ if (logThreshold <= 0)
+ throw new IllegalArgumentException("Threshold value for
gc_log*_threshold must be greater than 0");
+ if (logThreshold > Integer.MAX_VALUE)
+ throw new IllegalArgumentException("Threshold value for
gc_log*_threshold must be less than Integer.MAX_VALUE");
+
+ if (warnThreshold <= 0)
+ throw new IllegalArgumentException("Threshold value for
gc_warn*_threshold must be greater than 0");
+ if (warnThreshold > Integer.MAX_VALUE)
+ throw new IllegalArgumentException("Threshold value for
gc_warn*_threshold must be less than Integer.MAX_VALUE");
+
+ if (warnThreshold != 0 && logThreshold > warnThreshold)
+ throw new IllegalArgumentException("Threshold value for
gc_log*_threshold (" + logThreshold + ") must be less than gc_warn*_threshold
which is currently "
+ + warnThreshold);
+ }
+
+ public static long getZGCLogThreshold()
+ {
+ return conf.gc_log_zgc_threshold.toMilliseconds();
+ }
+
+ public static void setZGCLogThreshold(long threshold)
+ {
+ validateGCParams(threshold, getZGCWarnThreshold());
+ conf.gc_log_zgc_threshold = new
DurationSpec.IntMillisecondsBound(threshold);
+ }
+
+ public static long getGCPauseLogThreshold()
+ {
+ return conf.gc_pause_log_threshold.toMilliseconds();
+ }
+
+ public static void setGCPauseLogThreshold(long threshold)
+ {
+ conf.gc_pause_log_threshold = new
DurationSpec.IntMillisecondsBound(threshold);
+ }
+
+ public static EncryptionContext getEncryptionContext()
+ {
+ return encryptionContext;
- conf.gc_log_threshold = new
DurationSpec.IntMillisecondsBound(threshold);
}
public static long getGCWarnThreshold()
{
return conf.gc_warn_threshold.toMilliseconds();
}
- public static void setGCWarnThreshold(int threshold)
+ public static void setGCWarnThreshold(long threshold)
{
if (threshold < 0)
throw new IllegalArgumentException("Threshold value for
gc_warn_threshold must be greater than or equal to 0");
+ if (threshold > Integer.MAX_VALUE)
+ throw new IllegalArgumentException("Threshold must be less than
Integer.MAX_VALUE");
Review Comment:
if the parameter type should be long but still be under `Integer.MAX_VALUE`
it (IMHO) deserves a comment as to why, as it looks odd.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]