This is an automated email from the ASF dual-hosted git repository.

zhaojinchao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shardingsphere-on-cloud.git


The following commit(s) were added to refs/heads/main by this push:
     new f5de34e  feat: remove all databases in proxy before restore (#485)
f5de34e is described below

commit f5de34e390ea285c711ee96c25043f923bf722e9
Author: Maxwell <[email protected]>
AuthorDate: Thu Dec 28 18:44:04 2023 +0800

    feat: remove all databases in proxy before restore (#485)
    
    * feat: remove all databases in proxy before restore
    
    Signed-off-by: mlycore <[email protected]>
    
    * fix: fix no metadata database found
    
    Signed-off-by: mlycore <[email protected]>
    
    * fix: fix database in cluster
    
    Signed-off-by: mlycore <[email protected]>
    
    ---------
    
    Signed-off-by: mlycore <[email protected]>
---
 pitr/cli/internal/cmd/restore.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pitr/cli/internal/cmd/restore.go b/pitr/cli/internal/cmd/restore.go
index ad684b7..67f4d5a 100644
--- a/pitr/cli/internal/cmd/restore.go
+++ b/pitr/cli/internal/cmd/restore.go
@@ -151,8 +151,8 @@ func checkDatabaseExist(proxy pkg.IShardingSphereProxy, bak 
*model.LsBackup) err
                return xerr.NewCliErr(fmt.Sprintf("get cluster metadata failed. 
err: %s", err))
        }
 
-       for k := range bak.SsBackup.ClusterInfo.MetaData.Databases {
-               if _, ok := clusterNow.MetaData.Databases[k]; ok {
+       if clusterNow != nil && clusterNow.MetaData.Databases != nil {
+               for k := range clusterNow.MetaData.Databases {
                        databaseNamesExist = append(databaseNamesExist, k)
                }
        }

Reply via email to