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-2398 Only commit once per time_slice in EventDrivenSchedulingAgent #1815

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

martinzink
Copy link
Member

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.

@martinzink martinzink marked this pull request as draft June 11, 2024 16:45
@martinzink
Copy link
Member Author

Thanks @lordgamez for noticing some issues with the PR, I converted into draft while I iron out those things (it still got some problems as the failing docker tests seems relevant to the changes)

@martinzink martinzink marked this pull request as ready for review June 12, 2024 12:48
@martinzink
Copy link
Member Author

Since we are in the discussion about deprecating the whole JNI extension, I think we safely ignore the clang tidy issues coming from that

metrics_->addLastOnTriggerRuntime(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start));
start = std::chrono::steady_clock::now();
session->commit();
metrics_->addLastSessionCommitRuntime(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start));
Copy link
Member

Choose a reason for hiding this comment

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

The session runtime metric seems to be missing after the changes

Copy link
Member Author

Choose a reason for hiding this comment

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

process_session->setMetrics(processor->getMetrics());


try {
Copy link
Contributor

Choose a reason for hiding this comment

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

as I understand SchedulingAgent::trigger catches any exception from Processor::onTrigger and wraps it in an expected, but we do not rethrow that, so the error-case for this try-catch is when process_session->commit() throws, previously SchedulingAgent::trigger wrapped both the Processor::onTrigger and commit/rollback exceptions and EventDrivenSchedulingAgent simply discarded it

gsl::finally should happen in case of an exception, but in this case I don't think we want to call commit when we get an exception here, so I would just move process_session->commit() after the while-loop, also we should make sure to log any exceptions from both commit and rollback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants