BReg: retry a refused first database connection in one-shot operations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
Start at connect_dedicated in crates/registry-breg/src/postgres/interlock.rs and read how the one-shot commands (status, doctor, plan, apply, instance-claim) call it, plus how the sqlx connect error exposes a refused/unreachable connection. Pick a bounded window (the issue suggests 10 s) and only retry errors raised before any statement is sent. A test that a refused first connect is retried while a mid-statement failure is not is what "done" looks like; note the issue leaves the chart-based Option 2 open, so confirm the approach before writing code.
Written by the indexing model from the issue text.
Description
Operation Jobs in the Helm chart run one attempt (backoffLimit: 0), so the operator's reconcile-first refusal decides what happens next rather than a Kubernetes retry. With one attempt, a failed first database connection fails the whole operation, and the operator has to rerun it.
On a single-server K3s install, a newly started Pod labelled registrystack.org/database-client: "true" got Connection refused from PostgreSQL for about 600 ms before its first successful TCP connection. The K3s network policy controller admits a new Pod's address shortly after the container starts. No BReg Job failed in that run, probably because the stage-operation-inputs init container delays the bregctl container. That margin is a matter of timing, not something the design guarantees.
status and the maintenance interlock connect through connect_dedicated in crates/registry-breg/src/postgres/interlock.rs, which makes one attempt and has no retry.
Options:
- Give the one-shot maintenance commands (
status,doctor,plan,apply,instance-claim) a short bounded retry, for example up to 10 s, that covers only connection refused or unreachable before any statement is sent. Nothing has changed in the database at that point, so the retry cannot repeat work. - Add a wait for the database port to the operation Job's init container. This stays in the chart and covers only Kubernetes installs.
Option 1 also helps any other orchestrator that starts a fresh process next to a fresh network policy.
- Dominant language
- Rust
- Stars
- 2
- Forks
- 0
- Avg merge
- 9h 48m
- Merged PRs (30d)
- 151
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from registrystack/registry-stack
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
registrystack/registry-stack#2761 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
registrystack/registry-stack#2743 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
registrystack/registry-stack#2706 ·
Maintainers usually reply within 1 day
-
macOS contributor gates: Messaging config tests fail under the symlinked macOS temporary directoryOpen
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
registrystack/registry-stack#2704 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
registrystack/registry-stack#2698 ·
Maintainers usually reply within 1 day
All issues in registrystack/registry-stack
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
AstrBotDevs/AstrBot-desktop#197 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
stackabletech/airflow-operator#898 ·
Maintainers usually reply within 1 day
-
2 advisory ignore entries no longer match anything (`bytes`, `time` already patched in `Cargo.lock`)Possibly taken @zyl71 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100