Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
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.
Attachments
Issue Links
- relates to
-
NIFI-6990 SiteToSite handlers throw errors when transaction cancelled with no data sent
-
- Open
-
- links to