Runtian commented on code in PR #2649:
URL: https://github.com/apache/cassandra/pull/2649#discussion_r1317694116
##########
src/java/org/apache/cassandra/db/guardrails/EnableFlag.java:
##########
@@ -117,13 +117,33 @@ public void ensureEnabled(@Nullable ClientState state)
* want to interrupt such processes.
*/
public void ensureEnabled(String featureName, @Nullable ClientState state)
+ {
+ ensureEnabled(featureName, state, false);
+ }
+
+ /**
+ * Aborts the operation if this guardrail is not enabled.
+ *
+ * <p>This must be called when the feature guarded by this guardrail is
used to ensure such use is in fact
+ * allowed.
+ *
+ * @param featureName The feature that is guarded by this
guardrail (for reporting in error messages).
+ * @param state The client state, used to skip the check
if the query is internal or is done by a
+ * superuser. A {@code null} value means
that the check should be done regardless of
+ * the query, although it won't throw any
exception if the failure threshold isexceeded.
+ * This is so because checks without an
associated client come from asynchronous processes
+ * such as compaction, and we don't want to
interrupt such processes.
+ * @param throwOnNullClientState If this is true, an exception will be
thrown even if client state is null. This is
+ * mainly used for features not assoiate
with client state such as bulk load of SSTables.
+ */
+ public void ensureEnabled(String featureName, @Nullable ClientState state,
boolean throwOnNullClientState)
Review Comment:
sure, makes sense.
--
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]