Elffuss BraidHub

kikocis/java-driver public

Update WarningsTest for CASSANDRA-10786

CASSANDRA-10876 alters the behavior of batch warnings by only
considering batch size for batches that include more than one mutation.
Changeset4d66e418ce748757e51dae05398a680ddd7574076b60c3006b8b7e2689bf231b
AuthorAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-07-18 12:07 -05:00
CommitterAndrew Tolbert <andrew.tolbert@datastax.com> · 2016-07-19 13:23 -05:00
Parents34d0d33aadac

Browse the files at this changeset

1 file changed

modified driver-core/src/test/java/com/datastax/driver/core/WarningsTest.java +8 −7
@@ -25,11 +25,6 @@
2525
2626 public class WarningsTest extends CCMTestsSupport {
2727
28- /**
29- * This is Cassandra's default value, found in o.a.c.config.Config
30- */
31- private static final int BATCH_SIZE_WARN_THRESHOLD_IN_BYTES = 5 * 1024;
32-
3328 @Override
3429 public void onTestContextInitialized() {
3530 execute("CREATE TABLE foo(k int primary key, v text)");
@@ -38,8 +33,14 @@
3833 @CassandraVersion(major = 2.2)
3934 @Test(groups = "short")
4035 public void should_expose_warnings_on_execution_info() {
41- ResultSet rs = session().execute(String.format("BEGIN UNLOGGED BATCH INSERT INTO foo (k, v) VALUES (1, '%s') APPLY BATCH",
42- Strings.repeat("1", BATCH_SIZE_WARN_THRESHOLD_IN_BYTES)));
36+ // the default batch size warn threshold is 5 * 1024 bytes, but after CASSANDRA-10876 there must be
37+ // multiple mutations in a batch to trigger this warning so the batch includes 2 different inserts.
38+ ResultSet rs = session().execute(String.format("BEGIN UNLOGGED BATCH\n" +
39+ "INSERT INTO foo (k, v) VALUES (1, '%s')\n" +
40+ "INSERT INTO foo (k, v) VALUES (2, '%s')\n" +
41+ "APPLY BATCH",
42+ Strings.repeat("1", 2 * 1024),
43+ Strings.repeat("1", 3 * 1024)));
4344
4445 List<String> warnings = rs.getExecutionInfo().getWarnings();
4546 assertThat(warnings).hasSize(1);