Re: CountDBSubscriptions check in dropdb

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Subject: Re: CountDBSubscriptions check in dropdb
Date: 2019-11-08 13:38:34
Message-ID: CAA4eK1JbdFzqjvSqWib4Gz2Kf=rg_bxqs58d+L3h-WjP8ftT5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 21, 2019 at 11:43 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> 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(at)gmx(dot)net>
> Date: Thu Jan 19 12:00:00 2017 -0500
>
> Logical replication
>

I am planning to commit and backpatch this till PG10 where it was
introduced on Monday morning (IST). Pavel agreed that this is a good
change in the other thread where we need it [1]. It is not an urgent
thing, so I can wait if we think this is not a good time to commit
this. Let me know if anyone has objections?

[1] - https://www.postgresql.org/message-id/CAFj8pRD75_wYzigvhk3fLcixGSkevwnYtdwE3gf%2Bb8EqRqbXSA%40mail.gmail.com

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2019-11-08 13:40:13 Re: Monitoring disk space from within the server
Previous Message Christoph Berg 2019-11-08 13:35:31 Re: Monitoring disk space from within the server