CountDBSubscriptions check in dropdb - Mailing list pgsql-hackers

From Amit Kapila
Subject CountDBSubscriptions check in dropdb
Date
Msg-id CAA4eK1+qhLkCYG2oy9xug9ur_j=G2wQNRYAyd+-kZfZ1z42pLw@mail.gmail.com
Whole thread Raw
Responses Re: CountDBSubscriptions check in dropdb
List pgsql-hackers
While reviewing Pavel's patch for a new option in Drop Database
command [1], I noticed that the check for CountDBSubscriptions in
dropdb() is done after we kill the autovac workers and allowed other
backends to exit via CountOtherDBBackends.  Now, if there are already
active subscritions due to which we can't drop database, then it is
better to fail before we do CountOtherDBBackends.  It is also
indicated in a comment (
check this after other error conditions) that CountOtherDBBackends has
to be done after error checks.

So, I feel we should rearrange the code to move the subscriptions
check before CountOtherDBBackends as is done in the attached patch.

This has been introduced by below commit:
commit 665d1fad99e7b11678b0d5fa24d2898424243cd6
Author: Peter Eisentraut <peter_e@gmx.net>
Date:   Thu Jan 19 12:00:00 2017 -0500

    Logical replication

Thoughts?

[1] - https://commitfest.postgresql.org/25/2055/

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Questions/Observations related to Gist vacuum
Next
From: Amit Kapila
Date:
Subject: Re: dropdb --force