Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgmq migration safety #1380

Merged
merged 2 commits into from
Dec 16, 2024
Merged

pgmq migration safety #1380

merged 2 commits into from
Dec 16, 2024

Conversation

olirice
Copy link
Contributor

@olirice olirice commented Dec 16, 2024

  • Updates the pgmq migration to ensure idempotency with on-conflict clause
  • Validates that the pgmq.meta table is a regular table with expected columns so if the extension changes in the future it doesn't introduce a problem for us

@olirice olirice requested a review from a team as a code owner December 16, 2024 17:49
@olirice olirice requested a review from pcnc December 16, 2024 17:49
n.nspname = 'pgmq'
and c.relname like 'q_%'
and c.relkind in ('r', 'p', 'u')
on conflict (queue_name) do nothing;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idempotence

Comment on lines +17 to +23
and (
select array_agg(attname::text order by attname)
from pg_catalog.pg_attribute a
where
a.attnum > 0
and a.attrelid = c.oid
) = array['created_at', 'is_partitioned', 'is_unlogged', 'queue_name']::text[]
Copy link
Contributor Author

@olirice olirice Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate column names match the expected list

where
n.nspname = 'pgmq'
and c.relname = 'meta'
and c.relkind = 'r' -- regular table
Copy link
Contributor Author

@olirice olirice Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm its a regular table

@olirice olirice changed the title Or/pgmq migration safety pgmq migration safety Dec 16, 2024
@olirice olirice merged commit 2a778f7 into develop Dec 16, 2024
11 of 13 checks passed
@olirice olirice deleted the or/pgmq-migration-safety branch December 16, 2024 18:40
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.

2 participants