martinzink commented on code in PR #1508:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1508#discussion_r1105460491


##########
extensions/rocksdb-repos/FlowFileRepository.cpp:
##########
@@ -43,50 +43,67 @@ void FlowFileRepository::flush() {
   auto batch = opendb->createWriteBatch();
   rocksdb::ReadOptions options;
 
-  std::vector<std::shared_ptr<FlowFile>> purgeList;
-
-  std::vector<rocksdb::Slice> keys;
-  std::list<std::string> keystrings;
-  std::vector<std::string> values;
+  std::list<ExpiredFlowFileInfo> flow_files;
 
   while (keys_to_delete.size_approx() > 0) {
-    std::string key;
-    if (keys_to_delete.try_dequeue(key)) {
-      keystrings.push_back(std::move(key));  // rocksdb::Slice doesn't copy 
the string, only grabs ptrs. Hacky, but have to ensure the required lifetime of 
the strings.
-      keys.push_back(keystrings.back());
+    ExpiredFlowFileInfo info;
+    if (keys_to_delete.try_dequeue(info)) {
+      flow_files.push_back(std::move(info));
     }
   }
-  auto multistatus = opendb->MultiGet(options, keys, &values);
 
-  for (size_t i = 0; i < keys.size() && i < values.size() && i < 
multistatus.size(); ++i) {
-    if (!multistatus[i].ok()) {
-      logger_->log_error("Failed to read key from rocksdb: %s! DB is most 
probably in an inconsistent state!", keys[i].data());
-      keystrings.remove(keys[i].data());
-      continue;
+  {
+    // deserialize flow files with missing content claim

Review Comment:
   minor, but instead of a commented scope, you could extract this into a 
function with a name that explains what happens here



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

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

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

Reply via email to