spock: revalidate dboid before registering a manager worker#480
Conversation
Between the pg_database seq-scan and spock_worker_register() another backend can DROP DATABASE or set datconnlimit = -2, leaving the manager worker to FATAL during attach and sustaining a respawn loop under heavy tenant-DB churn.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/tap/t/103_manager_worker_dboid_race.pl`:
- Line 104: The wait loop using waitpid($_, 0) for `@kids`; only waits but doesn't
assert child exit codes; change it to reap each child (using waitpid on each pid
from `@kids`) and assert that each exited cleanly by checking the Perl $? (or
WIFEXITED/WEXITSTATUS semantics), failing the test if any child returned a
non-zero/abnormal status so churn failures can't silently pass; update the block
that uses waitpid, `@kids` and $? to perform these checks and emit a failing
test/diagnostic when a child exit code is non-zero.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 04155753-9530-44de-8be3-c987b8a61b0b
📒 Files selected for processing (3)
src/spock.ctests/tap/scheduletests/tap/t/103_manager_worker_dboid_race.pl
Reproduces the race that produced the FATAL respawn loop on tenant-DB churn: six parallel CREATE/DROP DATABASE loops plus a fast-shutdown mid-window of the postmaster. Asserts the new log content has zero "FATAL: cannot connect to invalid database", zero "FATAL: database <oid> does not exist", and zero "manager worker ... exiting with error". Wired into the regular schedule so make check_prove picks it up.
179fd6f to
221f101
Compare
Between the pg_database seq-scan and spock_worker_register() another backend can DROP DATABASE or set datconnlimit = -2, leaving the manager worker to FATAL during attach and sustaining a respawn loop under heavy tenant-DB churn.
SPOC-567