Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions pbm/backup/physical.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,17 @@ func (bc *BackupCursor) create(ctx context.Context, retry int) (*mongo.Cursor, e
cur, err := bc.conn.Database("admin").Aggregate(ctx, mongo.Pipeline{
{{"$backupCursor", opts}},
})
if err != nil {
se, ok := err.(mongo.ServerError) //nolint:errorlint
if !ok {
return nil, err
}
if err != nil {
// Detect inMemory engine unsupported backupCursor
if strings.Contains(err.Error(), "$backupCursor") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is extremely brittle and potentially dangerous -- it's quite generic so it could swallow the later checks.

return nil, errors.New("physical backup is not supported for the inMemory storage engine")
}

se, ok := err.(mongo.ServerError)
if !ok {
return nil, err
}

Comment on lines +97 to +107
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like formatting was broken by mistake.

Easy fix by running go fmt ./... from project root


retryableErr := false
if se.HasErrorCode(openConflictWithCheckpointErrCode) {
Expand Down
Loading