Matt Burgess created NIFI-6989:
----------------------------------
Summary: SiteToSiteReportingRecordSink reports error when no data
is sent
Key: NIFI-6989
URL: https://issues.apache.org/jira/browse/NIFI-6989
Project: Apache NiFi
Issue Type: Bug
Reporter: Matt Burgess
If no data is transmitted during a transaction in
SiteToSiteReportingRecordSink, the following error is thrown:
Error during transmission of query results due to Failed to write metrics using
record writer: Cannot confirm Transaction because state is TRANSACTION_STARTED;
Transaction can only be confirmed when state is DATA_EXCHANGED:
java.io.IOException: Failed to write metrics using record writer: Cannot
confirm Transaction because state is TRANSACTION_STARTED; Transaction can only
be confirmed when state is DATA_EXCHANGED
java.io.IOException: Failed to write metrics using record writer: Cannot
confirm Transaction because state is TRANSACTION_STARTED; Transaction can only
be confirmed when state is DATA_EXCHANGED
at
org.apache.nifi.reporting.sink.SiteToSiteReportingRecordSink.sendData(SiteToSiteReportingRecordSink.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)
This can be reproduced by using QueryNiFiReportingTask with a query that
returns no rows (such as SELECT * FROM CONNECTION_STATUS WHERE 1=0) when Send
Zero Results is false.
The call to confirm() and complete() should only be done when a send() has
occurred, so it needs to be moved inside the if-block above it.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)