innogames/graphite-ch-optimizer

(option to?) Continue if one optimize errors

Closed this issue · 3 comments

I am getting the following error on one of my partitions, from what i understand this is not critical so it would be nice to have the process continue with the rest of the tables:

[clickhouse][connect=2][query settings] optimize_throw_if_noop=1&receive_timeout=3600
[clickhouse][connect=2][process] <- exception
[clickhouse][connect=2][stmt] close
time="2020-07-07 05:18:49 UTC" level=error msg="[388] Cannot OPTIMIZE table: Cannot select parts for optimization \n0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x10412fe0 in /usr/bin/clickhouse\n1. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x900f8ad in /usr/bin/clickhouse\n2. ? @ 0xd6f4445 in /usr/bin/clickhouse\n3. DB::InterpreterOptimizeQuery::execute() @ 0xd222466 in /usr/bin/clickhouse\n4. ? @ 0xd5445c9 in /usr/bin/clickhouse\n5. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, bool) @ 0xd547bf5 in /usr/bin/clickhouse\n6. DB::TCPHandler::runImpl() @ 0x91159a8 in /usr/bin/clickhouse\n7. DB::TCPHandler::run() @ 0x9116980 in /usr/bin/clickhouse\n8. Poco::Net::TCPServerConnection::start() @ 0x102fed5b in /usr/bin/clickhouse\n9. Poco::Net::TCPServerDispatcher::run() @ 0x102ff1eb in /usr/bin/clickhouse\n10. Poco::PooledThread::run() @ 0x104acdb6 in /usr/bin/clickhouse\n11. Poco::ThreadImpl::runnableEntry(void*) @ 0x104a8070 in /usr/bin/clickhouse\n12. start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so\n13. clone @ 0x12188f in /lib/x86_64-linux-gnu/libc-2.27.so\n\n"
time="2020-07-07 05:18:49 UTC" level=error msg="[388] Cannot OPTIMIZE table: Cannot select parts for optimization \n0. Poco::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x10412fe0 in /usr/bin/clickhouse\n1. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x900f8ad in /usr/bin/clickhouse\n2. ? @ 0xd6f4445 in /usr/bin/clickhouse\n3. DB::InterpreterOptimizeQuery::execute() @ 0xd222466 in /usr/bin/clickhouse\n4. ? @ 0xd5445c9 in /usr/bin/clickhouse\n5. DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::Context&, bool, DB::QueryProcessingStage::Enum, bool, bool) @ 0xd547bf5 in /usr/bin/clickhouse\n6. DB::TCPHandler::runImpl() @ 0x91159a8 in /usr/bin/clickhouse\n7. DB::TCPHandler::run() @ 0x9116980 in /usr/bin/clickhouse\n8. Poco::Net::TCPServerConnection::start() @ 0x102fed5b in /usr/bin/clickhouse\n9. Poco::Net::TCPServerDispatcher::run() @ 0x102ff1eb in /usr/bin/clickhouse\n10. Poco::PooledThread::run() @ 0x104acdb6 in /usr/bin/clickhouse\n11. Poco::ThreadImpl::runnableEntry(void*) @ 0x104a8070 in /usr/bin/clickhouse\n12. start_thread @ 0x76db in /lib/x86_64-linux-gnu/libpthread-2.27.so\n13. clone @ 0x12188f in /lib/x86_64-linux-gnu/libc-2.27.so\n\n"
time="2020-07-07 05:18:49 UTC" level=fatal msg="Optimization failed: Fail to merge partition 20200630: code: 388, message: Cannot OPTIMIZE table: Cannot select parts for optimization"

Might also be nice to be able to pause and retry on this particular error ?

Hello Mark,
It's indeed a non-critical error, and you could disable them by overwriting the default DSN, see FAQ

So, instead of default tcp://localhost:9000?&optimize_throw_if_noop=1&receive_timeout=3600&debug=true you could use tcp://localhost:9000?receive_timeout=3600&debug=true for example

The code skips the only one particular error if the partition is already in progress. Cannot select parts for optimization looks a little bit suspicious, and it's good to make a research why is it the case.