Re: dropdb --force

From: Filip Rembiałkowski <filip(dot)rembialkowski(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: dropdb --force
Date: 2019-04-01 11:26:06
Message-ID: CAP_rwwncFn6VsdG5ys_QwK3=n4que2FUy58+=2R_eQC0uaycbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31.03.2019, 04:35 Andres Freund <andres(at)anarazel(dot)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!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christian Ullrich 2019-04-01 11:31:23 Re: C_C_A animal on HEAD gets stuck in initdb
Previous Message Andrey Lepikhov 2019-04-01 10:18:18 Re: Reduce amount of WAL generated by CREATE INDEX for gist, gin and sp-gist