From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | vignesh C <vignesh21(at)gmail(dot)com> |
Cc: | Ryan Lambert <ryan(at)rustprooflabs(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Anthony Nowocien <anowocien(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Filip Rembiałkowski <filip(dot)rembialkowski(at)gmail(dot)com> |
Subject: | Re: dropdb --force |
Date: | 2019-09-18 04:11:22 |
Message-ID: | CAFj8pRDW35THWnpkQyUe1HD2MuSXtDPzkK1jBN+AFv7qjiOFfA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
st 18. 9. 2019 v 5:59 odesílatel vignesh C <vignesh21(at)gmail(dot)com> napsal:
> On Wed, Sep 18, 2019 at 8:30 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
> >
> >
> Hi Pavel,
>
> One Comment:
> In the documentation we say drop database will fail after 60 seconds
> <varlistentry>
> <term><literal>FORCE</literal></term>
> <listitem>
> <para>
> Attempt to terminate all existing connections to the target database.
> </para>
> <para>
> This will fail, if current user has no permissions to terminate other
> connections. Required permissions are the same as with
> <literal>pg_terminate_backend</literal>, described
> in <xref linkend="functions-admin-signal"/>.
>
> This will also fail, if the connections do not terminate in 60
> seconds.
> </para>
> </listitem>
> </varlistentry>
>
This is not valid. With FORCE flag the clients are closed immediately
>
> But in TerminateOtherDBBackends:
> foreach (lc, pids)
> + {
> + int pid = lfirst_int(lc);
> +
> + (void) kill(pid, SIGTERM); /* ignore any error */
> + }
> +
> + /* sleep 100ms */
> + pg_usleep(100 * 1000L);
> + }
>
> We check for any connected backends after sending kill signal in
> CountOtherDBBackends and throw error immediately.
>
> I had also tested this scenario to get the following error immediately:
> test=# drop database (force) test1;
> ERROR: database "test1" is being accessed by other users
> DETAIL: There is 1 other session using the database.
>
>
sure - you cannot to kill self
> I feel some change is required to keep documentation and code in sync.
>
I am waiting to Tom's reply about necessary rights. But the doc part is not
synced, and should be fixed.
Pavel
>
> Regards,
> Vignesh
> EnterpriseDB: http://www.enterprisedb.com
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-09-18 04:33:19 | Re: scorpionfly needs more semaphores |
Previous Message | Amit Kapila | 2019-09-18 04:00:34 | Re: range test for hash index? |