You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inmediately after, launch queries that should use that projection:
First I got a correct error as the projection wasn't ready and force_optimize_projection is on:
SELECT DISTINCT repository FROM github_events WHERE username = 'Algunenano'
SELECT DISTINCT repository
FROM github_events
WHERE username = 'Algunenano'
Query id: 0c3090f1-4309-4a11-a737-ba61031f4b6e
0 rows in set. Elapsed: 0.539 sec.
Received exception from server (version 21.8.1):
Code: 584. DB::Exception: Received from localhost:9000. DB::Exception: No projection is used when allow_experimental_projection_optimization = 1 and force_optimize_projection = 1.
(gdb) bt
#0 0x00007f691656bd22 in raise () from /usr/lib/libc.so.6
#1 0x00007f6916555862 in abort () from /usr/lib/libc.so.6
#2 0x00000000123ba079 in DB::handle_error_code (msg=..., code=49, remote=false, trace=...) at ../src/Common/Exception.cpp:49
#3 0x00000000123ba1b2 in DB::Exception::Exception (this=0x7f68031df900, msg=..., code=49, remote_=false) at ../src/Common/Exception.cpp:60
#4 0x000000001d114095 in DB::checkBlockStructure<void>(DB::Block const&, DB::Block const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)::{lambda(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)#1}::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) const (this=0x7f68645ec870, message=..., code=49) at ../src/Core/Block.cpp:504
#5 0x000000001d1108b2 in DB::checkBlockStructure<void> (lhs=..., rhs=..., context_description=..., allow_remove_constants=true) at ../src/Core/Block.cpp:511
#6 0x000000001d11178a in DB::assertCompatibleHeader (actual=..., desired=..., context_description=...) at ../src/Core/Block.cpp:579
#7 0x000000001ef13b62 in DB::Pipe::unitePipes (pipes=..., collected_processors=0x0, allow_empty_header=false) at ../src/Processors/Pipe.cpp:326
#8 0x000000001ef13755 in DB::Pipe::unitePipes (pipes=...) at ../src/Processors/Pipe.cpp:297
#9 0x000000001eb3ae92 in DB::MergeTreeDataSelectExecutor::read (this=0x7f68646a43c0, column_names_to_return=..., metadata_snapshot=..., query_info=..., context=..., max_block_size=65505, num_streams=16,
processed_stage=DB::QueryProcessingStage::FetchColumns, max_block_numbers_to_read=...) at ../src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:366
#10 0x000000001e673091 in DB::StorageMergeTree::read (this=0x7f68646a3e00, query_plan=..., column_names=..., metadata_snapshot=..., query_info=..., local_context=..., processed_stage=DB::QueryProcessingStage::FetchColumns, max_block_size=65505,
num_streams=16) at ../src/Storages/StorageMergeTree.cpp:190
#11 0x000000001dc85ccb in DB::InterpreterSelectQuery::executeFetchColumns (this=0x7f6857e69100, processing_stage=DB::QueryProcessingStage::FetchColumns, query_plan=...) at ../src/Interpreters/InterpreterSelectQuery.cpp:1951
#12 0x000000001dc7f744 in DB::InterpreterSelectQuery::executeImpl (this=0x7f6857e69100, query_plan=..., prepared_input=..., prepared_pipe=...) at ../src/Interpreters/InterpreterSelectQuery.cpp:1010
#13 0x000000001dc7ea55 in DB::InterpreterSelectQuery::buildQueryPlan (this=0x7f6857e69100, query_plan=...) at ../src/Interpreters/InterpreterSelectQuery.cpp:576
#14 0x000000001e008f1f in DB::InterpreterSelectWithUnionQuery::buildQueryPlan (this=0x7f685b975a80, query_plan=...) at ../src/Interpreters/InterpreterSelectWithUnionQuery.cpp:244
#15 0x000000001e0099f3 in DB::InterpreterSelectWithUnionQuery::execute (this=0x7f685b975a80) at ../src/Interpreters/InterpreterSelectWithUnionQuery.cpp:311
#16 0x000000001e29343a in DB::executeQueryImpl (begin=0x7f685b97af50 "SELECT DISTINCT repository\nFROM github_events\nWHERE username = 'Algunenano'", end=0x7f685b97af9b "", context=..., internal=false, stage=DB::QueryProcessingStage::Complete,
has_query_tail=false, istr=0x0) at ../src/Interpreters/executeQuery.cpp:554
#17 0x000000001e29151e in DB::executeQuery (query=..., context=..., internal=false, stage=DB::QueryProcessingStage::Complete, may_have_embedded_data=true) at ../src/Interpreters/executeQuery.cpp:913
#18 0x000000001eeaddf3 in DB::TCPHandler::runImpl (this=0x7f685d3aa500) at ../src/Server/TCPHandler.cpp:312
#19 0x000000001eebbb52 in DB::TCPHandler::run (this=0x7f685d3aa500) at ../src/Server/TCPHandler.cpp:1622
#20 0x0000000023815879 in Poco::Net::TCPServerConnection::start (this=0x7f685d3aa500) at ../contrib/poco/Net/src/TCPServerConnection.cpp:43
#21 0x0000000023816114 in Poco::Net::TCPServerDispatcher::run (this=0x7f6853e37200) at ../contrib/poco/Net/src/TCPServerDispatcher.cpp:115
#22 0x000000002397b161 in Poco::PooledThread::run (this=0x7f69156d8880) at ../contrib/poco/Foundation/src/ThreadPool.cpp:199
#23 0x000000002397779a in Poco::(anonymous namespace)::RunnableHolder::run (this=0x7f691560e5c0) at ../contrib/poco/Foundation/src/Thread.cpp:55
#24 0x000000002397641a in Poco::ThreadImpl::runnableEntry (pThread=0x7f69156d88b8) at ../contrib/poco/Foundation/src/Thread_POSIX.cpp:345
#25 0x00007f6916716259 in start_thread () from /usr/lib/libpthread.so.0
#26 0x00007f691662d5e3 in clone () from /usr/lib/libc.so.6
Built from master/HEAD in debug mode
The text was updated successfully, but these errors were encountered:
Fixed with #26026. The problem wasn't that the materialization of the projection is in progress, but that it couldn't merge the result of the 2 pipes (the ordinary_pipe that reads the parts that aren't materialized yet, and the projection_pipe that reads projected parts) because the ordinary was using the projection query, which has more columns than necessary.
To fix it I changed the ordinary pipe to use the main plan / query when the projection doesn't use aggregation and that seems to be working fine.
You have to provide the following information whenever possible.
Describe the bug
If you run a query that uses a projection while it's being materialized it might crash the server.
Does it reproduce on recent release?
Only tested on master/HEAD
How to reproduce
Here is what I did to reproduce it (twice):
Table (113M rows)
Add a new projection:
Materialize it:
Inmediately after, launch queries that should use that projection:
First I got a correct error as the projection wasn't ready and
force_optimize_projection
is on:Then I got a crash with the same query:
Expected behavior
The projection shouldn't be considered if it isn't ready.
Error message and/or stacktrace
The logs at that time show that MergerMutator is generating the projection while the query arrives:
Backtraces:
As reported by the client / logs:
From the coredump:
Built from master/HEAD in debug mode
The text was updated successfully, but these errors were encountered: