Skip to content

PBM-1534 progress indicators#1348

Open
igroene wants to merge 9 commits into
devfrom
progress
Open

PBM-1534 progress indicators#1348
igroene wants to merge 9 commits into
devfrom
progress

Conversation

@igroene

@igroene igroene commented Jul 20, 2026

Copy link
Copy Markdown
Member

Introduces enhanced tracking and reporting of backup and restore operation durations and progress throughout the Percona Backup for MongoDB CLI and core logic. It adds duration and progress fields to backup and restore metadata, displays this information in CLI outputs, and implements more granular progress reporting for logical backups. The changes aim to provide better visibility into operation status for users and improve logging for troubleshooting.

User-visible improvements:

  • Backup and restore descriptions (cmd/pbm/backup.go, cmd/pbm/restore.go) now include operation duration (in seconds and human-readable format) and, for terminal states, a finish timestamp. [1] [2] [3] [4]
  • The pbm status command output now shows operation durations and progress for running backup and restore operations, and includes a duration column in the snapshot listing. [1] [2] [3] [4] [5] [6] [7]

Progress reporting enhancements:

  • Logical backup now tracks and reports progress (bytes and items processed) at a more granular level, using the new progress.Reporter and passing progress updates to the coordinator. [1] [2] [3] [4] [5]
  • Physical backup and restore code is prepared for similar progress reporting, with progress aggregation helpers added. [1] [2] [3]

Codebase and logging improvements:

  • Backup operation logs now include the total elapsed time on completion or failure, improving troubleshooting.
  • Helper functions for computing operation durations and terminal status are introduced and reused across commands. [1] [2]

Metadata and API changes:

  • Backup and restore metadata structs are extended with duration and progress fields, which are populated and serialized for CLI/API consumers. [1] [2] [3] [4]

Dependency updates:

  • The progress package is now imported and used in all relevant commands and backup/restore implementations. [1] [2] [3] [4] [5] [6]

Comment thread cmd/pbm/status.go
Comment on lines +395 to 396
s := fmt.Sprintf("%s \"%s\", started at %s. Status: %s. Duration: %s. [op id: %s]",
c.Type, c.Name, time.Unix((c.StartTS), 0).UTC().Format("2006-01-02T15:04:05Z"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
s := fmt.Sprintf("%s \"%s\", started at %s. Status: %s. Duration: %s. [op id: %s]",
c.Type, c.Name, time.Unix((c.StartTS), 0).UTC().Format("2006-01-02T15:04:05Z"),
s := fmt.Sprintf(
"%s \"%s\", started at %s. Status: %s. Duration: %s. [op id: %s]",
c.Type, c.Name, time.Unix(c.StartTS, 0).UTC().Format("2006-01-02T15:04:05Z"),

Comment thread pbm/backup/query.go
}

func SetBackupProgress(ctx context.Context, conn connect.Client, bcpName string, p progress.Progress) error {
_, err := conn.BcpCollection().UpdateOne(ctx,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
_, err := conn.BcpCollection().UpdateOne(ctx,
_, err := conn.BcpCollection().UpdateOne(
ctx,

Comment thread pbm/backup/query.go
}

func SetRSProgress(ctx context.Context, conn connect.Client, bcpName, rsName string, p progress.Progress) error {
_, err := conn.BcpCollection().UpdateOne(ctx,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
_, err := conn.BcpCollection().UpdateOne(ctx,
_, err := conn.BcpCollection().UpdateOne(
ctx,

Comment thread pbm/restore/logical.go
if done && ns != archive.MetaFile {
reporter.AddItems(1)
}
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
})
},
)

Comment thread pbm/restore/query.go
}

func SetRestoreProgress(ctx context.Context, m connect.Client, name string, p progress.Progress) error {
_, err := m.RestoresCollection().UpdateOne(ctx,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
_, err := m.RestoresCollection().UpdateOne(ctx,
_, err := m.RestoresCollection().UpdateOne(
ctx,

Comment thread pbm/restore/query.go
}

func SetRestoreRSProgress(ctx context.Context, m connect.Client, name, rsName string, p progress.Progress) error {
_, err := m.RestoresCollection().UpdateOne(ctx,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
_, err := m.RestoresCollection().UpdateOne(ctx,
_, err := m.RestoresCollection().UpdateOne(
ctx,

Comment thread pbm/snapshot/dump.go
Comment on lines 13 to +14
type UploadFunc func(ns, ext string, r io.Reader) error
type ProgressFunc func(ns string, bytes int64, done bool)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[gofmt] reported by reviewdog 🐶

Suggested change
type UploadFunc func(ns, ext string, r io.Reader) error
type ProgressFunc func(ns string, bytes int64, done bool)
type (
UploadFunc func(ns, ext string, r io.Reader) error
ProgressFunc func(ns string, bytes int64, done bool)
)

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.

1 participant