Shared bbolt-failure classifier in tollwallet — one parser for degraded-mode reasons and wallet-check verdicts (follow-up from #741/#743 reviews)

Aperta
#825 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
18/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
databases

Direzione di ricerca

Start by reading IsStorageMmapUnsupported in tollwallet (mmap_compat.go) and mapWorkerOutcome in src/cmd/tollgate-cli/wallet_check.go, which are the two parsers to merge. Design the shared ClassifyStorageFailure and its class enum in tollwallet/storage_failure.go, keeping worker-process isolation for any bbolt open used by checks. Done when both consumers become thin adapters over the shared classifier and the existing classifier table and seeded-corruption tests pass against it.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

#741's review (follow-up 2) + #743's review (fragility note) converge on the same structural point: two ad-hoc parsers of bbolt failure modes will drift. Today the corruption-vs-unsupported distinction exists in two places:

  • #741: tollwallet.IsStorageMmapUnsupported — errno-chain/errno-text classification for storage unsupported (degraded-mode entry, honest error strings);
  • #743: src/cmd/tollgate-cli/wallet_check.go — open-error vs check-findings vs worker-death verdicts for corruption (the crash-isolated wallet check).

A shared classifier in tollwallet should serve both: one place that turns a bbolt-layer error (or worker outcome) into the named failure classes — storage-unsupported (#583 jffs2/mmap), corrupt-or-unreadable (open/check/panic/SIGBUS shapes), locked (#742's ErrWalletLocked), absent, other — with each consumer mapping classes to its surface (degraded-mode reason strings vs CLI verdicts/exit codes).

Constraints to carry (from the reviews)

  • The corruption classes must keep worker-process isolation wherever bbolt is actually opened for checking (#743's fragility note: running bbolt Open in-process for a check command reintroduces the panic-on-corruption surface the worker exists to contain).
  • errors.Is first, errno-text fallback stays necessary while gonuts wraps with %v (#743's audit note).
  • Consumers: degraded-mode entry + walletUnavailableReason() (#741), wallet check verdict mapping (mapWorkerOutcome) + any future status surface (see the sibling follow-up #824).

Proposed

tollwallet/storage_failure.go (or extend mmap_compat.go): exported ClassifyStorageFailure(err error) StorageFailureClass + the class enum; #741's boolean and #743's verdict mapping become thin adapters over it. Tests: the existing classifier table (#741) + the seeded-corruption matrix (#743) both re-pointed at the shared classification.

References

  • Review asks: #741 review (follow-up 2), #743 review (fragility note)
Lingua principale
Go
Stelle
12
Fork
14
Merge medio
3g 20h
PR unite (30g)
261

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenTollGate/tollgate-module-basic-go

Tutte le issue di OpenTollGate/tollgate-module-basic-go

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.