diff --git a/src/Storages/StorageReplicatedMergeTree.cpp b/src/Storages/StorageReplicatedMergeTree.cpp index c6727461815..cd6318a15dd 100644 --- a/src/Storages/StorageReplicatedMergeTree.cpp +++ b/src/Storages/StorageReplicatedMergeTree.cpp @@ -4212,6 +4212,10 @@ void StorageReplicatedMergeTree::startup() try { + /// Temporary directories contain incomplete results of merges (after forced restart) + /// and don't allow to reinitialize them, so delete each of them immediately + clearOldTemporaryDirectories(0); + InterserverIOEndpointPtr data_parts_exchange_ptr = std::make_shared(*this); [[maybe_unused]] auto prev_ptr = std::atomic_exchange(&data_parts_exchange_endpoint, data_parts_exchange_ptr); assert(prev_ptr == nullptr);