From 52885259f011eb79f513c59697fe0b3b33441400 Mon Sep 17 00:00:00 2001 From: Hossain Mahmud Date: Mon, 19 Jun 2023 12:12:04 +0600 Subject: [PATCH] Set total hosts to 1 during initialization (#1865) /cherry-pick Signed-off-by: hmsayem --- pkg/backup.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/backup.go b/pkg/backup.go index 633a0fe8a..dc1d2b1ca 100644 --- a/pkg/backup.go +++ b/pkg/backup.go @@ -79,6 +79,7 @@ func NewCmdBackup() *cobra.Command { masterURL string kubeconfigPath string opt = mongoOptions{ + totalHosts: 1, waitTimeout: 300, setupOptions: restic.SetupOptions{ ScratchDir: restic.DefaultScratchDir, @@ -289,8 +290,6 @@ func (opt *mongoOptions) backupMongoDB(targetRef api_v1beta1.TargetRef) (*restic // 3. For sharded MongoDB, totalHosts=(number of shard + 1) // extra 1 for config server // So, for stand-alone MongoDB and MongoDB ReplicaSet, we don't have to do anything. // We only need to update totalHosts field for sharded MongoDB - - opt.totalHosts = 1 // For sharded MongoDB, parameter.ConfigServer will not be empty if parameters.ConfigServer != "" { opt.totalHosts = len(parameters.ReplicaSets) + 1 // for each shard there will be one key in parameters.ReplicaSet