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

pg_partman run_maintenance() Fails Due to Parallel Operation on Distributed Table #7730

Open
Apexample opened this issue Nov 11, 2024 · 0 comments

Comments

@Apexample
Copy link

I've encountered an issue with pg_partman when running maintenance on a distributed table. The maintenance process fails with the following error message:

SQL Error [P0001]: ERROR: cannot modify table "xxx" because there was a parallel operation on a distributed table in the transaction
CONTEXT: SQL statement "ALTER TABLE public.xxx ATTACH PARTITION public.xxx_p20250101 FOR VALUES FROM ('2025-01-01 02:00:00+02') TO ('2025-02-01 02:00:00+02')"

Steps to Reproduce:

Run the run_maintenance() function on a distributed table that is subject to parallel operations.

Observe the error message mentioned above.

Workaround: I've found that setting citus.multi_shard_modify_mode to 'sequential' before running the maintenance function, and then reverting it to 'parallel' afterwards, resolves the issue. However, this workaround feels a bit hacky and not sure if this is the most elegant solution here.

Additional Information:

  • Citus Version: Citus 12.1.5 on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
  • PostgreSQL Version: PostgreSQL 16.2 (Debian 16.2-1.pgdg110+2) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
  • pg_partman Version: 5.0.1

Could you please advise on a better approach to handle pg_partman maintenance in the presence of parallel operations, or if there are any planned fixes for this issue?

Thank you for your assistance.

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

No branches or pull requests

1 participant