Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-6989

SiteToSiteReportingRecordSink reports error when no data is sent

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.11.0
    • Component/s: None
    • Labels:
      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

            Activity

              People

              • Assignee:
                mattyb149 Matt Burgess
                Reporter:
                mattyb149 Matt Burgess
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h