Repository navigation
Closed
Description
Linked issues
Describe the bug
This error has existed since v24.7. A column rename happens after a detachment. For these cases, should the attachment fail with an error?
How to reproduce
Error message and/or stacktrace
Stack trace:
<Fatal> : Logical error: 'Could not find a column of minimum size in MergeTree, part /var/lib/clickhouse/store/ff1/ff17a6b7-cafb-42b7-a39a-17c2cb2518ed/all_4_4_0/'.
<Fatal> : Stack trace (when copying this message, always include the lines below):
0. contrib/llvm-project/libcxx/include/__exception/exception.h:113: Poco::Exception::Exception(String const&, int) @ 0x000000001ab58492
1. src/Common/Exception.cpp:108: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000fc896f9
2. src/Common/Exception.h:112: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x0000000009fc18ac
3. src/Common/Exception.h:130: DB::Exception::Exception<String>(int, FormatStringHelperImpl<std::type_identity<String>::type>, String&&) @ 0x0000000009fc158b
4. src/Storages/MergeTree/IMergeTreeDataPart.cpp:800: DB::IMergeTreeDataPart::getColumnNameWithMinimumCompressedSize(DB::NamesAndTypesList const&) const @ 0x00000000161c375a
5. src/Storages/MergeTree/LoadedMergeTreeDataPartInfoForReader.h:41: DB::LoadedMergeTreeDataPartInfoForReader::getColumnNameWithMinimumCompressedSize(DB::NamesAndTypesList const&) const @ 0x0000000015db5fed
6. src/Storages/MergeTree/MergeTreeBlockReadUtils.cpp:136: DB::injectRequiredColumns(DB::IMergeTreeDataPartInfoForReader const&, std::shared_ptr<DB::StorageSnapshot> const&, bool, std::vector<String, std::allocator<String>>&) @ 0x0000000016430e1e
7. src/Storages/MergeTree/MergeTreeBlockReadUtils.cpp:295: DB::getReadTaskColumns(DB::IMergeTreeDataPartInfoForReader const&, std::shared_ptr<DB::StorageSnapshot> const&, std::vector<String, std::allocator<String>> const&, std::shared_ptr<DB::PrewhereInfo> const&, std::vector<std::shared_ptr<DB::PrewhereExprStep>, std::allocator<std::shared_ptr<DB::PrewhereExprStep>>> const&, DB::ExpressionActionsSettings const&, DB::MergeTreeReaderSettings const&, bool) @ 0x0000000016432708
8. src/Storages/MergeTree/MergeTreeReadPoolBase.cpp:178: DB::MergeTreeReadPoolBase::fillPerPartInfos(DB::Settings const&) @ 0x0000000016e7fcf3
9. src/Storages/MergeTree/MergeTreeReadPoolBase.cpp:51: DB::MergeTreeReadPoolBase::MergeTreeReadPoolBase(DB::RangesInDataParts&&, std::shared_ptr<DB::MergeTreeData::IMutationsSnapshot const>, std::unordered_map<String, DB::Field, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, DB::Field>>>, std::shared_ptr<DB::StorageSnapshot> const&, std::shared_ptr<DB::PrewhereInfo> const&, DB::ExpressionActionsSettings const&, DB::MergeTreeReaderSettings const&, std::vector<String, std::allocator<String>> const&, DB::MergeTreeReadPoolBase::PoolSettings const&, DB::MergeTreeReadTask::BlockSizeParams const&, std::shared_ptr<DB::Context const> const&) @ 0x0000000016e7f28f
10. src/Storages/MergeTree/MergeTreeReadPoolParallelReplicas.cpp:117: DB::MergeTreeReadPoolParallelReplicas::MergeTreeReadPoolParallelReplicas(DB::ParallelReadingExtension, DB::RangesInDataParts&&, std::shared_ptr<DB::MergeTreeData::IMutationsSnapshot const>, std::unordered_map<String, DB::Field, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, DB::Field>>>, std::shared_ptr<DB::StorageSnapshot> const&, std::shared_ptr<DB::PrewhereInfo> const&, DB::ExpressionActionsSettings const&, DB::MergeTreeReaderSettings const&, std::vector<String, std::allocator<String>> const&, DB::MergeTreeReadPoolBase::PoolSettings const&, DB::MergeTreeReadTask::BlockSizeParams const&, std::shared_ptr<DB::Context const> const&) @ 0x0000000016e9c487
11. contrib/llvm-project/libcxx/include/__memory/construct_at.h:41: DB::MergeTreeReadPoolParallelReplicas* std::construct_at[abi:se190107]<DB::MergeTreeReadPoolParallelReplicas, DB::ParallelReadingExtension, DB::RangesInDataParts, std::shared_ptr<DB::MergeTreeData::IMutationsSnapshot const>&, std::unordered_map<String, DB::Field, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, DB::Field>>>&, std::shared_ptr<DB::StorageSnapshot>&, std::shared_ptr<DB::PrewhereInfo>&, DB::ExpressionActionsSettings&, DB::MergeTreeReaderSettings&, std::vector<String, std::allocator<String>>&, DB::MergeTreeReadPoolBase::PoolSettings&, DB::MergeTreeReadTask::BlockSizeParams const&, std::shared_ptr<DB::Context const>&, DB::MergeTreeReadPoolParallelReplicas*>(DB::MergeTreeReadPoolParallelReplicas*, DB::ParallelReadingExtension&&, DB::RangesInDataParts&&, std::shared_ptr<DB::MergeTreeData::IMutationsSnapshot const>&, std::unordered_map<String, DB::Field, std::hash<String>, std::equal_to<String>, std::allocator<std::pair<String const, DB::Field>>>&, std::shared_ptr<DB::StorageSnapshot>&, std::shared_ptr<DB::PrewhereInfo>&, DB::ExpressionActionsSettings&, DB::MergeTreeReaderSettings&, std::vector<String, std::allocator<String>>&, DB::MergeTreeReadPoolBase::PoolSettings&, DB::MergeTreeReadTask::BlockSizeParams const&, std::shared_ptr<DB::Context const>&) @ 0x0000000016e6f9d9
12. contrib/llvm-project/libcxx/include/__memory/construct_at.h:49: DB::ReadFromMergeTree::readFromPoolParallelReplicas(DB::RangesInDataParts, std::vector<String, std::allocator<String>>, DB::MergeTreeReadPoolBase::PoolSettings) @ 0x0000000016e48dfc
13. src/Processors/QueryPlan/ReadFromMergeTree.cpp:737: DB::ReadFromMergeTree::read(DB::RangesInDataParts, std::vector<String, std::allocator<String>>, DB::MergeTreeReadType, unsigned long, unsigned long, bool) @ 0x0000000016e4bd59
14. src/Processors/QueryPlan/ReadFromMergeTree.cpp:1038: DB::ReadFromMergeTree::spreadMarkRangesAmongStreams(DB::RangesInDataParts&&, unsigned long, std::vector<String, std::allocator<String>> const&) @ 0x0000000016e4e0fb
15. src/Processors/QueryPlan/ReadFromMergeTree.cpp:2199: DB::ReadFromMergeTree::spreadMarkRanges(DB::RangesInDataParts&&, unsigned long, DB::ReadFromMergeTree::AnalysisResult&, std::optional<DB::ActionsDAG>&) @ 0x0000000016e5ddca
16. src/Processors/QueryPlan/ReadFromMergeTree.cpp:2307: DB::ReadFromMergeTree::initializePipeline(DB::QueryPipelineBuilder&, DB::BuildQueryPipelineSettings const&) @ 0x0000000016e5f7e6
17. src/Processors/QueryPlan/ISourceStep.cpp:20: DB::ISourceStep::updatePipeline(std::vector<std::unique_ptr<DB::QueryPipelineBuilder, std::default_delete<DB::QueryPipelineBuilder>>, std::allocator<std::unique_ptr<DB::QueryPipelineBuilder, std::default_delete<DB::QueryPipelineBuilder>>>>, DB::BuildQueryPipelineSettings const&) @ 0x0000000016dfb230
18. src/Processors/QueryPlan/QueryPlan.cpp:199: DB::QueryPlan::buildQueryPipeline(DB::QueryPlanOptimizationSettings const&, DB::BuildQueryPipelineSettings const&, bool) @ 0x0000000016e2a7cf
19. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:288: DB::InterpreterSelectQueryAnalyzer::buildQueryPipeline() @ 0x00000000148a7739
20. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:255: DB::InterpreterSelectQueryAnalyzer::execute() @ 0x00000000148a74be
21. src/Interpreters/executeQuery.cpp:1491: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, DB::ReadBuffer*, std::shared_ptr<DB::IAST>&) @ 0x0000000014bd6763
22. src/Interpreters/executeQuery.cpp:1682: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x0000000014bd0b68
23. src/Server/TCPHandler.cpp:685: DB::TCPHandler::runImpl() @ 0x000000001686dae1
24. src/Server/TCPHandler.cpp:2673: DB::TCPHandler::run() @ 0x0000000016886419
25. base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x000000001abf9e47
26. base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x000000001abfa31e
27. base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x000000001aba4872
28. base/poco/Foundation/src/Thread_POSIX.cpp:335: Poco::ThreadImpl::runnableEntry(void*) @ 0x000000001aba24af
29. ? @ 0x00007ffff7ca1e2e
30. ? @ 0x00007ffff7d33a4c
Activity
PedroTadim commentedon Feb 11, 2026
The error is now different:
However, it's not clear.
alexey-milovidov commentedon Mar 2, 2026
Tested on current master (ed6302e) with
clickhouse-local. The originalLOGICAL_ERROR("Could not find a column of minimum size in MergeTree") is gone — the query now fails with a clean user-facing error:The attachment of the old partition (with column
c0) correctly fails after the column was renamed toc1. Note: PR #96351 addresses a more general fix for chained rename mutations on re-attached parts.Add a test for detach/rename column/attach producing a clean error
Choose the injected minimum-size column so it is both readable and re…
Refuse a mutation that would leave a part with no columns