Fence bulk review result-poll backoff to the lease holder

Open Beginner friendly
#1,211 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, rust
Domain
backend, databases

Research direction

Start in crates/registry-breg/src/review_store.rs:793-807, then read the lease-fence invariant at lines 2133-2135 and the nearby per-row backoff update. Done means the bulk backoff cannot move next_result_poll_at for rows outside the worker's lease while still updating rows held by that worker.

Written by the indexing model from the issue text.

Description

area:breg bug rust

A bulk backoff update in BReg's review-result polling is not fenced to the lease holder, contradicting the fence invariant the surrounding code otherwise follows. As of PR #1189, crates/registry-breg/src/review_store.rs:793-807 pushes next_result_poll_at forward by 5 seconds for every due "accepted" row of an authority whose result lookup just failed, matched only on authority=$1 AND state='accepted' AND next_result_poll_at <= transaction_timestamp(), with no lease_until predicate. This contradicts the fence invariant documented a bit further down at review_store.rs:2133-2135 ("The lease fence keeps a worker that lost its claim ... from republishing a backoff over the new holder's schedule"), which the per-row backoff update a few lines later does respect via AND lease_until=$4.

Failure scenario: a worker that lost its lease on one row (expired, reclaimed by another worker) can still push back next_result_poll_at for every other due row under the same authority, including rows a different worker now holds the lease for, delaying that worker's next poll attempt by up to 5 seconds. At the default 5 second poll cadence this is effectively harmless, but it is a real gap in the fencing discipline the rest of the file establishes.

Suggested fix:

  • Add the same lease_until fence to this bulk UPDATE, or scope it explicitly to rows this worker currently leases.

Filed from the review of #1189; not merge-blocking.

Dominant language
Rust
Stars
2
Forks
0
Avg merge
3h 45m
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from registrystack/registry-stack

All issues in registrystack/registry-stack

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.