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:
[email protected]


With regards,
Apache Git Services

Reply via email to