Skip to content

MINIFI-236: Make GetFile, PutFile, TailFile, and ExecuteProcess ThreadSafe#71

Closed
phrocker wants to merge 2 commits intoapache:masterfrom
phrocker:MINIFI-236-b
Closed

MINIFI-236: Make GetFile, PutFile, TailFile, and ExecuteProcess ThreadSafe#71
phrocker wants to merge 2 commits intoapache:masterfrom
phrocker:MINIFI-236-b

Conversation

@phrocker
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 MINIFI-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 master)?

  • 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 travis-ci for build issues and submit an update to your PR as soon as possible.

@phrocker phrocker force-pushed the MINIFI-236-b branch 4 times, most recently from c2bb402 to e933e39 Compare March 30, 2017 00:34
@apiri
Copy link
Member

apiri commented Mar 30, 2017

reviewing

Copy link
Contributor Author

@phrocker phrocker left a comment

Choose a reason for hiding this comment

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

Left some requests for changes.

}
}

void ProcessSession::importFrom(io::DataStream &stream,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add comment.

target_include_directories(tests PRIVATE BEFORE "libminifi/include/provenance")
target_link_libraries(tests ${CMAKE_THREAD_LIBS_INIT} ${UUID_LIBRARIES} ${LEVELDB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi yaml-cpp c-library civetweb-cpp)
add_test(NAME LibMinifiTests COMMAND tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we try and make this less duplicative?

void penalize(std::shared_ptr<core::FlowFile> &flow);
void penalize(std::shared_ptr<core::FlowFile> &&flow);
// Import the existed file into the flow
void importFrom(io::DataStream &stream, std::shared_ptr<core::FlowFile> &&flow);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

better comment?

// perform directory listing
void performListing(std::string dir);
void performListing(std::string dir,const GetFileRequest &request);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment

std::shared_ptr<std::promise<T>> promise;
};

template< typename T>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment to remind people that && will take ownership of Worker

std::shared_ptr<core::FlowFile> &&flow) {
std::shared_ptr<ResourceClaim> claim = std::make_shared<ResourceClaim>();

int max_read = getpagesize();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this portable?

return (i.modifiedTime < j.modifiedTime);
}
void TailFile::checkRollOver() {
void TailFile::checkRollOver(std::string fileLocation, std::string fileName) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

const arguments?

std::shared_ptr<core::ProcessContext> contextset = std::make_shared<
core::ProcessContext>(node2, test_repo);
core::ProcessSessionFactory factory(contextset.get());
// processor->onSchedule(contextset.get(), &factory);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

uncomment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unless this should be removed.

Copy link
Member

@apiri apiri left a comment

Choose a reason for hiding this comment

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

Overall things look good. I had made a few comments concerning formatting at first but preferred to just punt that to an effort for MINIFI-254. Only question I had was concerning the map usage in GetFile. Otherwise, looks good here.

#include "processors/PutFile.h"
#include "processors/TailFile.h"
#include "processors/ListenSyslog.h"
#include "processors/ListenHTTP.h"
Copy link
Member

Choose a reason for hiding this comment

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

minor: can we revert this shuffling?

* Purpose: Extracts configuration items for all components and localized them
*/
class ConfigurableComponent {
class ConfigurableComponent {
Copy link
Member

Choose a reason for hiding this comment

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

minor: extraneous whitespace

== org::apache::nifi::minifi::processors::LogAttribute::ProcessorName) {
processor = std::make_shared<
org::apache::nifi::minifi::processors::LogAttribute>(name, uuid);
} else if (name
Copy link
Member

Choose a reason for hiding this comment

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

minor: can we revert this shuffling?

uint64_t _lastDirectoryListingTime;
std::string _fileFilter;

std::map<std::string,std::atomic<uint64_t>> last_listing_times_;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I follow the usage of the map. Presumably we only have one directory per instance as there is no input.

@apiri
Copy link
Member

apiri commented Apr 5, 2017

@phrocker Just wanted to confirm this was done before a final review. I think it likely makes sense to get this one in before we merge #73

@apiri
Copy link
Member

apiri commented Apr 5, 2017

reviewed the latest commit and code looks good

Verified builds in OS X 10.11, Centos 7.x, and OS X 10.12 (via #75)

Will get this merged and thank you for the fixes.

@asfgit asfgit closed this in 3676468 Apr 5, 2017
nghiaxlee pushed a commit to nghiaxlee/nifi-minifi-cpp that referenced this pull request Jul 8, 2019
…d safe

This closes apache#71.

Signed-off-by: Aldrin Piri <aldrin@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants