mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 12:22:12 +00:00
Merge pull request #66332 from ClickHouse/backport/24.6/65403
Backport #65403 to 24.6: Use tryGetS3StorageClient to avoid raising an exception when logging s3
This commit is contained in:
commit
01c707837c
@ -355,6 +355,8 @@ public:
|
||||
{
|
||||
return delegate->getS3StorageClient();
|
||||
}
|
||||
|
||||
std::shared_ptr<const S3::Client> tryGetS3StorageClient() const override { return delegate->tryGetS3StorageClient(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -478,6 +478,8 @@ public:
|
||||
"Method getS3StorageClient() is not implemented for disk type: {}",
|
||||
getDataSourceDescription().toString());
|
||||
}
|
||||
|
||||
virtual std::shared_ptr<const S3::Client> tryGetS3StorageClient() const { return nullptr; }
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -138,6 +138,11 @@ public:
|
||||
{
|
||||
return object_storage->getS3StorageClient();
|
||||
}
|
||||
|
||||
std::shared_ptr<const S3::Client> tryGetS3StorageClient() override
|
||||
{
|
||||
return object_storage->tryGetS3StorageClient();
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -587,6 +587,11 @@ std::shared_ptr<const S3::Client> DiskObjectStorage::getS3StorageClient() const
|
||||
{
|
||||
return object_storage->getS3StorageClient();
|
||||
}
|
||||
|
||||
std::shared_ptr<const S3::Client> DiskObjectStorage::tryGetS3StorageClient() const
|
||||
{
|
||||
return object_storage->tryGetS3StorageClient();
|
||||
}
|
||||
#endif
|
||||
|
||||
DiskPtr DiskObjectStorageReservation::getDisk(size_t i) const
|
||||
|
@ -214,6 +214,7 @@ public:
|
||||
|
||||
#if USE_AWS_S3
|
||||
std::shared_ptr<const S3::Client> getS3StorageClient() const override;
|
||||
std::shared_ptr<const S3::Client> tryGetS3StorageClient() const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -269,6 +269,7 @@ public:
|
||||
{
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "This function is only implemented for S3ObjectStorage");
|
||||
}
|
||||
virtual std::shared_ptr<const S3::Client> tryGetS3StorageClient() { return nullptr; }
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -634,6 +634,10 @@ std::shared_ptr<const S3::Client> S3ObjectStorage::getS3StorageClient()
|
||||
return client.get();
|
||||
}
|
||||
|
||||
std::shared_ptr<const S3::Client> S3ObjectStorage::tryGetS3StorageClient()
|
||||
{
|
||||
return client.get();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -169,6 +169,7 @@ public:
|
||||
bool isReadOnly() const override { return s3_settings.get()->read_only; }
|
||||
|
||||
std::shared_ptr<const S3::Client> getS3StorageClient() override;
|
||||
std::shared_ptr<const S3::Client> tryGetS3StorageClient() override;
|
||||
private:
|
||||
void setNewSettings(std::unique_ptr<S3ObjectStorageSettings> && s3_settings_);
|
||||
|
||||
|
@ -233,29 +233,22 @@ void ServerAsynchronousMetrics::updateImpl(TimePoint update_time, TimePoint curr
|
||||
}
|
||||
|
||||
#if USE_AWS_S3
|
||||
try
|
||||
if (auto s3_client = disk->tryGetS3StorageClient())
|
||||
{
|
||||
if (auto s3_client = disk->getS3StorageClient())
|
||||
if (auto put_throttler = s3_client->getPutRequestThrottler())
|
||||
{
|
||||
if (auto put_throttler = s3_client->getPutRequestThrottler())
|
||||
{
|
||||
new_values[fmt::format("DiskPutObjectThrottlerRPS_{}", name)] = { put_throttler->getMaxSpeed(),
|
||||
"PutObject Request throttling limit on the disk in requests per second (virtual filesystem). Local filesystems may not provide this information." };
|
||||
new_values[fmt::format("DiskPutObjectThrottlerAvailable_{}", name)] = { put_throttler->getAvailable(),
|
||||
"Number of PutObject requests that can be currently issued without hitting throttling limit on the disk (virtual filesystem). Local filesystems may not provide this information." };
|
||||
}
|
||||
if (auto get_throttler = s3_client->getGetRequestThrottler())
|
||||
{
|
||||
new_values[fmt::format("DiskGetObjectThrottlerRPS_{}", name)] = { get_throttler->getMaxSpeed(),
|
||||
"GetObject Request throttling limit on the disk in requests per second (virtual filesystem). Local filesystems may not provide this information." };
|
||||
new_values[fmt::format("DiskGetObjectThrottlerAvailable_{}", name)] = { get_throttler->getAvailable(),
|
||||
"Number of GetObject requests that can be currently issued without hitting throttling limit on the disk (virtual filesystem). Local filesystems may not provide this information." };
|
||||
}
|
||||
new_values[fmt::format("DiskPutObjectThrottlerRPS_{}", name)] = { put_throttler->getMaxSpeed(),
|
||||
"PutObject Request throttling limit on the disk in requests per second (virtual filesystem). Local filesystems may not provide this information." };
|
||||
new_values[fmt::format("DiskPutObjectThrottlerAvailable_{}", name)] = { put_throttler->getAvailable(),
|
||||
"Number of PutObject requests that can be currently issued without hitting throttling limit on the disk (virtual filesystem). Local filesystems may not provide this information." };
|
||||
}
|
||||
if (auto get_throttler = s3_client->getGetRequestThrottler())
|
||||
{
|
||||
new_values[fmt::format("DiskGetObjectThrottlerRPS_{}", name)] = { get_throttler->getMaxSpeed(),
|
||||
"GetObject Request throttling limit on the disk in requests per second (virtual filesystem). Local filesystems may not provide this information." };
|
||||
new_values[fmt::format("DiskGetObjectThrottlerAvailable_{}", name)] = { get_throttler->getAvailable(),
|
||||
"Number of GetObject requests that can be currently issued without hitting throttling limit on the disk (virtual filesystem). Local filesystems may not provide this information." };
|
||||
}
|
||||
}
|
||||
catch (...) // NOLINT(bugprone-empty-catch)
|
||||
{
|
||||
// Skip disk that do not have s3 throttlers
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user