diff --git a/src/Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.cpp b/src/Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.cpp index 13e3721a076e..2f9571b38b85 100644 --- a/src/Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.cpp +++ b/src/Storages/ObjectStorage/StorageObjectStorageStableTaskDistributor.cpp @@ -310,13 +310,14 @@ void StorageObjectStorageStableTaskDistributor::rescheduleTasksFromReplica(size_ "All replicas were marked as lost" ); - for (const auto & file : processed_file_list_ptr->second) + auto files = std::move(processed_file_list_ptr->second); + replica_to_files_to_be_processed.erase(number_of_current_replica); + for (const auto & file : files) { auto file_replica_idx = getReplicaForFile(file->getPath()); unprocessed_files.emplace(file->getPath(), std::make_pair(file, file_replica_idx)); connection_to_files[file_replica_idx].push_back(file); } - replica_to_files_to_be_processed.erase(number_of_current_replica); } }