Обсуждение: Clean Postgres shutdown

Поиск
Список
Период
Сортировка

Clean Postgres shutdown

От
Yambu
Дата:
Hello

Is there a clean way to shutdown postgres which completes transactions and does not abort them.

I ran  #systemctl stop postgresql-10

2021-01-18 14:31:28.600 GMT [10594] LOG:  received fast shutdown request
2021-01-18 14:31:28.603 GMT [10594] LOG:  aborting any active transactions
2021-01-18 14:31:28.607 GMT [10594] LOG:  worker process: logical replication launcher (PID 10604) exited with exit code 1
2021-01-18 14:31:28.613 GMT [10598] LOG:  shutting down
2021-01-18 14:31:28.634 GMT [23850] FATAL:  the database system is shutting down
2021-01-18 14:31:29.119 GMT [10594] LOG:  database system is shut down

Re: Clean Postgres shutdown

От
Laurenz Albe
Дата:
On Tue, 2021-01-19 at 12:10 +0200, Yambu wrote:
> Is there a clean way to shutdown postgres which completes transactions and does not abort them.
> 
> I ran  #systemctl stop postgresql-10
> 
> 2021-01-18 14:31:28.600 GMT [10594] LOG:  received fast shutdown request
> 2021-01-18 14:31:28.603 GMT [10594] LOG:  aborting any active transactions
> 2021-01-18 14:31:28.607 GMT [10594] LOG:  worker process: logical replication launcher (PID 10604) exited with exit
code1
 
> 2021-01-18 14:31:28.613 GMT [10598] LOG:  shutting down
> 2021-01-18 14:31:28.634 GMT [23850] FATAL:  the database system is shutting down
> 2021-01-18 14:31:29.119 GMT [10594] LOG:  database system is shut down

Yes, that is the "smart" shutdown mode that will wait for all sessions to finish.

Admitted, that's not the same as waiting for the end of the *transaction*, but
it is the closest thing we have.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




Re: Clean Postgres shutdown

От
Magnus Hagander
Дата:
On Tue, Jan 19, 2021 at 12:01 PM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> On Tue, 2021-01-19 at 12:10 +0200, Yambu wrote:
> > Is there a clean way to shutdown postgres which completes transactions and does not abort them.
> >
> > I ran  #systemctl stop postgresql-10
> >
> > 2021-01-18 14:31:28.600 GMT [10594] LOG:  received fast shutdown request
> > 2021-01-18 14:31:28.603 GMT [10594] LOG:  aborting any active transactions
> > 2021-01-18 14:31:28.607 GMT [10594] LOG:  worker process: logical replication launcher (PID 10604) exited with exit
code1
 
> > 2021-01-18 14:31:28.613 GMT [10598] LOG:  shutting down
> > 2021-01-18 14:31:28.634 GMT [23850] FATAL:  the database system is shutting down
> > 2021-01-18 14:31:29.119 GMT [10594] LOG:  database system is shut down
>
> Yes, that is the "smart" shutdown mode that will wait for all sessions to finish.
>
> Admitted, that's not the same as waiting for the end of the *transaction*, but
> it is the closest thing we have.

It is, and this is very unfortunate :/ Because waiting until the end
of running transactions would actually be useful, whereas waiting to
the end of sessions is usually the wrong thing to do.

So in the perspective of most applications, we can just say we don't
have it, and people should sue the fast mode (default).

-- 
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/