Dennis Boettcher created NIFI-6016:
--------------------------------------
Summary: PutCassandraRecord handles batch size incorrect
Key: NIFI-6016
URL: https://issues.apache.org/jira/browse/NIFI-6016
Project: Apache NiFi
Issue Type: Bug
Affects Versions: 1.8.0
Reporter: Dennis Boettcher
Having 100 records and a batch size of 10 I expected 10 BatchStatements with
each 10 statements to be executed against Cassandra. The actual behaviour is
that 1 BatchStatement with 10 statements and 1 BatchStatement with 90
statements is executed against Cassandra. The reason for that is the check of
the batch size:
{code:java}
if (recordsAdded.incrementAndGet() == batchSize) {
connectionSession.execute(batchStatement);
batchStatement.clear();
}
{code}
Since 'recordsAdded' is never reset it will match the 'batchSize' either once
or never but never more than once.
I've changed it like this which produces the expected behaviour:
{code:java}
if (recordsAdded.incrementAndGet() == batchSize) {
connectionSession.execute(batchStatement);
batchStatement.clear();
recordsAdded.set(0);
}
{code}
Do I expect the wrong thing or is it an issue?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)