-
-
Notifications
You must be signed in to change notification settings - Fork 267
fix(pgmq): resolve drop_queue overloading bug #2433
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
Open
brainrake
wants to merge
5
commits into
develop
Choose a base branch
from
pgmq-drop-queue-overload-develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3b0d572
fix(pgmq): resolve drop_queue overloading bug
brainrake abb8b58
test(pgmq): add drop_queue overload regression test
brainrake 6e84f47
test(pgmq): minimize drop_queue overload test
brainrake d7c9f1b
test(pgmq): update expected-output snapshots for drop_queue fix
brainrake 0b5dce5
test(pgmq): fix z_multigres-orioledb-17 snapshot (missed variant)
brainrake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| { self, pkgs }: | ||
| let | ||
| pname = "pgmq"; | ||
| inherit (pkgs) lib; | ||
| system = pkgs.pkgsLinux.stdenv.hostPlatform.system; | ||
| testLib = import ./lib.nix { inherit self pkgs; }; | ||
|
|
||
| installedExtension = self.legacyPackages.${system}."psql_15".exts."${pname}"; | ||
| # boundary versions only - the fix doesn't branch on extversion, so | ||
| # oldest/newest is enough to catch a regression | ||
| versions = lib.unique [ | ||
| (lib.head installedExtension.versions) | ||
| (lib.last installedExtension.versions) | ||
| ]; | ||
| in | ||
| pkgs.testers.runNixOSTest { | ||
| name = "pgmq-drop-queue-overload"; | ||
| nodes.server = | ||
| { ... }: | ||
| { | ||
| imports = [ | ||
| (testLib.makeSupabaseTestConfig { | ||
| majorVersion = "15"; | ||
| }) | ||
| ]; | ||
| }; | ||
| testScript = | ||
| { ... }: | ||
| let | ||
| versionList = lib.concatStringsSep ", " (map (v: ''"${v}"'') versions); | ||
| in | ||
| # python | ||
| '' | ||
| versions = [${versionList}] | ||
|
|
||
| def sql(query): | ||
| return server.succeed( | ||
| "psql -U supabase_admin -d postgres -t -A -c \"" + query.replace('"', '\\"') + "\"" | ||
| ).strip() | ||
|
|
||
| def assert_single_merged_overload(version): | ||
| ok = sql( | ||
| "select count(*) = 1 " | ||
| " and bool_and(d.objid is not null) " | ||
| " and bool_and(pg_get_function_identity_arguments(p.oid) = 'queue_name text, partitioned boolean') " | ||
| "from pg_proc p " | ||
| "join pg_depend d on d.objid = p.oid and d.deptype = 'e' " | ||
| " and d.refobjid = (select oid from pg_extension where extname = 'pgmq') " | ||
| "where p.pronamespace = 'pgmq'::regnamespace and p.proname = 'drop_queue';" | ||
| ) | ||
| assert ok == "t", f"[{version}] expected exactly one merged, extension-owned drop_queue(text, boolean)" | ||
|
|
||
| start_all() | ||
| server.wait_for_unit("supabase-db-init.service") | ||
|
|
||
| for version in versions: | ||
| with subtest(f"install pgmq {version}"): | ||
| server.succeed("psql -U supabase_admin -d postgres -c 'DROP EXTENSION IF EXISTS pgmq;'") | ||
| server.succeed( | ||
| f"psql -U supabase_admin -d postgres -c \"CREATE EXTENSION pgmq WITH VERSION '{version}' CASCADE;\"" | ||
| ) | ||
|
|
||
| assert_single_merged_overload(version) | ||
|
|
||
| qname = f"q_{version.replace('.', '_')}" | ||
| sql(f"select pgmq.create('{qname}_a'); select pgmq.drop_queue('{qname}_a');") | ||
| sql(f"select pgmq.create('{qname}_b'); select pgmq.drop_queue('{qname}_b', false);") | ||
| ''; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.