You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/12/28 10:44:10 UTC

(shardingsphere-on-cloud) branch main updated: feat: remove all databases in proxy before restore (#485)

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 <ma...@126.com>
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 <ma...@126.com>
    
    * fix: fix no metadata database found
    
    Signed-off-by: mlycore <ma...@126.com>
    
    * fix: fix database in cluster
    
    Signed-off-by: mlycore <ma...@126.com>
    
    ---------
    
    Signed-off-by: mlycore <ma...@126.com>
---
 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)
 		}
 	}