MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / processQuery

Method processQuery

src/Server/InterserverIOHTTPHandler.cpp:55–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void InterserverIOHTTPHandler::processQuery(HTTPServerRequest & request, HTTPServerResponse & response, OutputPtr output)
56{
57 HTMLForm params(server.context()->getSettingsRef(), request);
58
59 LOG_TRACE(log, "Request URI: {}", request.getURI());
60
61 String endpoint_name = params.get("endpoint");
62 bool compress = params.get("compress") == "true";
63
64 auto endpoint = server.context()->getInterserverIOHandler().getEndpoint(endpoint_name);
65 /// Locked for read while query processing
66 std::shared_lock lock(endpoint->rwlock);
67 if (endpoint->blocker.isCancelled())
68 throw Exception(ErrorCodes::ABORTED, "Transferring part to replica was cancelled");
69
70 if (compress)
71 {
72 CompressedWriteBuffer compressed_out(*output);
73 endpoint->processQuery(params, request.getStream(), compressed_out, response);
74 compressed_out.finalize();
75 }
76 else
77 {
78 endpoint->processQuery(params, request.getStream(), *output, response);
79 }
80 /// Make sure that request stream is not used after this function.
81 chassert(request.getStream().use_count() == 2);
82}
83
84
85void InterserverIOHTTPHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event)

Callers

nothing calls this directly

Calls 9

getURIMethod · 0.80
use_countMethod · 0.80
ExceptionClass · 0.50
contextMethod · 0.45
getMethod · 0.45
getEndpointMethod · 0.45
isCancelledMethod · 0.45
getStreamMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected