Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINIFICPP-1395 - Use Identifier instead of its stringified form wherever possible #932

Closed
wants to merge 19 commits into from

Conversation

adamdebreceni
Copy link
Contributor

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:

  • Is there a JIRA ticket associated with this PR? Is it referenced
    in the commit message?

  • 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:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • 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.

Copy link
Contributor

@arpadboda arpadboda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, some minor comments.

libminifi/include/core/CoreComponentState.h Outdated Show resolved Hide resolved
libminifi/include/sitetosite/SiteToSite.h Outdated Show resolved Hide resolved
libminifi/src/CronDrivenSchedulingAgent.cpp Show resolved Hide resolved
libminifi/include/utils/SmallString.h Outdated Show resolved Hide resolved
libminifi/include/utils/ThreadPool.h Show resolved Hide resolved
libminifi/src/ThreadedSchedulingAgent.cpp Outdated Show resolved Hide resolved
void appendJsonStr(const std::string& value, rapidjson::Value& parent, rapidjson::Document::AllocatorType& alloc) { // NOLINT
template<size_t N>
rapidjson::Value getStringValue(const utils::SmallString<N>& value, rapidjson::Document::AllocatorType& alloc) {
rapidjson::Value Val;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very minor, but I would rename this variable (and the other valueVals) to target_value or json_value or something similar to match our naming conventions

libminifi/src/provenance/Provenance.cpp Outdated Show resolved Hide resolved
libminifi/test/TestBase.cpp Outdated Show resolved Hide resolved
nanofi/src/cxx/Plan.cpp Outdated Show resolved Hide resolved
Copy link
Member

@szaszm szaszm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome changes, some questions and suggestions below.

libminifi/include/core/CoreComponentState.h Outdated Show resolved Hide resolved
libminifi/include/core/logging/Logger.h Outdated Show resolved Hide resolved
thread_pool_.stopTasks(p);
for (const auto& processor_id : processors_running_) {
logger_->log_error("SchedulingAgent is stopped before processor was unscheduled: %s", processor_id.to_string());
thread_pool_.stopTasks(processor_id.to_string());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're passing a processor ID to a function expecting a task ID. This looks suspicious. Do the tasks of a processor have the same ID as the processor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that seems to be the case, so processors with greater than one maxConcurrentTasks share the same task_status_ flag, this is probably not intentional

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arpadboda could you confirm or clarify, as the author/major refactorer of this code?

Copy link
Contributor

@arpadboda arpadboda Nov 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's intentional.
The IDs are only used to identify the tasks belonging to a given component, the threadpool otherwise doesn't care. So they are not required to be unique.
I wouldn't call it a beautiful design, but works as expected, so I kept it when the code was refactored.

@@ -128,7 +128,7 @@ bool ProvenanceEventRecord::Serialize(org::apache::nifi::minifi::io::BufferStrea
return false;
}

ret = outStream.write(this->flow_uuid_);
ret = outStream.write(this->flow_uuid_.to_string());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these .to_string()s are no longer needed here, right?

@arpadboda arpadboda closed this in a874397 Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants