Skip to content

BReg: import run admission reserves no volume, so two runs can overrun one authority #1634

Description

@jeremi

import_authority::admit_run checks item_count <= maxItems - committed_items
and debits nothing. Two runs under one open authority, or the same file
submitted twice, both pass admission; the second stops partway when the
counter fills. Import is create-only, so the second run duplicates records up
to the remaining volume. crates/registry-breg/tests/postgres_import_authority.rs
a_second_run_cannot_spend_volume_the_first_already_committed shows the
partial commit. The volume bound itself holds, and the security review notes
in products/breg/SECURITY-REVIEW-NOTES.md record this as an accepted
residual (introduced in #1632).

Options: (a) a reserved_items column debited under the row lock at
admission and released on complete, cancel, or block; (b) at most one
non-terminal run per authority (partial unique index on the run's authority
id). Either way, add a concurrent-admission test, and align
docs/site/src/content/docs/operate/breg-data.mdx, which says a run is
created only when the authority has room for the whole file.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:bregBReg ownership.bugSomething isn't workingcriticality:p2Priority/criticality P2.triage:needs-designNeeds a bounded scope, product decision, or acceptance design before implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions