Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
defbin committed Jan 25, 2024
1 parent 703c0d0 commit dad8a16
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 0 additions & 2 deletions cmd/pbm-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ func (a *Agent) Resync(ctx context.Context, opid ctrl.OPID, ep config.Epoch) {
l.Debug("epoch set to %v", epch)
}

type lockAquireFn func(context.Context) (bool, error)

// acquireLock tries to acquire the lock. If there is a stale lock
// it tries to mark op that held the lock (backup, [pitr]restore) as failed.
func (a *Agent) acquireLock(ctx context.Context, l *lock.Lock, lg log.LogEvent) (bool, error) {
Expand Down
2 changes: 1 addition & 1 deletion internal/backup/logical.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (b *Backup) doLogical(
return storage.Upload(ctx, w, stg, bcp.Compression, bcp.CompressionLevel, filename, -1)
})
// ensure slicer is stopped in any case (done, error or canceled)
defer stopOplogSlicer()
defer stopOplogSlicer() //nolint:errcheck

if !util.IsSelective(bcp.Namespaces) {
// Save users and roles to the tmp collections so the restore would copy that data
Expand Down
7 changes: 4 additions & 3 deletions internal/restore/logical.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,10 @@ func (r *Restore) snapshotObjects(bcp *backup.BackupMeta) (string, []oplog.Oplog
var ok bool
var rsMeta *backup.BackupReplset
revRSName := util.MakeReverseRSMapFunc(r.rsMap)(r.nodeInfo.SetName)
for _, v := range bcp.Replsets {
if v.Name == revRSName {
rsMeta = &v
for i := range bcp.Replsets {
r := &bcp.Replsets[i]
if r.Name == revRSName {
rsMeta = r
ok = true
break
}
Expand Down
7 changes: 3 additions & 4 deletions internal/slicer/slicer.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ func (s *Slicer) Stream(
Type: ctrl.CmdPITR,
}

bcp := ctrl.NilOPID
for {
sliceTo := primitive.Timestamp{}
// waiting for a trigger
Expand All @@ -353,13 +352,13 @@ func (s *Slicer) Stream(
s.l.Info("got done signal, stopping")
lastSlice = true
// on wakeup or tick whatever comes first do the job
case bcp = <-backupSig:
case bcp := <-backupSig:
s.l.Info("got wake_up signal")
if bcp != ctrl.NilOPID {
opid := bcp.String()
s.l.Info("wake_up for bcp %s", opid)

sliceTo, err = s.backupStartTS(ctx, opid, s.rs, timeouts.StartingStatus())
sliceTo, err = s.backupStartTS(ctx, opid, timeouts.StartingStatus())
if err != nil {
return errors.Wrap(err, "get backup start TS")
}
Expand Down Expand Up @@ -531,7 +530,7 @@ func (s *Slicer) getOpLock(ctx context.Context, l *lock.LockHeader, t time.Durat
return lck, nil
}

func (s *Slicer) backupStartTS(ctx context.Context, opid, rs string, t time.Duration) (primitive.Timestamp, error) {
func (s *Slicer) backupStartTS(ctx context.Context, opid string, t time.Duration) (primitive.Timestamp, error) {
var ts primitive.Timestamp
tk := time.NewTicker(time.Second)
defer tk.Stop()
Expand Down

0 comments on commit dad8a16

Please sign in to comment.