Skip to content

feat: add progress indicator to repository check loop#9476

Open
sagar-h007 wants to merge 6 commits into
borgbackup:masterfrom
sagar-h007:feat/check-progress-indicator
Open

feat: add progress indicator to repository check loop#9476
sagar-h007 wants to merge 6 commits into
borgbackup:masterfrom
sagar-h007:feat/check-progress-indicator

Conversation

@sagar-h007
Copy link
Copy Markdown

Description

This PR adds a simple progress indicator to the Repository.check() loop.

Running borg check on large repositories can take a long time while objects are verified, but currently there is no visible progress apart from periodic key checkpoint logs. This can make it difficult to tell whether the process is still working or has stalled.

This change adds a lightweight progress indicator that reports ongoing activity as objects are processed.

Following the maintainer’s suggestion, this does not compute totals using store.list(), since that could be slow for large or remote repositories. Instead, it only shows ongoing progress without percentage or ETA.

Fixes #9443

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

Repository.check() can run for a long time on large repositories
without any visible progress. Add a simple progress indicator to
show ongoing activity while objects are being verified.

Avoid computing totals with store.list(), since that could be slow
for large or remote repositories.

fix: borgbackup#9443
Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, some feedback.

Comment thread src/borg/helpers/progress.py Outdated
Comment thread src/borg/repository.py Outdated
Comment thread src/borg/repository.py Outdated
Comment thread src/borg/repository.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

- rename ProgressIndicatorCounter and JSON_TYPE
- update message to "Checked objects: %d"
- ensure pi.finish() before early break
- enable progress output only with --progress
@ThomasWaldmann
Copy link
Copy Markdown
Member

@sagar-h007 did you see my feedback?

Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

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

A hint how to deal with api versioning.

Comment thread src/borg/remote.py Outdated
Comment thread src/borg/repository.py Outdated
Copy link
Copy Markdown
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

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

some stuff i found

Comment thread src/borg/helpers/progress.py Outdated
Comment thread src/borg/helpers/progress.py Outdated
Comment thread src/borg/repository.py Outdated
Comment thread src/borg/helpers/progress.py Outdated
Comment thread src/borg/repository.py
Guard pi init, show(), and finish() behind progress flag.
Comment on lines +66 to 71
if current is not None:
self.counter = current
if hasattr(self, 'counter'):
self.counter += increase
current = self.counter
if current is not None and current >= self.trigger_at:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

initialize self.counter = 0 in init method, so you don't need that hasattr.

also, move the code that is not related to producing output to a progress method as you see in the percent pi.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@sagar-h007 seen this? ^

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.

Add progress indicator to repository check loop

2 participants