Copilot commented on code in PR #4596:
URL: https://github.com/apache/cassandra/pull/4596#discussion_r2977702315
##########
src/java/org/apache/cassandra/db/guardrails/Guardrails.java:
##########
@@ -1925,4 +1951,16 @@ private static long
minimumTimestampAsRelativeMicros(@Nullable DurationSpec.Long
? Long.MIN_VALUE
: (ClientState.getLastTimestampMicros() -
duration.toMicroseconds());
}
+
+ public static void onMisprepared(ClientState state, String keyspace,
String tableName)
+ {
+ if (preparedStatementsRequireParametersEnabled.isEnabled(state) &&
preparedStatementsRequireParametersEnabled.enabled(state))
+ {
+
preparedStatementsRequireParametersEnabled.fail(preparedStatementsRequireParametersEnabled.name
+ " is not allowed", state);
Review Comment:
The failure message `prepared_statements_require_parameters_enabled is not
allowed` is not very actionable for users; it repeats the config name rather
than explaining what was wrong with the prepared statement (e.g., prepared with
only literals and no bind markers). Updating the failure text to describe the
violation would make troubleshooting much easier.
```suggestion
preparedStatementsRequireParametersEnabled.fail(
"Misprepared statement: prepared statements must use bind
markers (parameters); "
+ "statements with only literal values are not allowed when
guardrail "
+ "'prepared_statements_require_parameters_enabled' is
enabled.",
state);
```
--
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]