dcapwell commented on code in PR #3489:
URL: https://github.com/apache/cassandra/pull/3489#discussion_r1737141984
##########
test/distributed/org/apache/cassandra/distributed/test/accord/AccordTestBase.java:
##########
@@ -439,12 +439,14 @@ private static boolean isIdempotent(Cluster cluster,
String cql)
});
}
- private static String wrapInTxn(String statement)
+ protected static String wrapInTxn(String statement)
{
if (!statement.trim().toUpperCase().startsWith("BEGIN TRANSACTION"))
{
statement = statement.trim();
- statement =
Arrays.stream(statement.split("\\n")).collect(Collectors.joining("\n ", "BEGIN
TRANSACTION\n ", "\nCOMMIT TRANSACTION"));
+ statement = Arrays.stream(statement.split("\\n"))
+ .map(line -> line.trim().endsWith(";") ? line :
line + ';')
Review Comment:
we have different methods... this one is a single `String` and the most
common case is a single statement... so why force `;` in those cases? If you
have multiple statements in this string we still split by `\n`, but it gets
weird looking... for those cases its far more common to use a different method
that takes `String...`
--
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]