-
Notifications
You must be signed in to change notification settings - Fork 90
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
base: main
Are you sure you want to change the base?
Conversation
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) |
d27d0ce
to
1b23b67
Compare
Since we are in the discussion about deprecating the whole JNI extension, I think we safely ignore the clang tidy issues coming from that |
process_session->setMetrics(processor->getMetrics()); | ||
|
||
|
||
try { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, how about this?
restructure try catches in EventDrivenSchedulingAgent.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if EventDrivenSchedulingAgent::run can throw an exception and the threadpool can handle it, but it previously did not throw
1b23b67
to
c6a9d06
Compare
} | ||
|
||
const auto start_time = std::chrono::steady_clock::now(); | ||
// trigger processor until it has work to do, but no more than the configured nifi.flow.engine.event.driven.time.slice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// trigger processor until it has work to do, but no more than the configured nifi.flow.engine.event.driven.time.slice | |
// trigger processor while it has work to do, but no more than the configured nifi.flow.engine.event.driven.time.slice |
} catch (const std::exception& exception) { | ||
logger_->log_warn("Caught \"{}\" ({}) during ProcessSession::commit after triggering processor: {} ({})", | ||
exception.what(), typeid(exception).name(), processor->getUUIDStr(), processor->getName()); | ||
process_session->rollbackNoThrow(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't just throw away the exception here, at least logging something would be nice. If a rollback fails, it's probably a critical error, so terminate
might be an appropriate handling.
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:
For documentation related changes:
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.