From e568996e74076ba3c494bd36cb29273a2a2d884e Mon Sep 17 00:00:00 2001 From: Slach Date: Tue, 22 Oct 2024 22:44:08 +0400 Subject: [PATCH] fix `use_embedded_backup_restore: true` behavior for azblob, fix https://github.com/Altinity/clickhouse-backup/issues/1031 --- ChangeLog.md | 3 ++- pkg/backup/backuper.go | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 0fed724e..6eab921a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,10 +10,11 @@ IMPROVEMENTS BUG FIXES - fix `TestLongListRemote` for properly time measurement - fix log_pointer handle from system.replicas during restore, fix [967](https://github.com/Altinity/clickhouse-backup/issues/967) +- fix `use_embedded_backup_restore: true` behavior for azblob, fix [1031](https://github.com/Altinity/clickhouse-backup/issues/1031) # v2.6.2 BUG FIXES -- fix rare corner case, for system.disks query behavior fix[1007](https://github.com/Altinity/clickhouse-backup/issues/1007) +- fix rare corner case, for system.disks query behavior fix [1007](https://github.com/Altinity/clickhouse-backup/issues/1007) - fix --partitions and --restore-database-mapping, --restore-table-mapping works together, fix [1018](https://github.com/Altinity/clickhouse-backup/issues/1018) - fix wrong slices initialization for `shardFuncByName` (rare used function for backup different tables from different shards), fix [1019](https://github.com/Altinity/clickhouse-backup/pull/1019), thanks @cuishuang diff --git a/pkg/backup/backuper.go b/pkg/backup/backuper.go index b3d2aab6..cff61d91 100644 --- a/pkg/backup/backuper.go +++ b/pkg/backup/backuper.go @@ -347,8 +347,13 @@ func (b *Backuper) buildEmbeddedLocationGCS() string { func (b *Backuper) buildEmbeddedLocationAZBLOB() string { azblobBackupURL := url.URL{} azblobBackupURL.Scheme = b.cfg.AzureBlob.EndpointSchema - azblobBackupURL.Host = b.cfg.AzureBlob.EndpointSuffix - azblobBackupURL.Path = b.cfg.AzureBlob.AccountName + // https://github.com/Altinity/clickhouse-backup/issues/1031 + if !strings.Contains(b.cfg.AzureBlob.EndpointSuffix, b.cfg.AzureBlob.AccountName) && b.cfg.AzureBlob.EndpointSuffix == "core.windows.net" { + azblobBackupURL.Host = b.cfg.AzureBlob.AccountName + "." + b.cfg.AzureBlob.EndpointSuffix + } else { + azblobBackupURL.Host = b.cfg.AzureBlob.EndpointSuffix + azblobBackupURL.Path = b.cfg.AzureBlob.AccountName + } return fmt.Sprintf("DefaultEndpointsProtocol=%s;AccountName=%s;AccountKey=%s;BlobEndpoint=%s;", b.cfg.AzureBlob.EndpointSchema, b.cfg.AzureBlob.AccountName, b.cfg.AzureBlob.AccountKey, azblobBackupURL.String()) }