| 53 | } |
| 54 | |
| 55 | void 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 | |
| 85 | void InterserverIOHTTPHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) |
nothing calls this directly
no test coverage detected