You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/08/15 14:33:31 UTC

[GitHub] [nifi-minifi-cpp] szaszm opened a new pull request, #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

szaszm opened a new pull request, #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388

   Because the C2 server has no way of communicating which component to start/stop in case of duplicate names. It also changes the manifest JSON schema based on whether a name is unique or duplicate. This makes JSON parsing harder on the server side.
   
   https://issues.apache.org/jira/browse/MINIFICPP-1896
   
   ---
   
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [x] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [x] If applicable, have you updated the LICENSE file?
   - [x] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [x] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
szaszm commented on code in PR #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388#discussion_r946473092


##########
libminifi/test/integration/StateTransactionalityTests.cpp:
##########
@@ -72,8 +72,7 @@ class StatefulIntegrationTest : public IntegrationBase {
         // set hooks
         const auto processController = dynamic_cast<ProcessorController*>(&component);
         assert(processController != nullptr);
-        stateful_processor_ = dynamic_cast<StatefulProcessor*>(processController->getProcessor());
-        assert(stateful_processor_ != nullptr);

Review Comment:
   The return type of getProcessor is a reference now, it's always present. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
szaszm commented on code in PR #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388#discussion_r946876053


##########
extensions/http-curl/tests/HTTPHandlers.h:
##########
@@ -590,7 +590,7 @@ class HeartbeatHandler : public ServerAwareHandler {
       case minifi::c2::Operation::STOP: {
         auto operands = getOperandsOfProperties(operation_node);
         assert(operands.find("c2") != operands.end());
-        assert(operands.find("FlowController") != operands.end());
+        // FlowController is also present, but this handler has no way of knowing its UUID to test it

Review Comment:
   This doesn't work, because there are tests that don't verify all components.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
szaszm commented on code in PR #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388#discussion_r946473092


##########
libminifi/test/integration/StateTransactionalityTests.cpp:
##########
@@ -72,8 +72,7 @@ class StatefulIntegrationTest : public IntegrationBase {
         // set hooks
         const auto processController = dynamic_cast<ProcessorController*>(&component);
         assert(processController != nullptr);
-        stateful_processor_ = dynamic_cast<StatefulProcessor*>(processController->getProcessor());
-        assert(stateful_processor_ != nullptr);

Review Comment:
   ~The return type of getProcessor is a reference now, it's always present. ~
   
   Well, I missed the fact that `dynamic_cast` can still return null. Will revert.



##########
libminifi/test/integration/StateTransactionalityTests.cpp:
##########
@@ -72,8 +72,7 @@ class StatefulIntegrationTest : public IntegrationBase {
         // set hooks
         const auto processController = dynamic_cast<ProcessorController*>(&component);
         assert(processController != nullptr);
-        stateful_processor_ = dynamic_cast<StatefulProcessor*>(processController->getProcessor());
-        assert(stateful_processor_ != nullptr);

Review Comment:
   ~The return type of getProcessor is a reference now, it's always present.~
   
   Well, I missed the fact that `dynamic_cast` can still return null. Will revert.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] fgerlits commented on a diff in pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
fgerlits commented on code in PR #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388#discussion_r946564214


##########
extensions/http-curl/tests/HTTPHandlers.h:
##########
@@ -590,7 +590,7 @@ class HeartbeatHandler : public ServerAwareHandler {
       case minifi::c2::Operation::STOP: {
         auto operands = getOperandsOfProperties(operation_node);
         assert(operands.find("c2") != operands.end());
-        assert(operands.find("FlowController") != operands.end());
+        // FlowController is also present, but this handler has no way of knowing its UUID to test it

Review Comment:
   can we assert that `operands.size() == verify_components.size() + 2` (with a comment about `FlowController`)?



##########
libminifi/src/FlowController.cpp:
##########
@@ -558,19 +552,20 @@ std::vector<state::StateController*> FlowController::getAllProcessorControllers(
   return controllerVec;
 }
 
-state::StateController* FlowController::getProcessorController(const std::string& name, const std::function<std::unique_ptr<state::ProcessorController>(core::Processor&)>& controllerFactory) {
-  auto* processor = root_->findProcessorByName(name);
-  if (processor == nullptr) {
-    logger_->log_error("Could not get processor controller for requested name \"%s\", because processor was not found either", name);
-    return nullptr;
-  }
-
-  // reference to the existing or newly created controller
-  auto& foundController = processor_to_controller_[processor->getUUID()];
-  if (!foundController) {
-    foundController = controllerFactory(*processor);
-  }
-  return foundController.get();
+state::StateController* FlowController::getProcessorController(const std::string& id_or_name, const std::function<std::unique_ptr<state::ProcessorController>(core::Processor&)>& controllerFactory) {

Review Comment:
   you added a `gsl::not_null` to the return type of the `controllerFactory` functor at other places, but not here; why?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
szaszm commented on code in PR #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388#discussion_r946885266


##########
libminifi/src/FlowController.cpp:
##########
@@ -558,19 +552,20 @@ std::vector<state::StateController*> FlowController::getAllProcessorControllers(
   return controllerVec;
 }
 
-state::StateController* FlowController::getProcessorController(const std::string& name, const std::function<std::unique_ptr<state::ProcessorController>(core::Processor&)>& controllerFactory) {
-  auto* processor = root_->findProcessorByName(name);
-  if (processor == nullptr) {
-    logger_->log_error("Could not get processor controller for requested name \"%s\", because processor was not found either", name);
-    return nullptr;
-  }
-
-  // reference to the existing or newly created controller
-  auto& foundController = processor_to_controller_[processor->getUUID()];
-  if (!foundController) {
-    foundController = controllerFactory(*processor);
-  }
-  return foundController.get();
+state::StateController* FlowController::getProcessorController(const std::string& id_or_name, const std::function<std::unique_ptr<state::ProcessorController>(core::Processor&)>& controllerFactory) {

Review Comment:
   This was an oversight, fixed in [4d699a7](https://github.com/apache/nifi-minifi-cpp/pull/1388/commits/4d699a7c00834fe02e7775c6e362a5cc96447c62). 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] lordgamez closed pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
lordgamez closed pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a diff in pull request #1388: MINIFICPP-1896 Change C2 component-level start/stop commands to use UUID

Posted by GitBox <gi...@apache.org>.
adamdebreceni commented on code in PR #1388:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1388#discussion_r946417796


##########
libminifi/test/integration/StateTransactionalityTests.cpp:
##########
@@ -72,8 +72,7 @@ class StatefulIntegrationTest : public IntegrationBase {
         // set hooks
         const auto processController = dynamic_cast<ProcessorController*>(&component);
         assert(processController != nullptr);
-        stateful_processor_ = dynamic_cast<StatefulProcessor*>(processController->getProcessor());
-        assert(stateful_processor_ != nullptr);

Review Comment:
   why isn't this assert needed anymore?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org