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/01/29 10:52:56 UTC

[GitHub] [nifi-minifi-cpp] arpadboda opened a new pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

arpadboda opened a new pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719
 
 
   …tead of being silently ignored
   
   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 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](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] 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.
   

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372490360
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.cpp
 ##########
 @@ -158,7 +166,21 @@ void FlowFileRepository::prune_stored_flowfiles() {
   }
 
   delete it;
+}
 
+bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> operation) {
+  int waitTime = FLOWFILE_REPOSITORY_RETRY_INTERVAL;
+  for (int i=0; i<3; ++i) {
+    auto status = operation();
+    if (status.ok()) {
+      logger_->log_trace("Rocksdb operation executed successfully");
+      return true;
+    }
+    logger_->log_error("Rocksdb operation failed: %s", status.ToString());
+    std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
+    waitTime += FLOWFILE_REPOSITORY_RETRY_INTERVAL;
 
 Review comment:
   Either change the behavior to always wait `FLOWFILE_REPOSITORY_RETRY_INTERVAL` milliseconds instead of increasing the wait time, or change the name to something like `FLOWFILE_REPOSITORY_RETRY_INTERVAL_INCREMENTS`. I don't like the name I've suggested, but a bad name is better than a misleading one.

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372350686
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.cpp
 ##########
 @@ -158,7 +166,21 @@ void FlowFileRepository::prune_stored_flowfiles() {
   }
 
   delete it;
+}
 
+bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> operation) {
+  int waitTime = FLOWFILE_REPOSITORY_RETRY_INTERVAL;
+  for (int i=0; i<3; ++i) {
+    auto status = operation();
+    if (status.ok()) {
+      logger_->log_trace("Rocksdb operation executed successfully");
+      return true;
+    }
+    logger_->log_error("Rocksdb operation failed: %s", status.ToString());
+    std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
+    waitTime += FLOWFILE_REPOSITORY_RETRY_INTERVAL;
 
 Review comment:
   Agreed, I'm open for suggestion :) 

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372343778
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.cpp
 ##########
 @@ -158,7 +166,21 @@ void FlowFileRepository::prune_stored_flowfiles() {
   }
 
   delete it;
+}
 
+bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> operation) {
+  int waitTime = FLOWFILE_REPOSITORY_RETRY_INTERVAL;
+  for (int i=0; i<3; ++i) {
+    auto status = operation();
+    if (status.ok()) {
+      logger_->log_trace("Rocksdb operation executed successfully");
+      return true;
+    }
+    logger_->log_error("Rocksdb operation failed: %s", status.ToString());
+    std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
+    waitTime += FLOWFILE_REPOSITORY_RETRY_INTERVAL;
 
 Review comment:
   The suffix `RETRY_INTERVAL` suggests that we retry every so often but here we increase the delay between retries in each iteration.
   

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372348522
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.h
 ##########
 @@ -168,6 +172,8 @@ class FlowFileRepository : public core::Repository, public std::enable_shared_fr
 
  private:
 
+  virtual bool ExecuteWithRetry(std::function<rocksdb::Status()> operation);
 
 Review comment:
   This is just a local helper function, it doesn't need to be `virtual`. Am I missing something?

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] arpadboda closed pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
arpadboda closed pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719
 
 
   

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] bakaid commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
bakaid commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372330573
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.cpp
 ##########
 @@ -70,13 +71,20 @@ void FlowFileRepository::flush() {
   }
 
 
-  if (db_->Write(rocksdb::WriteOptions(), &batch).ok()) {
+  auto operation = [this, &batch]() { return db_->Write(rocksdb::WriteOptions(), &batch); };
+
+  if (ExecuteWithRetry(operation)) {
     logger_->log_trace("Decrementing %u from a repo size of %u", decrement_total, repo_size_.load());
     if (decrement_total > repo_size_.load()) {
       repo_size_ = 0;
     } else {
       repo_size_ -= decrement_total;
     }
+  } else {
+    for (const auto& key: keystrings) {
+      keys_to_delete.enqueue(key);  // Push back the values that we could get but couldn't delete
+      return;  // Stop here - don't delete from content repo while we have records in FF repo
 
 Review comment:
   This return should definitely not be here. I suspect it should be outside of the for loop.

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372500779
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.cpp
 ##########
 @@ -158,7 +166,21 @@ void FlowFileRepository::prune_stored_flowfiles() {
   }
 
   delete it;
+}
 
+bool FlowFileRepository::ExecuteWithRetry(std::function<rocksdb::Status()> operation) {
+  int waitTime = FLOWFILE_REPOSITORY_RETRY_INTERVAL;
+  for (int i=0; i<3; ++i) {
+    auto status = operation();
+    if (status.ok()) {
+      logger_->log_trace("Rocksdb operation executed successfully");
+      return true;
+    }
+    logger_->log_error("Rocksdb operation failed: %s", status.ToString());
+    std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
+    waitTime += FLOWFILE_REPOSITORY_RETRY_INTERVAL;
 
 Review comment:
   Done.

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


With regards,
Apache Git Services

[GitHub] [nifi-minifi-cpp] arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…

Posted by GitBox <gi...@apache.org>.
arpadboda commented on a change in pull request #719: MINIFICPP-1133 - Rocksdb operation errors should cause exceptions ins…
URL: https://github.com/apache/nifi-minifi-cpp/pull/719#discussion_r372350544
 
 

 ##########
 File path: extensions/rocksdb-repos/FlowFileRepository.h
 ##########
 @@ -168,6 +172,8 @@ class FlowFileRepository : public core::Repository, public std::enable_shared_fr
 
  private:
 
+  virtual bool ExecuteWithRetry(std::function<rocksdb::Status()> operation);
 
 Review comment:
   Fair, as it's private, it add no value. 

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


With regards,
Apache Git Services