You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ab...@apache.org on 2021/02/08 19:29:25 UTC

[nifi-minifi-cpp] branch main updated (85f05b0 -> b69562a)

This is an automated email from the ASF dual-hosted git repository.

aboda pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git.


    from 85f05b0  MINIFICPP-1455 - Fix FileStream error handling and reporting
     new 44493c0  MINIFICPP-1460: ProcessSession should penalise flowfiles on rollback
     new b69562a  MINIFICPP-1484 fix linter when not in a git tree

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 libminifi/src/core/ProcessSession.cpp       |  1 +
 libminifi/test/unit/ProcessSessionTests.cpp | 28 ++++++++++++++++++++++++++++
 thirdparty/google-styleguide/run_linter.sh  |  3 ++-
 3 files changed, 31 insertions(+), 1 deletion(-)


[nifi-minifi-cpp] 02/02: MINIFICPP-1484 fix linter when not in a git tree

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aboda pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit b69562aa6212cad9c0761d01936e016739a0bec6
Author: Marton Szasz <sz...@gmail.com>
AuthorDate: Mon Feb 8 17:44:45 2021 +0100

    MINIFICPP-1484 fix linter when not in a git tree
    
    Signed-off-by: Arpad Boda <ab...@apache.org>
    
    This closes #997
---
 thirdparty/google-styleguide/run_linter.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/thirdparty/google-styleguide/run_linter.sh b/thirdparty/google-styleguide/run_linter.sh
index 9f79313..ca0a1ad 100755
--- a/thirdparty/google-styleguide/run_linter.sh
+++ b/thirdparty/google-styleguide/run_linter.sh
@@ -40,4 +40,5 @@ done
 
 HEADERS=`find $INCLUDE_DIRS -name '*.h' | sort | uniq | tr '\n' ' '`
 SOURCES=`find $SOURCE_DIRS -name  '*.cpp' | sort | uniq | tr '\n' ' '`
-python ${SCRIPT_DIR}/cpplint.py --linelength=200 ${HEADERS} ${SOURCES}
+REPOSITORY="$(realpath --physical "$(dirname "$0")/../..")"
+python ${SCRIPT_DIR}/cpplint.py --linelength=200 --repository="$REPOSITORY" ${HEADERS} ${SOURCES}


[nifi-minifi-cpp] 01/02: MINIFICPP-1460: ProcessSession should penalise flowfiles on rollback

Posted by ab...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aboda pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit 44493c07f2b907463912f12065256071df4d21dd
Author: Martin Zink <ma...@protonmail.com>
AuthorDate: Thu Feb 4 09:26:01 2021 +0100

    MINIFICPP-1460: ProcessSession should penalise flowfiles on rollback
    
    Signed-off-by: Arpad Boda <ab...@apache.org>
    
    This closes #991
---
 libminifi/src/core/ProcessSession.cpp       |  1 +
 libminifi/test/unit/ProcessSessionTests.cpp | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/libminifi/src/core/ProcessSession.cpp b/libminifi/src/core/ProcessSession.cpp
index f8f885e..83ee2aa 100644
--- a/libminifi/src/core/ProcessSession.cpp
+++ b/libminifi/src/core/ProcessSession.cpp
@@ -791,6 +791,7 @@ void ProcessSession::rollback() {
       auto flowFile = it.second.modified;
       // restore flowFile to original state
       *flowFile = *it.second.snapshot;
+      penalize(flowFile);
       logger_->log_debug("ProcessSession rollback for %s, record %s, to connection %s",
           process_context_->getProcessorNode()->getName(),
           flowFile->getUUIDStr(),
diff --git a/libminifi/test/unit/ProcessSessionTests.cpp b/libminifi/test/unit/ProcessSessionTests.cpp
index 0847a4c..45b592c 100644
--- a/libminifi/test/unit/ProcessSessionTests.cpp
+++ b/libminifi/test/unit/ProcessSessionTests.cpp
@@ -74,3 +74,31 @@ TEST_CASE("ProcessSession::existsFlowFileInRelationship works", "[existsFlowFile
   REQUIRE(process_session.existsFlowFileInRelationship(Failure));
   REQUIRE(process_session.existsFlowFileInRelationship(Success));
 }
+
+TEST_CASE("ProcessSession::rollback penalizes affected flowfiles", "[rollback]") {
+  Fixture fixture;
+  core::ProcessSession &process_session = fixture.processSession();
+
+  const auto flow_file_1 = process_session.create();
+  const auto flow_file_2 = process_session.create();
+  const auto flow_file_3 = process_session.create();
+  process_session.transfer(flow_file_1, Success);
+  process_session.transfer(flow_file_2, Success);
+  process_session.transfer(flow_file_3, Success);
+  process_session.commit();
+
+  auto next_flow_file_to_be_processed = process_session.get();
+  REQUIRE(next_flow_file_to_be_processed == flow_file_1);
+  next_flow_file_to_be_processed = process_session.get();
+  REQUIRE(next_flow_file_to_be_processed == flow_file_2);
+  REQUIRE_FALSE(flow_file_1->isPenalized());
+  REQUIRE_FALSE(flow_file_2->isPenalized());
+  REQUIRE_FALSE(flow_file_3->isPenalized());
+
+  process_session.rollback();
+  REQUIRE(flow_file_1->isPenalized());
+  REQUIRE(flow_file_2->isPenalized());
+  REQUIRE_FALSE(flow_file_3->isPenalized());
+  next_flow_file_to_be_processed = process_session.get();
+  REQUIRE(next_flow_file_to_be_processed == flow_file_3);
+}