Uploaded image for project: 'Apache NiFi MiNiFi C++'
  1. Apache NiFi MiNiFi C++
  2. MINIFICPP-2291

Site-to-site client should treat TRANSACTION_FINISHED_BUT_DESTINATION_FULL as (qualified) success

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 0.99.0
    • None

    Description

      Currently, the site-to-site client in MiNiFi only accepts TRANSACTION_FINISHED(13) as a success code, and it treats everything else as failure:

      https://github.com/apache/nifi-minifi-cpp/blob/9e4ef8d59dbbe345c889edb2f3ed13c98513c96d/libminifi/src/sitetosite/SiteToSiteClient.cpp#L385

      if (code == TRANSACTION_FINISHED) {
        logger_->log_info("Site2Site transaction {} peer finished transaction", transactionID.to_string());
        transaction->_state = TRANSACTION_COMPLETED;
        return true;
      } else {
        logger_->log_warn("Site2Site transaction {} peer unknown respond code {}", transactionID.to_string(), magic_enum::enum_underlying(code));
        return false;
      }

      On the other hand, the NiFi site-to-site client treats both TRANSACTION_FINISHED(13) and TRANSACTION_FINISHED_BUT_DESTINATION_FULL(14) as success codes:

      https://github.com/apache/nifi/blob/3fcf5f25b4c705f6909d058d81a7b8b6d6a648f1/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/http/StandardHttpFlowFileServerProtocol.java#L120

                  switch (response) {
                      case CONFIRM_TRANSACTION:
                          logger.debug("{} Confirming transaction. checksum={}", this, explanation);
                          commSession.setChecksum(explanation);
                          commSession.setStatus(Transaction.TransactionState.DATA_EXCHANGED);
                          break;
                      case TRANSACTION_FINISHED:
                      case TRANSACTION_FINISHED_BUT_DESTINATION_FULL:
                          logger.debug("{} Transaction is completed. responseCode={}", this, response);
                          commSession.setStatus(Transaction.TransactionState.TRANSACTION_COMPLETED);
                          break;
                  }

      https://github.com/apache/nifi/blob/3fcf5f25b4c705f6909d058d81a7b8b6d6a648f1/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/protocol/AbstractFlowFileServerProtocol.java#L371

              logger.debug("{} received {} from {}", new Object[]{this, transactionResponse, peer});
              if (transactionResponse.getCode() == ResponseCode.TRANSACTION_FINISHED_BUT_DESTINATION_FULL) {
                  peer.penalize(port.getIdentifier(), port.getYieldPeriod(TimeUnit.MILLISECONDS));
              } else if (transactionResponse.getCode() != ResponseCode.TRANSACTION_FINISHED) {
                  throw new ProtocolException("After sending data, expected TRANSACTION_FINISHED response but got " + transactionResponse);
              }

      TRANSACTION_FINISHED_BUT_DESTINATION_FULL(14) can happen when the number or the total size of the files in the batch exceed the limits set in the Back Pressure settings of the outgoing connection of the input port on the server side.

      MiNiFi should behave in the same way as NiFi: accept TRANSACTION_FINISHED_BUT_DESTINATION_FULL(14) as success, but the remote processor group should yield, so the server has time to clear the connection.

      Attachments

        Issue Links

          Activity

            People

              fgerlits Ferenc Gerlits
              fgerlits Ferenc Gerlits
              Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 20m
                  20m