Revert "Revert " Keeper retries during insert (clean)""#43122
Revert "Revert " Keeper retries during insert (clean)""#43122devcrafter merged 2 commits intomasterfrom
Conversation
- remove unused config for now
1972b25 to
c00f713
Compare
|
Integration test failures:
Stress tests:
@tavplubix doesn't look as something familiar? |
No, it's something new. Seems like the directory just disappeared somehow, but I don't see who could remove it: |
Created #43185 |
| } | ||
| else if (multi_code == Coordination::Error::ZCONNECTIONLOSS | ||
| || multi_code == Coordination::Error::ZOPERATIONTIMEOUT) | ||
| else if (Coordination::isHardwareError(multi_code)) |
There was a problem hiding this comment.
I wonder if it would be possible to improve this error and the use of part_committed_locally_but_zookeeper.
Currently if there is a hardware error here CH checks if the part was written to ZK, if it is then it returns success and if it doesn't it returns a failure UNEXPECTED_ZOOKEEPER_ERROR, asking the customer to retry and leaving the part to be cleaned up later.
Knowing that of the operations done in the process is to unlock the block_number_lock, could we use the that to retry these operations if the lock still exist? The idea would be to retry only this request and not the whole function. WDYT @devcrafter ?
One thing that might be necessary to do this would be to break down the function a big (it's over 600 lines with lots of branches) so it's simpler to decide if ZK retrial, and which part, is possible. It might require a refactor of the function and of the retries (to share retries across different blocks).
There was a problem hiding this comment.
@devcrafter Any thoughts on this?
When it happens the backtrace is something like:
2023.07.26 11:52:28.793411 [ 7396 ] {91b00065-31e7-4129-be83-521f34038017} <Error> executeQuery: Code: 244. DB::Exception: Insert failed due to zookeeper error. Please retry. Reason: Connection loss: while pushing to view XXXXXXXXXXXXXXXXXXXXXX (5f9f5456-e71b-41f7-ac1e-4cee888817a9): while pushing to view YYYYYYYYYYYYYYYYYYYYYY (6f1e9b40-f141-4df6-b7c2-de8863ef7561). (UNEXPECTED_ZOOKEEPER_ERROR) (version 23.5.3.24 (official build)) (from 10.150.15.221:50962) (
in query: INSERT INTO ZZZZZZZZZZZZZZZZZZZZZZZZ(oid, pid, id, h, u, v, t, c, p, n, s, bn, bv, en, ev, on, ov, ovn, pt, pv, pm) FORMAT RowBinary ), Stack trace (when copying this message, always include the lines below):
0. DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000000e348c95 in /usr/bin/clickhouse
1. ? @ 0x0000000008b89b4d in /usr/bin/clickhouse
2. ? @ 0x00000000129b7e9e in /usr/bin/clickhouse
3. ? @ 0x00000000129b705e in /usr/bin/clickhouse
4. DB::ReplicatedMergeTreeSinkImpl<false>::commitPart(std::shared_ptr<DB::ZooKeeperWithFaultInjection> const&, std::shared_ptr<DB::IMergeTreeDataPart>&, String const&, unsigned long, bool) @ 0x0000000014b1bdf9 in /usr/bin/clickhouse
5. DB::ReplicatedMergeTreeSinkImpl<false>::finishDelayedChunk(std::shared_ptr<DB::ZooKeeperWithFaultInjection> const&) @ 0x0000000014b18a1a in /usr/bin/clickhouse
6. DB::ReplicatedMergeTreeSinkImpl<false>::consume(DB::Chunk) @ 0x0000000014b17bdd in /usr/bin/clickhouse
7. DB::SinkToStorage::onConsume(DB::Chunk) @ 0x0000000014ff6566 in /usr/bin/clickhouse
8. ? @ 0x0000000014f3dbeb in /usr/bin/clickhouse
9. ? @ 0x0000000014f3d91c in /usr/bin/clickhouse
10. DB::ExceptionKeepingTransform::work() @ 0x0000000014f3d1d8 in /usr/bin/clickhouse
11. DB::ExecutionThreadContext::executeTask() @ 0x0000000014d37d89 in /usr/bin/clickhouse
12. DB::PipelineExecutor::executeStepImpl(unsigned long, std::atomic<bool>*) @ 0x0000000014d2ea10 in /usr/bin/clickhouse
13. DB::PipelineExecutor::executeImpl(unsigned long) @ 0x0000000014d2df30 in /usr/bin/clickhouse
14. DB::PipelineExecutor::execute(unsigned long) @ 0x0000000014d2dbd1 in /usr/bin/clickhouse
15. DB::CompletedPipelineExecutor::execute() @ 0x0000000014d2c4dd in /usr/bin/clickhouse
16. DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::shared_ptr<DB::Context>, std::function<void (DB::QueryResultDetails const&)>, std::optional<DB::FormatSettings> const&) @ 0x0000000013ee210b in /usr/bin/clickhouse
17. DB::HTTPHandler::processQuery(DB::HTTPServerRequest&, DB::HTMLForm&, DB::HTTPServerResponse&, DB::HTTPHandler::Output&, std::optional<DB::CurrentThread::QueryScope>&) @ 0x0000000014c7ee35 in /usr/bin/clickhouse
18. DB::HTTPHandler::handleRequest(DB::HTTPServerRequest&, DB::HTTPServerResponse&) @ 0x0000000014c830c4 in /usr/bin/clickhouse
19. DB::HTTPServerConnection::run() @ 0x0000000014cf2bf2 in /usr/bin/clickhouse
20. Poco::Net::TCPServerConnection::start() @ 0x0000000017c2fe34 in /usr/bin/clickhouse
21. Poco::Net::TCPServerDispatcher::run() @ 0x0000000017c31051 in /usr/bin/clickhouse
22. Poco::PooledThread::run() @ 0x0000000017dadd07 in /usr/bin/clickhouse
23. Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000017dab73c in /usr/bin/clickhouse
24. start_thread @ 0x00000000000076db in /lib/x86_64-linux-gnu/libpthread-2.27.so
25. __clone @ 0x000000000012161f in /lib/x86_64-linux-gnu/libc-2.27.so
There was a problem hiding this comment.
Knowing that of the operations done in the process is to unlock the
block_number_lock, could we use the that to retry these operations if the lock still exist? The idea would be to retry only this request and not the whole function.
block_number_lock creates an ephemeral node in zookeeper. After the connection/session to the zookeeper is lost/closed, it's no longer valid, and so block_number. So, this way is not viable (until I miss something)
There was a problem hiding this comment.
Usually the ephemeral lock will still be alive as ZK keeps it for a set amount of time so we can try to recover it. IIRC for the table locks, we check if it exists and if it does delete it and recreate it to gain it again thus avoiding the need to wait until deletion happens normally. We could do something similar as long as we keep it concurrent safe.
Reverts #43116
Resurrect #42607