On 31.03.2019, 04:35 Andres Freund <and...@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!