You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:07:12 UTC

[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #804: MINIFICPP-1249 - Restore agent from persisted repo

fgerlits commented on a change in pull request #804:
URL: https://github.com/apache/nifi-minifi-cpp/pull/804#discussion_r437413268



##########
File path: libminifi/test/rocksdb-tests/RepoTests.cpp
##########
@@ -252,3 +252,77 @@ TEST_CASE("Test Validate Checkpoint ", "[TestFFR5]") {
   LogTestController::getInstance().reset();
 }
 
+TEST_CASE("Test FlowFile Restore", "[TestFFR6]") {
+  TestController testController;
+  LogTestController::getInstance().setDebug<core::ContentRepository>();
+  LogTestController::getInstance().setTrace<core::repository::FileSystemRepository>();
+  LogTestController::getInstance().setTrace<minifi::ResourceClaim>();
+  LogTestController::getInstance().setTrace<minifi::FlowFileRecord>();
+
+  char format[] = "/var/tmp/testRepo.XXXXXX";
+  auto dir = testController.createTempDirectory(format);
+
+  auto config = std::make_shared<minifi::Configure>();
+  config->set(minifi::Configure::nifi_dbcontent_repository_directory_default, utils::file::FileUtils::concat_path(dir, "content_repository"));
+  config->set(minifi::Configure::nifi_flowfile_repository_directory_default, utils::file::FileUtils::concat_path(dir, "flowfile_repository"));
+
+  std::shared_ptr<core::Repository> prov_repo = std::make_shared<TestRepository>();
+  std::shared_ptr<core::repository::FlowFileRepository> ff_repository = std::make_shared<core::repository::FlowFileRepository>("flowFileRepository");
+  std::shared_ptr<core::ContentRepository> content_repo = std::make_shared<core::repository::FileSystemRepository>();
+  ff_repository->initialize(config);
+  content_repo->initialize(config);
+
+  std::shared_ptr<minifi::Connection> input = std::make_shared<minifi::Connection>(ff_repository, content_repo, "Input");
+
+  auto root = std::make_shared<core::ProcessGroup>(core::ProcessGroupType::ROOT_PROCESS_GROUP, "root");
+  root->addConnection(input);
+
+  auto flowConfig = std::unique_ptr<core::FlowConfiguration>{new core::FlowConfiguration(prov_repo, ff_repository, content_repo, nullptr, config, "")};
+  auto flowController = std::make_shared<minifi::FlowController>(prov_repo, ff_repository, config, std::move(flowConfig), content_repo, "", true);
+
+  std::string data = "banana";
+  minifi::io::DataStream content(reinterpret_cast<const uint8_t*>(data.c_str()), data.length());
+
+  /**
+   * Currently it is the Connection's responsibility to persist the incoming
+   * flowFiles to the FlowFileRepository. Upon restart the FlowFileRepository
+   * checks the persisted database and moves every FlowFile into the Connection
+   * that persisted it (if it can find it. We could have a different flow, in
+   * which case the bastard FlowFiles are deleted.)

Review comment:
       I would call these flow files 'orphaned' instead of 'bastard' (which sounds like you are angry at them)




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org