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

Aberta Para iniciantes
#2,765 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
65/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
postgresql, rust
Domínio
databases

Direção de pesquisa

Comece em connect_dedicated em crates/registry-breg/src/postgres/interlock.rs e leia como os comandos one-shot (status, doctor, plan, apply, instance-claim) o chamam, além de como o erro de conexão do sqlx expõe uma conexão recusada/inacessível. Escolha uma janela limitada (a issue sugere 10 s) e só repita erros levantados antes de qualquer instrução ser enviada. Um teste que mostre que uma primeira conexão recusada é repetida enquanto uma falha no meio de uma instrução não é é o que 'done' significa; observe que a issue deixa em aberto a Opção 2 baseada em chart, então confirme a abordagem antes de escrever código.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Rust
Estrelas
2
Forks
0
Merge médio
9h 48min
PRs com merge (30d)
151

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de registrystack/registry-stack

Todas as issues de registrystack/registry-stack

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.