Re: dropdb --force
Filip Rembiałkowski <filip.rembialkowski@gmail.com>
From: Filip Rembiałkowski <filip.rembialkowski@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>, Marti Raudsepp <marti@juffo.org>, Pavel Stehule <pavel.stehule@gmail.com>,
Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2019-04-01T11:26:06Z
Lists: pgsql-hackers
On 31.03.2019, 04:35 Andres Freund <andres@anarazel.de> wrote:
>
> > bool
> > -CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
> > +CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared, bool force_terminate)
> > {
>
> That doesn't seem like a decent API to me.
Only excuse is that naming was already a bit off, as the function
includes killing autovacuum workers.
Please advise what would be a good approach to improve it. I would
propose something like:
bool CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared);
// make it actually do what the name announces - only the count, no
side effects.
bool KillDBBackends(Oid databaseId, bool killAutovacuum, bool killBackends);
// try to kill off all the backends, return false when there are still any.
Also, there is a question - should the FORCE option rollback prepared
transactions?
Thanks!
Commits
-
Add tests for '-f' option in dropdb utility.
- 8a7e9e9dad56 13.0 landed
-
Move pump_until to TestLib.pm.
- 290acac92b1d 13.0 landed
-
Add the support for '-f' option in dropdb utility.
- 80e05a088e4e 13.0 landed
-
Introduce the 'force' option for the Drop Database command.
- 1379fd537f9f 13.0 landed
-
Improve CREATE/DROP/RENAME DATABASE so that when failing because the source
- 4abd7b49f1e9 8.4.0 cited