From 4fafb9dfa118ac38c117c5c932af8507300ed1fc Mon Sep 17 00:00:00 2001 From: robot-clickhouse Date: Tue, 26 Nov 2024 11:07:58 +0000 Subject: [PATCH] Backport #72400 to 24.9: make operations_to_execute as shared ptr --- src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp | 4 ++-- src/Disks/ObjectStorages/DiskObjectStorageTransaction.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp b/src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp index 880911b9958..522761aba4d 100644 --- a/src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp +++ b/src/Disks/ObjectStorages/DiskObjectStorageTransaction.cpp @@ -782,9 +782,9 @@ std::unique_ptr DiskObjectStorageTransaction::writeFile } else { - auto write_operation = std::make_unique(object_storage, metadata_storage, object); + auto write_operation = std::make_shared(object_storage, metadata_storage, object); - create_metadata_callback = [object_storage_tx = shared_from_this(), write_op = write_operation.get(), mode, path, key_ = std::move(object_key)](size_t count) + create_metadata_callback = [object_storage_tx = shared_from_this(), write_op = write_operation, mode, path, key_ = std::move(object_key)](size_t count) { /// This callback called in WriteBuffer finalize method -- only there we actually know /// how many bytes were written. We don't control when this finalize method will be called diff --git a/src/Disks/ObjectStorages/DiskObjectStorageTransaction.h b/src/Disks/ObjectStorages/DiskObjectStorageTransaction.h index 23f66990d54..d69378b8cba 100644 --- a/src/Disks/ObjectStorages/DiskObjectStorageTransaction.h +++ b/src/Disks/ObjectStorages/DiskObjectStorageTransaction.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -34,7 +35,7 @@ public: virtual std::string getInfoForLog() const = 0; }; -using DiskObjectStorageOperation = std::unique_ptr; +using DiskObjectStorageOperation = std::shared_ptr; using DiskObjectStorageOperations = std::vector;