From 4a302d1a65dc086e7686c20781b14ea2688e4776 Mon Sep 17 00:00:00 2001 From: mlycore Date: Thu, 28 Dec 2023 18:07:02 +0800 Subject: [PATCH] fix: fix no metadata database found Signed-off-by: mlycore --- pitr/cli/internal/cmd/restore.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pitr/cli/internal/cmd/restore.go b/pitr/cli/internal/cmd/restore.go index 99e2755b..8764cc60 100644 --- a/pitr/cli/internal/cmd/restore.go +++ b/pitr/cli/internal/cmd/restore.go @@ -151,6 +151,10 @@ func checkDatabaseExist(proxy pkg.IShardingSphereProxy, bak *model.LsBackup) err return xerr.NewCliErr(fmt.Sprintf("get cluster metadata failed. err: %s", err)) } + if clusterNow.MetaData.Databases == nil { + return xerr.NewCliErr(fmt.Sprintf("no cluster metadata database found. err: %s", err)) + } + for k := range clusterNow.MetaData.Databases { databaseNamesExist = append(databaseNamesExist, k) }