szaszm commented on code in PR #1738: URL: https://github.com/apache/nifi-minifi-cpp/pull/1738#discussion_r1510982246
########## extensions/rocksdb-repos/FlowFileRepository.cpp: ########## @@ -127,37 +142,37 @@ void FlowFileRepository::initialize_repository() { } logger_->log_info("Reading existing flow files from database"); - auto it = opendb->NewIterator(rocksdb::ReadOptions()); + const auto it = opendb->NewIterator(rocksdb::ReadOptions()); for (it->SeekToFirst(); it->Valid(); it->Next()) { utils::Identifier container_id; auto eventRead = FlowFileRecord::DeSerialize(gsl::make_span(it->value()).as_span<const std::byte>(), content_repo_, container_id); - std::string key = it->key().ToString(); - if (eventRead) { - // on behalf of the just resurrected persisted instance - auto claim = eventRead->getResourceClaim(); - if (claim) claim->increaseFlowFileRecordOwnedCount(); - bool found = false; - auto search = containers_.find(container_id.to_string()); - found = (search != containers_.end()); - if (!found) { - // for backward compatibility - search = connection_map_.find(container_id.to_string()); - found = (search != connection_map_.end()); - } - if (found) { - logger_->log_debug("Found connection for {}, path {} ", container_id.to_string(), eventRead->getContentFullPath()); - eventRead->setStoredToRepository(true); - // we found the connection for the persistent flowFile - // even if a processor immediately marks it for deletion, flush only happens after prune_stored_flowfiles - search->second->restore(eventRead); - } else { - logger_->log_warn("Could not find connection for {}, path {} ", container_id.to_string(), eventRead->getContentFullPath()); - keys_to_delete_.enqueue({.key = key, .content = eventRead->getResourceClaim()}); - } - } else { + const std::string key = it->key().ToString(); + if (!eventRead) { // failed to deserialize FlowFile, cannot clear claim keys_to_delete_.enqueue({.key = key}); + continue; + } + auto claim = eventRead->getResourceClaim(); + if (claim) { + claim->increaseFlowFileRecordOwnedCount(); } + const auto container = getContainer(container_id.to_string()); + if (!container) { + logger_->log_warn("Could not find connection for %s, path %s ", container_id.to_string(), eventRead->getContentFullPath()); + keys_to_delete_.enqueue({.key = key, .content = eventRead->getResourceClaim()}); + continue; + } + if (check_flowfile_content_size_ && !contentSizeIsAmpleForFlowFile(*eventRead, claim)) { + logger_->log_warn("Content size was insufficient for flowfile {}", eventRead->getContentFullPath()); Review Comment: I find this easier to understand. ```suggestion logger_->log_warn("Content is missing or too small for flowfile {}", eventRead->getContentFullPath()); ``` -- 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