Skip to content

fix: lock the catalog when creating resources in it - #250

Merged
bfabio merged 1 commit into
fix/keep-root-catalog-sentinel-out-of-patchfrom
fix/refuse-creates-in-deleted-catalog
Nov 20, 2026
Merged

bfabio merged 1 commit into
fix/keep-root-catalog-sentinel-out-of-patchfrom
fix/refuse-creates-in-deleted-catalog

Conversation

@bfabio

@bfabio bfabio commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

The create endpoints under /catalogs/{id} looked the catalog up before
their transaction and catalog_id has no foreign key, so a concurrent
DELETE could count no resources, delete the catalog and let the insert
follow, leaving software, publishers or logs tied to a catalog that no
longer exists. Both sides now lock the catalog row first, so one of
them waits for the other and sees its outcome.

The create endpoints under /catalogs/{id} looked the catalog up before
their transaction and catalog_id has no foreign key, so a concurrent
DELETE could count no resources, delete the catalog and let the insert
follow, leaving software, publishers or logs tied to a catalog that no
longer exists. Both sides now lock the catalog row first, so one of
them waits for the other and sees its outcome.
@bfabio
bfabio added this pull request to stack #272 November 20, 2026 10:49
@bfabio
bfabio merged commit e7d66ad into main Nov 20, 2026
9 checks passed
@bfabio
bfabio deleted the fix/refuse-creates-in-deleted-catalog branch November 20, 2026 11:29
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.

1 participant