pg_repack and locks

Started by nicolasabout 1 year ago4 messagesgeneral
Jump to latest
#1nicolas
nicolas75_fr@yahoo.fr

Hello everyone,

We are using postgresql v12 and added the pg_repack package

Since I cannot stop other process, I use the “--no-kill-backend” and Pg_repack will wait indefinitly until pg_repack get the lock

I get sometimes a problem of lock:

sometimes, I get indefinitly this message : “NOTICE: Waiting for 1 transactions to finish. First PID: xxxx”

this is a real problem because the database is usd all the time.
If I kill the process, a trigger on source table will still exist and temporary tables and type still exists in the repack schema. The tables are not empty if data has been modified in the source table during the repack.

If I drop table repack tables, I will loose all data modifications done on source table
how can I properly cleanup the database ?

Hope this is clear and that somebody can help

best raegards,
Nicolas

In reply to: nicolas (#1)
Re: pg_repack and locks

On Mon, Jan 13, 2025 at 12:40:06PM +0000, nicolas wrote:

Hello everyone,

We are using postgresql v12 and added the pg_repack package

Since I cannot stop other process, I use the “--no-kill-backend” and Pg_repack will wait indefinitly until pg_repack get the lock

I get sometimes a problem of lock:

sometimes, I get indefinitly this message : “NOTICE: Waiting for 1 transactions to finish. First PID: xxxx”

this is a real problem because the database is usd all the time.
If I kill the process, a trigger on source table will still exist and temporary tables and type still exists in the repack schema. The tables are not empty if data has been modified in the source table during the repack.

If I drop table repack tables, I will loose all data modifications done on source table
how can I properly cleanup the database ?

Allow it to kill offending backends after some time? For example -T 7200?

Best regards,

depesz

#3nicolas
nicolas75_fr@yahoo.fr
In reply to: hubert depesz lubaczewski (#2)
RE: pg_repack and locks

Hi

Thanks for the help but this will not help, killing other process is not safe
The good way will be that pg_repack tools include a timeout so, that after expiration delay, he will stop waiting and discard the repack action

But thanks again for your proposition.
Regards,
Nicolas

-----Message d'origine-----
De : depesz@depesz.com <depesz@depesz.com>
Envoyé : lundi 13 janvier 2025 16:42
À : nicolas <nicolas75_fr@yahoo.fr>
Cc : pgsql-general@lists.postgresql.org
Objet : Re: pg_repack and locks

On Mon, Jan 13, 2025 at 12:40:06PM +0000, nicolas wrote:

Hello everyone,

We are using postgresql v12 and added the pg_repack package

Since I cannot stop other process, I use the “--no-kill-backend” and
Pg_repack will wait indefinitly until pg_repack get the lock

I get sometimes a problem of lock:

sometimes, I get indefinitly this message : “NOTICE: Waiting for 1 transactions to finish. First PID: xxxx”

this is a real problem because the database is usd all the time.
If I kill the process, a trigger on source table will still exist and temporary tables and type still exists in the repack schema. The tables are not empty if data has been modified in the source table during the repack.

If I drop table repack tables, I will loose all data modifications
done on source table how can I properly cleanup the database ?

Allow it to kill offending backends after some time? For example -T 7200?

Best regards,

depesz

#4Boris Zentner
bzm@2bz.de
In reply to: nicolas (#3)
Re: pg_repack and locks

Hi there,

I think you can use -T 3600 -D If you don't want to kill the backends.
--
Boris

Show quoted text

Am 19.01.2025 um 13:52 schrieb nicolas75_fr@yahoo.fr:

Hi

Thanks for the help but this will not help, killing other process is not safe
The good way will be that pg_repack tools include a timeout so, that after expiration delay, he will stop waiting and discard the repack action

But thanks again for your proposition.
Regards,
Nicolas

-----Message d'origine-----
De : depesz@depesz.com <depesz@depesz.com>
Envoyé : lundi 13 janvier 2025 16:42
À : nicolas <nicolas75_fr@yahoo.fr>
Cc : pgsql-general@lists.postgresql.org
Objet : Re: pg_repack and locks

On Mon, Jan 13, 2025 at 12:40:06PM +0000, nicolas wrote:
Hello everyone,

We are using postgresql v12 and added the pg_repack package

Since I cannot stop other process, I use the “--no-kill-backend” and
Pg_repack will wait indefinitly until pg_repack get the lock

I get sometimes a problem of lock:

sometimes, I get indefinitly this message : “NOTICE: Waiting for 1 transactions to finish. First PID: xxxx”

this is a real problem because the database is usd all the time.
If I kill the process, a trigger on source table will still exist and temporary tables and type still exists in the repack schema. The tables are not empty if data has been modified in the source table during the repack.

If I drop table repack tables, I will loose all data modifications
done on source table how can I properly cleanup the database ?

Allow it to kill offending backends after some time? For example -T 7200?

Best regards,

depesz