Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(data): index foreign-key back-references and per-manifest failed …#97

Merged
Theauxm merged 1 commit into
mainfrom
fix/scheduler-resilience-hardening
Jul 7, 2026
Merged

fix(data): index foreign-key back-references and per-manifest failed …#97
Theauxm merged 1 commit into
mainfrom
fix/scheduler-resilience-hardening

Conversation

@Theauxm

@Theauxm Theauxm commented Jul 7, 2026

Copy link
Copy Markdown
Member

…state

PostgreSQL doesn't auto-index the referencing side of a foreign key, so deleting a metadata row forced the scheduler's cleanup DELETE to scan work_queue, dead_letter and metadata to satisfy the ON DELETE RESTRICT checks, which degraded to O(table) on a large database. Add partial indexes on metadata.parent_id, work_queue.metadata_id and dead_letter.retry_metadata_id.

Also add a partial (manifest_id, start_time) index on failed metadata so the dispatch loop's per-manifest FailedCount stays bounded to failed rows instead of scanning the manifest's whole terminal history. Postgres migration 036, SQLite 004.

…state

PostgreSQL doesn't auto-index the referencing side of a foreign key, so deleting a
metadata row forced the scheduler's cleanup DELETE to scan work_queue, dead_letter
and metadata to satisfy the ON DELETE RESTRICT checks, which degraded to O(table)
on a large database. Add partial indexes on metadata.parent_id,
work_queue.metadata_id and dead_letter.retry_metadata_id.

Also add a partial (manifest_id, start_time) index on failed metadata so the
dispatch loop's per-manifest FailedCount stays bounded to failed rows instead of
scanning the manifest's whole terminal history. Postgres migration 036, SQLite 004.
@Theauxm Theauxm merged commit 54d5c1b into main Jul 7, 2026
2 checks passed
@Theauxm Theauxm deleted the fix/scheduler-resilience-hardening branch July 7, 2026 15:02
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

This PR is included in version 1.41.2

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