Skip to content

refactor: redundancy getter exhaust#5470

Open
nugaon wants to merge 1 commit into
masterfrom
refactor/replicas-getter-return
Open

refactor: redundancy getter exhaust#5470
nugaon wants to merge 1 commit into
masterfrom
refactor/replicas-getter-return

Conversation

@nugaon
Copy link
Copy Markdown
Member

@nugaon nugaon commented May 20, 2026

Small cleanup of pkg/replicas/getter.go prompted by a beekeeper CI failure where the return nil, nil at the bottom of Get was somehow reached, causing a nil-panic downstream in joiner.New.

Changes:

  • NONE short-circuit: NewGetter with redundancy.NONE now returns g.Getter.Get directly. The replica machinery (goroutines, ticker, replicator) is pointless for level 0, and emitting ErrSwarmageddon when the chunk is simply not found at level 0 was semantically wrong.
  • return nil, nilerrGetterExhausted: the trailing return is structurally unreachable (the replicator exhausts exactly at the last loop iteration, turning it into an indefinite wait on resultC/errc; the loop always exits via success or Swarmageddon). Renamed to a named sentinel with a matching comment so the intent is clear if it ever surfaces again.
  • Comment above loop: explains the batch-doubling design (2, 2, 4, 8, 16 for PARANOID) and why the loop cannot fall through to the bottom.
  • Test: level=0 all-fail case no longer asserts ErrSwarmageddon; the raw error is returned via the short-circuit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants