Skip to content

Commit e7d99ff

Browse files
committed
found NewBackupDestination applyMacros doesn't work for b.cfg
Signed-off-by: Slach <bloodjazman@gmail.com>
1 parent 154a333 commit e7d99ff

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

pkg/backup/backuper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func (b *Backuper) getEmbeddedBackupLocation(ctx context.Context, backupName str
268268
if os.Getenv("AWS_ACCESS_KEY_ID") != "" {
269269
return fmt.Sprintf("S3('%s/%s/','%s','%s')", s3Endpoint, backupName, os.Getenv("AWS_ACCESS_KEY_ID"), os.Getenv("AWS_SECRET_ACCESS_KEY")), nil
270270
}
271-
return "", fmt.Errorf("provide s3->access_key and s3->secret_key in config to allow embedded backup without `clickhouse->embedded_backup_disk`")
271+
return "", errors.WithStack(errors.New("provide s3->access_key and s3->secret_key in config to allow embedded backup without `clickhouse->embedded_backup_disk`"))
272272
}
273273
if b.cfg.General.RemoteStorage == "gcs" {
274274
gcsEndpoint, err := b.ch.ApplyMacros(ctx, b.buildEmbeddedLocationGCS())

pkg/backup/delete.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (b *Backuper) RemoveBackupLocal(ctx context.Context, backupName string, dis
179179

180180
func (b *Backuper) cleanEmbeddedAndObjectDiskLocalIfSameRemoteNotPresent(ctx context.Context, backupName string, disks []clickhouse.Disk, backup LocalBackup, hasObjectDisks bool) error {
181181
skip, err := b.skipIfTheSameRemoteBackupPresent(ctx, backup.BackupName, backup.Tags)
182-
log.Debug().Msgf("b.skipIfTheSameRemoteBackupPresent return skip=%v", skip)
182+
log.Debug().Str("backupName", backup.BackupName).Str("tags", backup.Tags).Msgf("b.skipIfTheSameRemoteBackupPresent return skip=%v", skip)
183183
if err != nil {
184184
return err
185185
}
@@ -333,6 +333,7 @@ func (b *Backuper) cleanEmbeddedAndObjectDiskRemoteIfSameLocalNotPresent(ctx con
333333
if skip, err = b.skipIfSameLocalBackupPresent(ctx, backup.BackupName, backup.Tags); err != nil {
334334
return err
335335
}
336+
log.Debug().Str("backupName", backup.BackupName).Str("tags", backup.Tags).Msgf("b.skipIfSameLocalBackupPresent return skip=%v", skip)
336337
if !skip {
337338
if b.isEmbedded && b.cfg.ClickHouse.EmbeddedBackupDisk != "" {
338339
if err = b.cleanRemoteEmbedded(ctx, backup); err != nil {

test/integration/integration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4174,6 +4174,7 @@ func fullCleanup(t *testing.T, r *require.Assertions, env *TestEnvironment, back
41744174
if checkDeleteErr {
41754175
r.NoError(err, "checkDeleteErr delete %s %s output: \n%s\nerror: %v", backupType, backupName, out, err)
41764176
}
4177+
log.Debug().Msg(out)
41774178
}
41784179
}
41794180
otherBackupList, lsErr := env.DockerExecOut("clickhouse", "ls", "-1", "/var/lib/clickhouse/backup/*"+t.Name()+"*")
@@ -4184,6 +4185,7 @@ func fullCleanup(t *testing.T, r *require.Assertions, env *TestEnvironment, back
41844185
if checkDeleteOtherErr {
41854186
r.NoError(err, "%s\nunexpected delete local %s output: \n%s\nerror: %v, ", backupName, out, err)
41864187
}
4188+
log.Debug().Msg(out)
41874189
}
41884190
}
41894191
}

0 commit comments

Comments
 (0)