mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Update client & settings to std::shared_ptr<const>
This commit is contained in:
parent
09f1e2840c
commit
d264a5a148
@ -89,7 +89,7 @@ std::unique_ptr<SeekableReadBuffer> BackupReaderAzureBlobStorage::readFile(const
|
||||
key = file_name;
|
||||
}
|
||||
return std::make_unique<ReadBufferFromAzureBlobStorage>(
|
||||
client.get(), key, read_settings, settings.get()->max_single_read_retries,
|
||||
client, key, read_settings, settings.get()->max_single_read_retries,
|
||||
settings.get()->max_single_download_retries);
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ std::unique_ptr<ReadBuffer> BackupWriterAzureBlobStorage::readFile(const String
|
||||
}
|
||||
|
||||
return std::make_unique<ReadBufferFromAzureBlobStorage>(
|
||||
client.get(), key, read_settings, settings.get()->max_single_read_retries,
|
||||
client, key, read_settings, settings.get()->max_single_read_retries,
|
||||
settings.get()->max_single_download_retries);
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ std::unique_ptr<WriteBuffer> BackupWriterAzureBlobStorage::writeFile(const Strin
|
||||
key = file_name;
|
||||
}
|
||||
return std::make_unique<WriteBufferFromAzureBlobStorage>(
|
||||
client.get(),
|
||||
client,
|
||||
key,
|
||||
settings.get()->max_single_part_upload_size,
|
||||
DBMS_DEFAULT_BUFFER_SIZE,
|
||||
|
@ -28,10 +28,10 @@ public:
|
||||
|
||||
private:
|
||||
const DataSourceDescription data_source_description;
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> client;
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> client;
|
||||
StorageAzureBlob::Configuration configuration;
|
||||
std::unique_ptr<AzureObjectStorage> object_storage;
|
||||
MultiVersion<AzureObjectStorageSettings> settings;
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings;
|
||||
};
|
||||
|
||||
class BackupWriterAzureBlobStorage : public BackupWriterDefault
|
||||
@ -57,10 +57,10 @@ private:
|
||||
std::unique_ptr<ReadBuffer> readFile(const String & file_name, size_t expected_file_size) override;
|
||||
void removeFilesBatch(const Strings & file_names);
|
||||
const DataSourceDescription data_source_description;
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> client;
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> client;
|
||||
StorageAzureBlob::Configuration configuration;
|
||||
std::unique_ptr<AzureObjectStorage> object_storage;
|
||||
MultiVersion<AzureObjectStorageSettings> settings;
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -137,11 +137,11 @@ public:
|
||||
|
||||
bool isRemote() const override { return true; }
|
||||
|
||||
MultiVersion<AzureObjectStorageSettings> & getSettings() { return settings; }
|
||||
std::shared_ptr<const AzureObjectStorageSettings> getSettings() { return settings.get(); }
|
||||
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & getAzureBlobStorageClient() override
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> getAzureBlobStorageClient() override
|
||||
{
|
||||
return client;
|
||||
return client.get();
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
static bool canUseReadThroughCache(const ReadSettings & settings);
|
||||
|
||||
#if USE_AZURE_BLOB_STORAGE
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & getAzureBlobStorageClient() override
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> getAzureBlobStorageClient() override
|
||||
{
|
||||
return object_storage->getAzureBlobStorageClient();
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
virtual WriteSettings patchSettings(const WriteSettings & write_settings) const;
|
||||
|
||||
#if USE_AZURE_BLOB_STORAGE
|
||||
virtual MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & getAzureBlobStorageClient()
|
||||
virtual std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> getAzureBlobStorageClient()
|
||||
{
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "This function is only implemented for AzureBlobStorage");
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ namespace
|
||||
public:
|
||||
UploadHelper(
|
||||
const CreateReadBuffer & create_read_buffer_,
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & client_,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> client_,
|
||||
size_t offset_,
|
||||
size_t total_size_,
|
||||
const String & dest_container_for_logging_,
|
||||
const String & dest_blob_,
|
||||
MultiVersion<AzureObjectStorageSettings> settings_,
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings_,
|
||||
ThreadPoolCallbackRunner<void> schedule_,
|
||||
bool for_disk_azure_blob_storage_,
|
||||
const Poco::Logger * log_)
|
||||
@ -71,12 +71,12 @@ namespace
|
||||
|
||||
protected:
|
||||
std::function<std::unique_ptr<SeekableReadBuffer>()> create_read_buffer;
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & client;
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> client;
|
||||
size_t offset;
|
||||
size_t total_size;
|
||||
const String & dest_container_for_logging;
|
||||
const String & dest_blob;
|
||||
MultiVersion<AzureObjectStorageSettings> settings;
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings;
|
||||
ThreadPoolCallbackRunner<void> schedule;
|
||||
bool for_disk_azure_blob_storage;
|
||||
const Poco::Logger * log;
|
||||
@ -116,7 +116,7 @@ namespace
|
||||
|
||||
void completeMultipartUpload()
|
||||
{
|
||||
auto block_blob_client = client.get()->GetBlockBlobClient(dest_blob);
|
||||
auto block_blob_client = client->GetBlockBlobClient(dest_blob);
|
||||
block_blob_client.CommitBlockList(block_ids);
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ namespace
|
||||
if (for_disk_azure_blob_storage)
|
||||
ProfileEvents::increment(ProfileEvents::DiskAzureUploadPart);
|
||||
|
||||
auto block_blob_client = client.get()->GetBlockBlobClient(dest_blob);
|
||||
auto block_blob_client = client->GetBlockBlobClient(dest_blob);
|
||||
|
||||
while (!task.read_buffer->eof())
|
||||
{
|
||||
@ -267,10 +267,10 @@ void copyDataToAzureBlobStorageFile(
|
||||
const std::function<std::unique_ptr<SeekableReadBuffer>()> & create_read_buffer,
|
||||
size_t offset,
|
||||
size_t size,
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & dest_client,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> dest_client,
|
||||
const String & dest_container_for_logging,
|
||||
const String & dest_blob,
|
||||
MultiVersion<AzureObjectStorageSettings> settings,
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings,
|
||||
ThreadPoolCallbackRunner<void> schedule,
|
||||
bool for_disk_azure_blob_storage)
|
||||
{
|
||||
@ -280,15 +280,15 @@ void copyDataToAzureBlobStorageFile(
|
||||
|
||||
|
||||
void copyAzureBlobStorageFile(
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & src_client,
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & dest_client,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> src_client,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> dest_client,
|
||||
const String & src_container_for_logging,
|
||||
const String & src_blob,
|
||||
size_t offset,
|
||||
size_t size,
|
||||
const String & dest_container_for_logging,
|
||||
const String & dest_blob,
|
||||
MultiVersion<AzureObjectStorageSettings> settings,
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings,
|
||||
const ReadSettings & read_settings,
|
||||
ThreadPoolCallbackRunner<void> schedule,
|
||||
bool for_disk_azure_blob_storage)
|
||||
@ -300,8 +300,8 @@ void copyAzureBlobStorageFile(
|
||||
if (for_disk_azure_blob_storage)
|
||||
ProfileEvents::increment(ProfileEvents::DiskAzureCopyObject);
|
||||
|
||||
auto block_blob_client_src = src_client.get()->GetBlockBlobClient(src_blob);
|
||||
auto block_blob_client_dest = dest_client.get()->GetBlockBlobClient(dest_blob);
|
||||
auto block_blob_client_src = src_client->GetBlockBlobClient(src_blob);
|
||||
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)
|
||||
@ -328,7 +328,7 @@ void copyAzureBlobStorageFile(
|
||||
LOG_TRACE(&Poco::Logger::get("copyAzureBlobStorageFile"), "Reading from Container: {}, Blob: {}", src_container_for_logging, src_blob);
|
||||
auto create_read_buffer = [&]
|
||||
{
|
||||
return std::make_unique<ReadBufferFromAzureBlobStorage>(src_client.get(), src_blob, read_settings, settings.get()->max_single_read_retries,
|
||||
return std::make_unique<ReadBufferFromAzureBlobStorage>(src_client, src_blob, read_settings, settings.get()->max_single_read_retries,
|
||||
settings.get()->max_single_download_retries);
|
||||
};
|
||||
|
||||
|
@ -21,15 +21,15 @@ using CreateReadBuffer = std::function<std::unique_ptr<SeekableReadBuffer>()>;
|
||||
/// Copies a file from AzureBlobStorage to AzureBlobStorage.
|
||||
/// The parameters `src_offset` and `src_size` specify a part in the source to copy.
|
||||
void copyAzureBlobStorageFile(
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & src_client,
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & dest_client,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> src_client,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> dest_client,
|
||||
const String & src_container_for_logging,
|
||||
const String & src_blob,
|
||||
size_t src_offset,
|
||||
size_t src_size,
|
||||
const String & dest_container_for_logging,
|
||||
const String & dest_blob,
|
||||
MultiVersion<AzureObjectStorageSettings> settings,
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings,
|
||||
const ReadSettings & read_settings,
|
||||
ThreadPoolCallbackRunner<void> schedule_ = {},
|
||||
bool for_disk_azure_blob_storage = false);
|
||||
@ -44,10 +44,10 @@ void copyDataToAzureBlobStorageFile(
|
||||
const std::function<std::unique_ptr<SeekableReadBuffer>()> & create_read_buffer,
|
||||
size_t offset,
|
||||
size_t size,
|
||||
MultiVersion<Azure::Storage::Blobs::BlobContainerClient> & client,
|
||||
std::shared_ptr<const Azure::Storage::Blobs::BlobContainerClient> client,
|
||||
const String & dest_container_for_logging,
|
||||
const String & dest_blob,
|
||||
MultiVersion<AzureObjectStorageSettings> settings,
|
||||
std::shared_ptr<const AzureObjectStorageSettings> settings,
|
||||
ThreadPoolCallbackRunner<void> schedule_ = {},
|
||||
bool for_disk_azure_blob_storage = false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user