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

Doc update undo partition #216

Closed
wants to merge 2 commits into from
Closed

Doc update undo partition #216

wants to merge 2 commits into from

Conversation

blogh
Copy link

@blogh blogh commented Apr 19, 2018

Hi,

I noticed that the documentation of undo_partition lacks a mention of dropping triggers and functions. I propose to add it.

I was also quite surprise when I realized the partition where not undone in the order I thought they would. I did a bunch of drop / create on my partitions before playing with the undo function so the "logical" order was not the same as the "creation order" of the partition. I propose to add a warning about that in the undo_partition doc.

Thx for the hard work.
Benoit.

Undo partition drops the trigger and functions on the partition set but the documentation fails to describe this.
Added a note in pg_partman.md about this.
The order of the undo is pg_inherits.inhrelid ASC. It might not match "the logical" order.
@keithf4
Copy link
Collaborator

keithf4 commented Apr 19, 2018

There are specific undo_partition_time() and undo_partition_id() functions that will undo things in logical order. undo_partition_native() also does things in logical order. These functions only work on partitions made by pg_partman and it states this.

undo_partition is made to work on any partition set, not specifically the ones generated by pg_partman. In order to do logical order, partman would have to know the exact pattern of the partitioning names, which is why the above functions work. In a general case for any partition set, that isn't predictable, so it can only go in whatever order the list returned from pg_inherits returns.

I do have the trigger drop warning in the other functions, so I agree it should be in one you point out too. I will add that to be included in my next commit.

@blogh
Copy link
Author

blogh commented Apr 19, 2018

Overall, I agree with your analysis and I think I should have used undo_partition_time() from the start.

I used undo_partition because it didn't have the mention about the triggers. I thought I could just backfill the last child into the parent without removing the triggers (I was just playing around with the tool, it's not a "need" I have). I was very surprised to see the parent growing :) afterwards.

Regarding the order of the Undo, I understand the reason but was also very surprised at first. I got my answer in the code but felt like It would be worth explaining the unpredictability a bit more.

On a different topic: Is it normal that psycopg2 is not a dependency of the pg_partman package in PGDG ? I understand it's not essential but it's surprising none the less to get this message :

postgres@ulbdybbb01:~$ /usr/lib/postgresql/9.5/bin/reapply_indexes.py
Traceback (most recent call last):
  File "/usr/lib/postgresql/9.5/bin/reapply_indexes.py", line 3, in <module>
	import argparse, psycopg2, re, sys, time
ImportError: No module named psycopg2

**EDIT: Packages for ubuntu 14.04 pg 9.4 and 16.04 pg9.5

@keithf4
Copy link
Collaborator

keithf4 commented Apr 19, 2018

I don't maintain any packages for pg_partman, so you'd have to contact the maintainers of those repositories about any dependencies.

@blogh
Copy link
Author

blogh commented Apr 20, 2018

Ok thanks !

I'll close this since you plan to add the comments in a future commit.

@blogh blogh closed this Apr 20, 2018
@df7cb
Copy link

df7cb commented Aug 29, 2018

Fwiw I'll update the dependency of the Debian package.

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.

None yet

3 participants