use of com.datastax.oss.dsbulk.tests.utils.StringUtils.quoteJson in project dsbulk by datastax.
the class JsonConnectorEndToEndCCMIT method full_load_query_warnings.
/**
* Test for DAT-451.
*/
@Test
void full_load_query_warnings() throws Exception {
assumeTrue(ccm.getCassandraVersion().compareTo(V3) >= 0, "Query warnings are only present in C* >= 3.0");
List<String> args = new ArrayList<>();
args.add("load");
args.add("--connector.name");
args.add("json");
args.add("--log.maxQueryWarnings");
args.add("1");
args.add("--connector.json.url");
args.add(StringUtils.quoteJson(JsonUtils.JSON_RECORDS));
args.add("--batch.mode");
args.add("REPLICA_SET");
args.add("--schema.keyspace");
args.add(session.getKeyspace().get().asInternal());
args.add("--schema.table");
args.add("ip_by_country");
ExitStatus status = new DataStaxBulkLoader(addCommonSettings(args)).run();
assertStatus(status, STATUS_OK);
validateResultSetSize(500, "SELECT * FROM ip_by_country");
validatePositionsFile(JsonUtils.JSON_RECORDS, 500);
/*
Unlogged batch covering N partitions detected against table [ks1.ip_by_country].
You should use a logged batch for atomicity, or asynchronous writes for performance.
DSE 6.0+:
Unlogged batch covering 20 partitions detected against table {ks1.ip_by_country}.
You should use a logged batch for atomicity, or asynchronous writes for performance.
*/
assertThat(logs).hasMessageContaining("Query generated server-side warning").hasMessageMatching("Unlogged batch covering \\d+ partitions detected").hasMessageContaining(session.getKeyspace().get().asCql(true) + ".ip_by_country").hasMessageContaining("The maximum number of logged query warnings has been exceeded (1); " + "subsequent warnings will not be logged.");
assertThat(stderr.getStreamLinesPlain()).anySatisfy(line -> assertThat(line).contains("Query generated server-side warning")).anySatisfy(line -> assertThat(line).containsPattern("Unlogged batch covering \\d+ partitions detected")).anySatisfy(line -> assertThat(line).contains(session.getKeyspace().get().asCql(true) + ".ip_by_country")).anySatisfy(line -> assertThat(line).contains("The maximum number of logged query warnings has been exceeded (1); " + "subsequent warnings will not be logged."));
}
Aggregations