-
Notifications
You must be signed in to change notification settings - Fork 273
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
Allow infinite_time_partitions flag to work even if zero data in partition set #585
Comments
I'm seeing similar problems with similar debug logging. I use partition interval of |
I can't seem to repeat it now with a clean test. I do know that it was failing when I manually tried to change the |
I wanted to add some information here. I've been testing this further and I've identified that for Regardless of new data, I'm probably going to create a cron job to insert some dummy data every few hours just to make sure that some outage does not cause a bigger problem. I noticed that if you get to where retention is bumping up against the last partition, it will not be deleted. Any inserts when its in this state and data going into the default partition will also not trigger new partitions to be created so partman cannot get it out of this state and all data will go into the default partition forever. |
This makes sense as each table's maintenance is simply run in a loop and each table is individually checked if it has an data |
run_maintenance()
to create future partitions
I faced the same problem. I think this is caused by IF v_row.infinite_time_partitions AND (v_current_partition_timestamp < CURRENT_TIMESTAMP) THEN Replacing it with "OR" solves the problem. |
I don't think an OR condition would handle this as intended. In that case it would keep making partitions if infinite was set to false but the current/max value in the partition set was less than "now", which means the setting wouldn't make any difference in the end. But this did point me in the right direction of where to fix this issue, so thank you! |
I have a beta PR up that should allow the infinite flag to work with no data. If you're able to test, any feedback would be appreciated |
I just tested the beta version and it works well. But I found that in |
Thank you for catching the mismatched lock calls! I don't think I'll be adding that option to |
I've uploaded some fixes to the beta PR. If you have a chance to retest again that would be appreciated. I'll hopefully be releasing in the near future |
I tested the new version in the part of infinite partitions, and it works fine. |
Thank you! |
In amazon rds still facing the issue. The extention is not updated there. If I try to upgrade using update command, it is not working |
Apologies, I have no control over the version of pg_partman in RDS. Please put in a support request with them. |
With
infinite_time_partitions = true
, partman will not create new partitions without data in some partition. When there is new data in some partition, it then makes partitions for all partitions up till now() + premake.The goal was that simply running
run_maintenance()
would trigger new partition creation based onnow()
, and handle retention of old partitions, regardless if there was new data inside the partitions.Discussed in #581
Originally posted by mbrancato October 23, 2023
I'm planning to run
pg_partman
without the background worker. To prepare for that, I've be just trying to manually create a test table, and then runrun_maintenance()
to ensure that forward-looking partitions are being created. My initial use-case was a bit more complex, so I reduced complexity for testing purposes. However, I can still not get any future partitions to be created.For setup, I'm running this in a container, and this is my Dockerfile:
extension data:
I'm just using the
postgres
user for now to connect to a test database:result
I've tried both
1 hour
and1 minute
intervals for testing. In practice, I'll likely use1 day
intervals. Waiting a while and runningrun_maintenance()
seems to do nothing. The same is true if I delete the last partition and then runrun_maintenance()
. I'm running it this way:The output with
DEBUG1
looks like this:output logs
I've looked at this previous discussion, but while I am running the maintenance manually, its unclear if its saying I literally need to
INSERT
data to trigger new partitions to be created. Is there something I'm missing to trigger the creation of new partitions?The text was updated successfully, but these errors were encountered: