You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/12/09 11:39:17 UTC

[GitHub] [cassandra] adelapena commented on a change in pull request #1356: CASSANDRA-17195 trunk: Migrate thresholds for number of keyspaces and tables to guardrails

adelapena commented on a change in pull request #1356:
URL: https://github.com/apache/cassandra/pull/1356#discussion_r765707589



##########
File path: src/java/org/apache/cassandra/config/GuardrailsOptions.java
##########
@@ -122,48 +135,59 @@ public boolean getUserTimestampsEnabled()
 
     public void setUserTimestampsEnabled(boolean enabled)
     {
-        user_timestamps_enabled = enabled;
+        updatePropertyWithLogging(NAME_PREFIX + "user_timestamps_enabled",
+                                  enabled,
+                                  () -> user_timestamps_enabled,
+                                  x -> user_timestamps_enabled = x);
     }
 
-    public static abstract class Threshold implements org.apache.cassandra.db.guardrails.Threshold.Config
+    private static <T> void updatePropertyWithLogging(String name, T value, Supplier<T> getter, Consumer<T> setter)

Review comment:
       This method exists to make sure that all property updates use the same format for logging message. It allows us to change whether the log messages are emitted after of before the property update without changing the callers. Alternatively, if we find it too complex we could simply use a method for logging without updating. This method will be called after updating the properties, receiving the previous and updated value of the property. 




-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org