Skip to content

PBM-843 Improve error handling for inMemory storage engine#1269

Open
Anuja888 wants to merge 1 commit intopercona:devfrom
Anuja888:dev
Open

PBM-843 Improve error handling for inMemory storage engine#1269
Anuja888 wants to merge 1 commit intopercona:devfrom
Anuja888:dev

Conversation

@Anuja888
Copy link

@Anuja888 Anuja888 commented Feb 17, 2026

This PR addresses PBM-843 by improving error handling when attempting
physical backups on MongoDB instances running with the inMemory storage engine.

If the $backupCursor stage is not supported, PBM now returns a
clear and user-friendly message:

"physical backup is not supported for the inMemory storage engine"

All existing tests pass locally using Docker and go test.

Add error handling for unsupported inMemory backupCursor
@it-percona-cla
Copy link

it-percona-cla commented Feb 17, 2026

CLA assistant check
All committers have signed the CLA.

@radoslawszulgo radoslawszulgo changed the title Improve error handling for inMemory storage engine PBM-843 Improve error handling for inMemory storage engine Feb 17, 2026
Copy link
Collaborator

@jcechace jcechace left a comment

Choose a reason for hiding this comment

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

Thank you for you contribution! I left some comments for you to look into.

}
if err != nil {
// Detect inMemory engine unsupported backupCursor
if strings.Contains(err.Error(), "$backupCursor") {
Copy link
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.

Comment on lines +97 to +107
if err != nil {
// Detect inMemory engine unsupported backupCursor
if strings.Contains(err.Error(), "$backupCursor") {
return nil, errors.New("physical backup is not supported for the inMemory storage engine")
}

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

Copy link
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants