Added setting azure_max_single_part_copy_size

This commit is contained in:
Smita Kulkarni 2024-01-29 10:49:36 +01:00
parent d264a5a148
commit a22b68f46f
4 changed files with 9 additions and 7 deletions

View File

@ -82,7 +82,8 @@ class IColumn;
M(UInt64, s3_upload_part_size_multiply_parts_count_threshold, 500, "Each time this number of parts was uploaded to S3, s3_min_upload_part_size is multiplied by s3_upload_part_size_multiply_factor.", 0) \
M(UInt64, s3_max_inflight_parts_for_one_file, 20, "The maximum number of a concurrent loaded parts in multipart upload request. 0 means unlimited. You ", 0) \
M(UInt64, s3_max_single_part_upload_size, 32*1024*1024, "The maximum size of object to upload using singlepart upload to S3.", 0) \
M(UInt64, azure_max_single_part_upload_size, 100*1024*1024, "The maximum size of object to upload using singlepart upload to Azure blob storage.", 0) \
M(UInt64, azure_max_single_part_upload_size, 100*1024*1024, "The maximum size of object to upload using singlepart upload to Azure blob storage.", 0) \
M(UInt64, azure_max_single_part_copy_size, 256*1024*1024, "The maximum size of object to copy using single part copy to Azure blob storage.", 0) \
M(UInt64, s3_max_single_read_retries, 4, "The maximum number of retries during single S3 read.", 0) \
M(UInt64, azure_max_single_read_retries, 4, "The maximum number of retries during single Azure blob storage read.", 0) \
M(UInt64, s3_max_unexpected_write_error_retries, 4, "The maximum number of retries in case of unexpected errors during S3 write.", 0) \

View File

@ -7,6 +7,7 @@
#include <optional>
#include <azure/identity/managed_identity_credential.hpp>
#include <Poco/Util/AbstractConfiguration.h>
#include <Interpreters/Context.h>
using namespace Azure::Storage::Blobs;
@ -157,7 +158,7 @@ std::unique_ptr<BlobContainerClient> getAzureBlobContainerClient(
}
}
std::unique_ptr<AzureObjectStorageSettings> getAzureBlobStorageSettings(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr /*context*/)
std::unique_ptr<AzureObjectStorageSettings> getAzureBlobStorageSettings(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr context)
{
return std::make_unique<AzureObjectStorageSettings>(
config.getUInt64(config_prefix + ".max_single_part_upload_size", 100 * 1024 * 1024),
@ -166,6 +167,7 @@ std::unique_ptr<AzureObjectStorageSettings> getAzureBlobStorageSettings(const Po
config.getInt(config_prefix + ".max_single_download_retries", 3),
config.getInt(config_prefix + ".list_object_keys_size", 1000),
config.getUInt64(config_prefix + ".max_upload_part_size", 5ULL * 1024 * 1024 * 1024),
config.getUInt64(config_prefix + ".max_single_part_copy_size", context->getSettings().azure_max_single_part_copy_size),
config.getBool(config_prefix + ".use_native_copy", false)
);
}

View File

@ -25,6 +25,7 @@ struct AzureObjectStorageSettings
int max_single_download_retries_,
int list_object_keys_size_,
size_t max_upload_part_size_,
size_t max_single_part_copy_size_,
bool use_native_copy_)
: max_single_part_upload_size(max_single_part_upload_size_)
, min_bytes_for_seek(min_bytes_for_seek_)
@ -32,6 +33,7 @@ struct AzureObjectStorageSettings
, max_single_download_retries(max_single_download_retries_)
, list_object_keys_size(list_object_keys_size_)
, max_upload_part_size(max_upload_part_size_)
, max_single_part_copy_size(max_single_part_copy_size_)
, use_native_copy(use_native_copy_)
{
}
@ -46,6 +48,7 @@ struct AzureObjectStorageSettings
size_t min_upload_part_size = 16 * 1024 * 1024;
size_t max_upload_part_size = 5ULL * 1024 * 1024 * 1024;
size_t max_part_number = 10000;
size_t max_single_part_copy_size = 256 * 1024 * 1024;
bool use_native_copy = false;
};

View File

@ -33,10 +33,6 @@ namespace ErrorCodes
extern const int AZURE_BLOB_STORAGE_ERROR;
}
size_t max_single_operation_copy_size = 256 * 1024 * 1024;
namespace
{
class UploadHelper
@ -304,7 +300,7 @@ void copyAzureBlobStorageFile(
auto block_blob_client_dest = dest_client->GetBlockBlobClient(dest_blob);
auto source_uri = block_blob_client_src.GetUrl();
if (size < max_single_operation_copy_size)
if (size < settings.get()->max_single_part_copy_size)
{
block_blob_client_dest.CopyFromUri(source_uri);
}