Skip to content

refactor: improve fsck progress reporting for orphaned chunks [backport #1000] - #1002

Merged
kalbasit merged 1 commit into
release-0.9from
backport-1000-to-release-0.9
Mar 1, 2026
Merged

kalbasit merged 1 commit into
release-0.9from
backport-1000-to-release-0.9

Conversation

@kalbasit

@kalbasit kalbasit commented Mar 1, 2026

Copy link
Copy Markdown
Owner

Bot-based backport to release-0.9, triggered by a label in #1000.

Phase 1g (orphaned chunk files in storage) uses a storage walker to find
chunks that are not in the database. Since the total number of chunks in
storage is not known beforehand, we cannot accurately calculate a
percentage for this phase.

This change:

  1. Removes the attempt to pre-calculate chunk count in phase 1g.
  2. Updates logProgress to only show percentage when checked <= total,
    preventing misleading percentages when phase 1g is running.

Follow-up on #996

Phase 1g (orphaned chunk files in storage) uses a storage walker to find
chunks that are not in the database. Since the total number of chunks in
storage is not known beforehand, we cannot accurately calculate a
percentage for this phase.

This change:
1. Removes the attempt to pre-calculate chunk count in phase 1g.
2. Updates logProgress to only show percentage when checked <= total,
   preventing misleading percentages when phase 1g is running.

Follow-up on #996

(cherry picked from commit 4e267c5)
@kalbasit
kalbasit enabled auto-merge (squash) March 1, 2026 06:33
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 1, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the accuracy and reliability of the fsck progress reporting mechanism. Specifically, it addresses an issue where an inaccurate total chunk count for orphaned files could lead to misleading progress percentages. By removing the problematic pre-calculation and adding a safeguard to the percentage display logic, the system now provides more truthful progress updates during file system checks.

Highlights

  • Improved FSck Progress Reporting: Removed the pre-calculation of the total chunk count for phase 1g (orphaned chunk files in storage) as it was not accurately known beforehand, preventing misleading percentage displays.
  • Refined Percentage Calculation Logic: Updated the logProgress function to only display a percentage when the checked count is less than or equal to the total count, ensuring percentages are always accurate and meaningful.
Changelog
  • pkg/ncps/fsck.go
    • Removed the call to db.GetChunkCount(ctx) and the subsequent total.Add(chunkCount) for phase 1g, as the total chunk count for orphaned files is not reliably known in advance.
    • Added a comment explaining why the total chunk count is not pre-calculated for phase 1g.
    • Modified the logProgress function to include a condition checked <= total before calculating and displaying the percentage, preventing percentages from being shown when the checked count exceeds the total.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@dosubot dosubot Bot added enhancement New feature or request go Pull requests that update go code labels Mar 1, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request refactors the progress reporting for the fsck command, specifically for the phase that checks for orphaned chunks in storage. The changes correctly address an issue where misleading progress percentages could be displayed because the total number of chunks in storage is not known beforehand. The removal of the incorrect chunk count pre-calculation and the added guard in the logging function are appropriate fixes. The changes are correct and I have no further suggestions.

@dosubot

dosubot Bot commented Mar 1, 2026

Copy link
Copy Markdown

Related Documentation

Checked 7 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

@codecov

codecov Bot commented Mar 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.04%. Comparing base (e7719e1) to head (24722cb).
⚠️ Report is 2 commits behind head on release-0.9.

Additional details and impacted files
@@             Coverage Diff             @@
##           release-0.9   #1002   +/-   ##
===========================================
  Coverage         5.04%   5.04%           
===========================================
  Files                6       6           
  Lines              436     436           
===========================================
  Hits                22      22           
  Misses             410     410           
  Partials             4       4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kalbasit
kalbasit merged commit 4d15a3e into release-0.9 Mar 1, 2026
13 checks passed
@kalbasit
kalbasit deleted the backport-1000-to-release-0.9 branch March 1, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant