Skip to content

chore: stop tn_vacuum re-running every block on idle nodes#1376

Merged
MicBun merged 1 commit into
mainfrom
stopTnVacuum
May 13, 2026
Merged

chore: stop tn_vacuum re-running every block on idle nodes#1376
MicBun merged 1 commit into
mainfrom
stopTnVacuum

Conversation

@MicBun
Copy link
Copy Markdown
Contributor

@MicBun MicBun commented May 13, 2026

resolves: https://github.com/truflation/website/issues/3872

Summary by CodeRabbit

  • Refactor

    • refactored table repacking operations to recognize when no tables require processing, now returning success instead of reporting an error.
  • Tests

    • Added test coverage for table repacking count validation across various scenarios.

Review Change Stack

@MicBun MicBun requested a review from pr-time-tracker May 13, 2026 10:15
@MicBun MicBun self-assigned this May 13, 2026
@holdex
Copy link
Copy Markdown

holdex Bot commented May 13, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 2h Update time May 13, 2026, 10:52 AM

You can submit time with the command. Example:

@holdex pr submit-time 15m

See available commands to help comply with our Guidelines.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@MicBun has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 21 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f27f7bfa-6001-4b9c-9006-5a3622de4ed3

📥 Commits

Reviewing files that changed from the base of the PR and between f0149fc and 69fe93d.

📒 Files selected for processing (2)
  • extensions/tn_vacuum/mechanism_repack.go
  • extensions/tn_vacuum/mechanism_repack_test.go
📝 Walkthrough

Walkthrough

The PR modifies pg_repackMechanism.Run to treat zero repacked tables as a successful no-op rather than an error. A new countRepackedTables helper counts table occurrences in log output, replacing hard-coded assumptions about table counts. Test coverage validates the counter across multiple scenarios.

Changes

pg_repack zero-tables handling

Layer / File(s) Summary
Zero-tables handling and counter helper
extensions/tn_vacuum/mechanism_repack.go
Run now uses countRepackedTables to populate report.TablesProcessed from combined stdout/stderr. When zero tables are repacked, the run succeeds with a no-op log instead of returning an error. The new internal helper countRepackedTables counts log markers and explicitly treats zero as valid.
Counter helper tests
extensions/tn_vacuum/mechanism_repack_test.go
TestCountRepackedTables validates the counter helper across scenarios: no eligible tables, single table, multiple tables, and empty output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • outerlook

Poem

🐰 A repack that finds no tables to mend,
Now greets the day with a graceful "no-op" end—
Count those logs, skip the fuss,
Zero's valid, success, not a bust! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions stopping tn_vacuum on idle nodes, but the changes only fix how pg_repack reports zero tables and adds a test for the counting logic. Update the title to reflect the actual change, such as 'refactor: treat zero repacked tables as success in pg_repack' or similar.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stopTnVacuum

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MicBun
Copy link
Copy Markdown
Contributor Author

MicBun commented May 13, 2026

@holdex pr submit-time 2h

@MicBun MicBun merged commit a45193b into main May 13, 2026
7 of 8 checks passed
@MicBun MicBun deleted the stopTnVacuum branch May 13, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant