From 862b7360ca6aac45ac286de5358a1e082e682afb Mon Sep 17 00:00:00 2001 From: Slach Date: Tue, 13 Aug 2024 23:29:40 +0400 Subject: [PATCH] fix corner case for backup/restore RBAC object with trailing slash, warn /clickhouse/access//uuid have no children, skip Dump --- ChangeLog.md | 4 ++++ pkg/backup/create.go | 2 +- pkg/keeper/keeper.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 503bc6c9..78533ff3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +# v2.5.29 +BUG FIXES +- fix corner case for backup/restore RBAC object with trailing slash, warn /clickhouse/access//uuid have no children, skip Dump + # v2.5.28 BUG FIXES - fix corner cases for wrong *_last* metrics calculation after restart, fix [980](https://github.com/Altinity/clickhouse-backup/issues/980) diff --git a/pkg/backup/create.go b/pkg/backup/create.go index 17d4ca35..ef75cfd5 100644 --- a/pkg/backup/create.go +++ b/pkg/backup/create.go @@ -704,7 +704,7 @@ func (b *Backuper) createBackupRBACReplicated(ctx context.Context, rbacBackup st return 0, err } if rbacUUIDObjectsCount == 0 { - log.Warn().Str("logger", "createBackupRBACReplicated").Msgf("%s/%s have no childs, skip Dump", replicatedAccessPath, "uuid") + log.Warn().Str("logger", "createBackupRBACReplicated").Msgf("%s/%s have no children, skip Dump", replicatedAccessPath, "uuid") continue } if err = os.MkdirAll(rbacBackup, 0755); err != nil { diff --git a/pkg/keeper/keeper.go b/pkg/keeper/keeper.go index 20cc42af..794e1335 100644 --- a/pkg/keeper/keeper.go +++ b/pkg/keeper/keeper.go @@ -108,7 +108,7 @@ func (k *Keeper) GetReplicatedAccessPath(userDirectory string) (string, error) { if zookeeperPathNode == nil { return "", fmt.Errorf("can't find %s in %s", xPathQuery, k.xmlConfigFile) } - return zookeeperPathNode.InnerText(), nil + return strings.TrimSuffix(zookeeperPathNode.InnerText(), "/"), nil } func (k *Keeper) Dump(prefix, dumpFile string) (int, error) {