lordgamez commented on code in PR #2157:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2157#discussion_r3098596335
##########
extensions/grafana-loki/PushGrafanaLoki.cpp:
##########
@@ -167,6 +166,7 @@ void PushGrafanaLoki::processBatch(const
std::vector<std::shared_ptr<core::FlowF
}
void PushGrafanaLoki::onTrigger(core::ProcessContext& context,
core::ProcessSession& session) {
+ log_batch_.setStateManager(context.getStateManager());
Review Comment:
Updated in
https://github.com/apache/nifi-minifi-cpp/pull/2157/commits/b71e562cd761633f06f255a192128f08b41ca4b5
##########
extensions/sftp/processors/ListSFTP.cpp:
##########
@@ -421,11 +416,12 @@ void ListSFTP::listByTrackingTimestamps(
const std::string& username,
const std::string& remote_path,
std::vector<Child> files) {
+ auto* state_manager = context.getStateManager();
Review Comment:
Updated in
https://github.com/apache/nifi-minifi-cpp/pull/2157/commits/b71e562cd761633f06f255a192128f08b41ca4b5
##########
extensions/sql/processors/QueryDatabaseTable.cpp:
##########
@@ -155,11 +150,13 @@ bool
QueryDatabaseTable::loadMaxValuesFromStoredState(const std::unordered_map<s
void QueryDatabaseTable::initializeMaxValues(core::ProcessContext &context) {
max_values_.clear();
std::unordered_map<std::string, std::string> stored_state;
- if (!state_manager_->get(stored_state)) {
+
+ auto state_manager = context.createStateManager();
+ if (!state_manager->get(stored_state)) {
Review Comment:
Updated in
https://github.com/apache/nifi-minifi-cpp/pull/2157/commits/b71e562cd761633f06f255a192128f08b41ca4b5
##########
extensions/standard-processors/processors/TailFile.h:
##########
@@ -240,9 +240,9 @@ class TailFile : public core::ProcessorImpl {
void onTrigger(core::ProcessContext& context, core::ProcessSession& session)
override;
void initialize() override;
- bool recoverState(const core::ProcessContext& context);
+ bool recoverState(core::StateManager* state_manager, const
core::ProcessContext& context);
void logState();
- bool storeState() const;
+ bool storeState(core::StateManager* state_manager) const;
Review Comment:
Updated in
https://github.com/apache/nifi-minifi-cpp/pull/2157/commits/b71e562cd761633f06f255a192128f08b41ca4b5
##########
extensions/systemd/tests/ConsumeJournaldTest.cpp:
##########
@@ -164,8 +160,11 @@ TEST_CASE("ConsumeJournald", "[consumejournald]") {
minifi::core::ProcessorMetadata{utils::Identifier{}, "ConsumeJournald",
core::logging::LoggerFactory<ConsumeJournald>::getLogger()},
std::move(libwrapper)), "ConsumeJournald");
REQUIRE(consume_journald->setProperty(ConsumeJournald::TimestampFormat.name,
"ISO8601"));
- const auto get_cursor_position = [&consume_journald]() -> std::string {
- return
ConsumeJournaldTestAccessor::get_state_manager_(consume_journald.get())->get()->at("cursor");
+ const auto get_cursor_position = [&plan, &consume_journald]() -> std::string
{
+ auto sm =
plan->getProcessContextForProcessor(consume_journald)->createStateManager();
+ std::unordered_map<std::string, std::string> state;
+ sm->get(state);
+ return state.at("cursor");
Review Comment:
It was probably changed due to debugging, reverted in
https://github.com/apache/nifi-minifi-cpp/pull/2157/commits/b71e562cd761633f06f255a192128f08b41ca4b5
##########
extensions/aws/processors/ListS3.cpp:
##########
@@ -157,7 +151,15 @@ void ListS3::onTrigger(core::ProcessContext& context,
core::ProcessSession& sess
return;
}
- auto stored_listing_state = state_manager_->getCurrentState();
+ auto* state_manager = context.getStateManager();
Review Comment:
The createStateManager returns a unique_ptr where the caller is responsible
for commiting, rollbacking the changes and the lifetime of the state manager,
while getStateManager gets a raw pointer for the state manager created for the
onTrigger session, where the ProcessSession is responsible for commiting and
reverting the changes depending if there was an exception during onTrigger. I
added comments about this in
https://github.com/apache/nifi-minifi-cpp/pull/2157/commits/b71e562cd761633f06f255a192128f08b41ca4b5
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]