BReg: retry a refused first database connection in one-shot operations

Ouverte Adaptée aux débutants
#2,765 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
65/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
postgresql, rust
Domaine
databases

Piste de recherche

Commence à connect_dedicated dans crates/registry-breg/src/postgres/interlock.rs et lis comment les commandes one-shot (status, doctor, plan, apply, instance-claim) l'appellent, ainsi que la façon dont l'erreur de connexion sqlx expose une connexion refusée/injoignable. Choisis une fenêtre bornée (l'issue suggère 10 s) et ne réessaie que les erreurs levées avant qu'aucune instruction ne soit envoyée. Un test montrant qu'une première connexion refusée est réessayée alors qu'un échec en cours d'instruction ne l'est pas, voilà à quoi ressemble 'done' ; note que l'issue laisse ouverte l'Option 2 basée sur des charts, donc confirme l'approche avant d'écrire du code.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area:breg enhancement

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:

  1. 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.
  2. 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.

Langage dominant
Rust
Étoiles
2
Forks
0
Merge moyen
9 h 48 min
PR mergées (30 j)
151

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de registrystack/registry-stack

Toutes les issues de registrystack/registry-stack

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.