Skip to content

Commit 8d34c16

Browse files
committed
Inject fallback options into phys restore
1 parent eb15872 commit 8d34c16

File tree

4 files changed

+37
-19
lines changed

4 files changed

+37
-19
lines changed

cmd/pbm-agent/restore.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,15 @@ func (a *Agent) Restore(ctx context.Context, r *ctrl.RestoreCmd, opid ctrl.OPID,
181181
}
182182

183183
var rstr *restore.PhysRestore
184-
rstr, err = restore.NewPhysical(ctx, a.leadConn, a.nodeConn, nodeInfo, r.RSMap)
184+
rstr, err = restore.NewPhysical(
185+
ctx,
186+
a.leadConn,
187+
a.nodeConn,
188+
nodeInfo,
189+
r.RSMap,
190+
r.Fallback,
191+
r.AllowPartlyDone,
192+
)
185193
if err != nil {
186194
l.Error("init physical backup: %v", err)
187195
return

cmd/pbm/restore.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ func doRestore(
417417
UsersAndRoles: o.usersAndRoles,
418418
RSMap: rsMapping,
419419
External: o.extern,
420+
Fallback: o.fallback,
421+
AllowPartlyDone: o.allowPartlyDone,
420422
},
421423
}
422424
if o.pitr != "" {

pbm/ctrl/cmd.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,15 @@ func (b BackupCmd) String() string {
150150
}
151151

152152
type RestoreCmd struct {
153-
Name string `bson:"name"`
154-
BackupName string `bson:"backupName"`
155-
Namespaces []string `bson:"nss,omitempty"`
156-
NamespaceFrom string `bson:"nsFrom,omitempty"`
157-
NamespaceTo string `bson:"nsTo,omitempty"`
158-
UsersAndRoles bool `bson:"usersAndRoles,omitempty"`
159-
RSMap map[string]string `bson:"rsMap,omitempty"`
153+
Name string `bson:"name"`
154+
BackupName string `bson:"backupName"`
155+
Namespaces []string `bson:"nss,omitempty"`
156+
NamespaceFrom string `bson:"nsFrom,omitempty"`
157+
NamespaceTo string `bson:"nsTo,omitempty"`
158+
UsersAndRoles bool `bson:"usersAndRoles,omitempty"`
159+
RSMap map[string]string `bson:"rsMap,omitempty"`
160+
Fallback bool `bson:"fallbackEnabled"`
161+
AllowPartlyDone bool `bson:"allowPartlyDone"`
160162

161163
NumParallelColls *int32 `bson:"numParallelColls,omitempty"`
162164
NumInsertionWorkers *int32 `bson:"numInsertionWorkers,omitempty"`

pbm/restore/physical.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ type PhysRestore struct {
114114

115115
log log.LogEvent
116116

117-
rsMap map[string]string
117+
rsMap map[string]string
118+
fallback bool
119+
allowPartlyDone bool
118120
}
119121

120122
func NewPhysical(
@@ -123,6 +125,8 @@ func NewPhysical(
123125
node *mongo.Client,
124126
inf *topo.NodeInfo,
125127
rsMap map[string]string,
128+
fallback bool,
129+
allowPartlyDone bool,
126130
) (*PhysRestore, error) {
127131
opts, err := topo.GetMongodOpts(ctx, node, nil)
128132
if err != nil {
@@ -178,16 +182,18 @@ func NewPhysical(
178182
}
179183

180184
return &PhysRestore{
181-
leadConn: leadConn,
182-
node: node,
183-
dbpath: p,
184-
rsConf: rcf,
185-
shards: shards,
186-
cfgConn: csvr,
187-
nodeInfo: inf,
188-
tmpPort: tmpPort,
189-
secOpts: opts.Security,
190-
rsMap: rsMap,
185+
leadConn: leadConn,
186+
node: node,
187+
dbpath: p,
188+
rsConf: rcf,
189+
shards: shards,
190+
cfgConn: csvr,
191+
nodeInfo: inf,
192+
tmpPort: tmpPort,
193+
secOpts: opts.Security,
194+
rsMap: rsMap,
195+
fallback: fallback,
196+
allowPartlyDone: allowPartlyDone,
191197
}, nil
192198
}
193199

0 commit comments

Comments
 (0)