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 12:16:03 UTC

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

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