-
Notifications
You must be signed in to change notification settings - Fork 176
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
Notices in pg_repack1.4.5 logs for AWS Aurora PostgreSQL 12.8 indicate waiting for transactions to finish with specific PIDs unrelated to the table being repacked. #381
Comments
In the pg_stat_activity, it's observed that the pg_Repack session is executing the query "LOCK TABLE table IN ACCESS SHARE MODE" and remains in an idle in transaction state. |
This is expected behavior. pg_repack opens an additional connection which holds ACCESS SHARE lock. Here is quote from the documentation:
and
|
Which tables are seen in the log? |
Thanks for the response, @andreasscherbaum & @za-arthur It seems I didn't explain the situation thoroughly. The PID that pg_repack is waiting for isn't interacting with the target table at all. Each time I run pg_repack, it gets stuck waiting for a completely unrelated session, In this particular case session is executing a different SQL statement on a different table. This target table is newly created solely to reproduce the issue and isn't used anywhere else in the database. Regarding my comment on the pg_repack session in pg_stat_Activity, it's executing "LOCK TABLE table IN ACCESS SHARE MODE" and remains idle in a transaction state. |
Can you create a case where you can reproduce this on vanilla PostgreSQL? |
Quoting @schmiddy from another issue - Issue
|
This might be related to this issue #86. |
@za-arthur I am sorry I couldn't find any solution in the issue #86 My pg_repack runs keep waiting like this. I did use -T 30 so that these sessions can be terminated for pg_repack. NOTICE: Waiting for 5 transactions to finish. First PID: 9677 |
Not much you can do. You do not have (and never will) a control over amazon RDS or Aurora instances on superuser level required to cancel transactions of other users (including amazon internal stuff). |
This can be reproduced with bitnami's Postgresql 15 with pg_repack:
Maybe we are missing something from the docs, but our database always has running transactions. Is pg_repack impossible to execute under these conditions? |
It's expected behavior. Just let it wait until old transactions finished. |
Thank you @MaximBoguk. We may need to address the long running transactions. I still don't quite get this behavior. Could anybody give more details on this? Are any previously running transactions considered potential interference for pg_repack? |
In general, PostgreSQL can't let go of old data which may or may not be accessed by older transactions. It's possible that a long-running transaction will also access this table, even though that did not happen, or not yet happen. The database can't know that. |
Hi,
In the pg_repack1.4.5 logs for AWS Aurora PostgreSQL 12.8, there are notices indicating a wait for transactions to finish, mentioning specific PIDs that are not associated with the table undergoing repacking. This inconsistency needs to be addressed for clarity and efficiency in the repacking process.
The text was updated successfully, but these errors were encountered: