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

Method makeRequestInternalImpl

src/IO/S3/PocoHTTPClient.cpp:463–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463void PocoHTTPClient::makeRequestInternalImpl(
464 Aws::Http::HttpRequest & request,
465 std::shared_ptr<PocoHTTPResponse> & response,
466 Aws::Utils::RateLimits::RateLimiterInterface *,
467 Aws::Utils::RateLimits::RateLimiterInterface *) const
468{
469 LoggerPtr log = getLogger("AWSClient");
470
471 auto uri = request.GetUri().GetURIString();
472 auto method = getMethod(request);
473
474 auto sdk_attempt = getSDKAttemptNumber(request);
475 auto ch_attempt = getClickhouseAttemptNumber(request);
476 bool first_attempt = ch_attempt == 1 && sdk_attempt == 1;
477
478 if (!first_attempt)
479 LOG_DEBUG(
480 log,
481 "Retrying S3 request to: {}, aws sdk attempt: {}, clickhouse attempt: {}, kind: {}",
482 uri, sdk_attempt, ch_attempt, getMetricKind(request) == S3MetricKind::Read ? "Read" : "Write");
483 else // if (enable_s3_requests_logging)
484 LOG_TEST(
485 log,
486 "Make S3 request to: {}, aws sdk attempt: {}, clickhouse attempt: {}, kind: {}",
487 uri, sdk_attempt, ch_attempt, getMetricKind(request) == S3MetricKind::Read ? "Read" : "Write");
488
489 switch (request.GetMethod())
490 {
491 case Aws::Http::HttpMethod::HTTP_GET:
492 case Aws::Http::HttpMethod::HTTP_HEAD:
493 case Aws::Http::HttpMethod::HTTP_TRACE:
494 case Aws::Http::HttpMethod::HTTP_OPTIONS:
495 case Aws::Http::HttpMethod::HTTP_CONNECT:
496 /// Limits get request per second rate for GET, SELECT and all other requests, excluding throttled by put throttler
497 /// (i.e. throttles GetObject, HeadObject)
498 request_throttler.throttleHTTPGet();
499 break;
500 case Aws::Http::HttpMethod::HTTP_PUT:
501 case Aws::Http::HttpMethod::HTTP_POST:
502 case Aws::Http::HttpMethod::HTTP_PATCH:
503 /// Limits put request per second rate for PUT, COPY, POST, LIST requests
504 /// (i.e. throttles PutObject, CopyObject, ListObjects, CreateMultipartUpload, UploadPartCopy, UploadPart, CompleteMultipartUpload)
505 request_throttler.throttleHTTPPut();
506 break;
507 case Aws::Http::HttpMethod::HTTP_DELETE:
508 /// DELETE and CANCEL requests are not throttled by either put or get throttler
509 break;
510 }
511
512 addMetric(request, S3MetricType::Count);
513 CurrentMetrics::Increment metric_increment{CurrentMetrics::S3Requests};
514
515 UInt64 connect_time = 0;
516 UInt64 first_byte_time = 0;
517 bool latency_recorded = false;
518 S3LatencyType first_byte_latency_type = getFirstByteLatencyType(sdk_attempt, ch_attempt);
519
520 auto account_error = [&]()

Callers

nothing calls this directly

Calls 15

getSDKAttemptNumberFunction · 0.85
makeHTTPSessionFunction · 0.85
getTimeoutsFunction · 0.85
setTimeoutsFunction · 0.85
throttleHTTPGetMethod · 0.80
throttleHTTPPutMethod · 0.80
setMethodMethod · 0.80
GetHeadersMethod · 0.80

Tested by

no test coverage detected