Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
skipi
left a comment
There was a problem hiding this comment.
DDL ownership is right (github_hooks is the real migration, zebra the mirror) and the index matches zebra's unmark query. Nits on down, sizing and whether this already exists in prod.
On the PR description: Empty body. A line saying github_hooks is the real migration and zebra is the test mirror, and that prod already has these (so it no-ops there), would save the next reviewer the digging.
| name: "index_jobs_on_organization_id_and_created_at_expiring", | ||
| algorithm: :concurrently, | ||
| where: "expires_at IS NOT NULL", | ||
| if_not_exists: true |
There was a problem hiding this comment.
nit: Is index_jobs_on_organization_id_and_created_at_expiring already in prod under exactly this name? If it isn't, this builds concurrently on jobs while the hooks/sidekiq/repo-proxy pods are booting, and the other two deployments fail to get the migration lock until it finishes. I'd build it by hand first and check indisvalid: if_not_exists will also accept an INVALID leftover from an interrupted build.
| if PREVIOUS_SCALE_FACTOR.include?(table) | ||
| execute "ALTER TABLE #{table} SET (autovacuum_vacuum_scale_factor = 0.02)" |
There was a problem hiding this comment.
nit: No migration ever set scale_factor = 0.02 on jobs / job_stop_requests, so on a DB built from migrations down leaves a setting that wasn't there before up. RESET alone is the inverse. Same in zebra/priv/legacy_repo/migrations/20261020120000_tune_autovacuum_on_jobs_tables.exs.
| THRESHOLDS = { | ||
| jobs: 500_000, | ||
| job_stop_requests: 50_000, | ||
| workflows: 300_000, | ||
| builds: 200_000 | ||
| }.freeze |
There was a problem hiding this comment.
nit: 500k / 300k / 200k dead tuples are prod-sized, and every install runs this. On a small install scale_factor = 0 means jobs effectively stops vacuuming on dead tuples and only vacuums on inserts. If prod already has these values, does it need to be a migration, or could the scale factor stay small but above zero?
8e45440 to
c6386a3
Compare
c6386a3 to
cb57ff0
Compare
|
Dropped the autovacuum part, same as in #1350: fixed thresholds sized for large tables don't fit small installs, and large installations can tune these per table themselves. This PR now only adds the partial index on |
b1e577f to
14294fe
Compare
Build the index concurrently and only if it is missing so the migration is safe on databases that already have it. [db] Database changes (migrations, indexes, schema)
Add the partial index on jobs (organization_id, created_at) for rows with expires_at set, the same index added to the zebra test migrations. It is built concurrently and only if missing. [db] Database changes (migrations, indexes, schema)
14294fe to
6d8ff4e
Compare
No description provided.