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 2022/03/14 15:28:46 UTC

[GitHub] [cassandra] josh-mckenzie commented on a change in pull request #1496: CASSANDRA-17430 trunk: Improve guardrails messages

josh-mckenzie commented on a change in pull request #1496:
URL: https://github.com/apache/cassandra/pull/1496#discussion_r826072044



##########
File path: test/unit/org/apache/cassandra/db/guardrails/GuardrailViewsPerTableTest.java
##########
@@ -24,7 +24,7 @@
 import static java.lang.String.format;
 
 /**
- * Tests the guardrail for the number of secondary indexes in a table, {@link Guardrails#secondaryIndexesPerTable}.
+ * Tests the guardrail for the number of materialized veiews in a table, {@link Guardrails#materializedViewsPerTable}.

Review comment:
       nit: views

##########
File path: src/java/org/apache/cassandra/db/guardrails/Guardrail.java
##########
@@ -70,13 +81,22 @@ protected void warn(String message)
 
     protected void fail(String message)
     {
+        message = decorateMessage(message);
+
         logger.error(message);
         // Note that ClientWarn will simply ignore the message if we're not running this as part of a user query
         // (the internal "state" will be null)
         ClientWarn.instance.warn(message);
         // Similarly, tracing will also ignore the message if we're not running tracing on the current thread.
         Tracing.trace(message);
 
-        throw new InvalidRequestException(message);
+        throw new GuardrailViolatedException(message);
+    }
+
+    @VisibleForTesting
+    String decorateMessage(String message)
+    {
+        // Add a prefix to error message so user know that thew warning or failure is caused by guardrails

Review comment:
       nit: "so user knows what threw the warning or cause the failure"




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