Re: dropdb --force

Поиск
Список
Период
Сортировка
От vignesh C
Тема Re: dropdb --force
Дата
Msg-id CALDaNm3YJQRYoWnavuJ3_yBvgpxvNxHdwGPzUssFZuCwSgJXbg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: dropdb --force  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: dropdb --force  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Wed, Sep 18, 2019 at 8:30 AM Pavel Stehule <pavel.stehule@gmail.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>


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.

I feel some change is required to keep documentation and code in sync.

Regards,
Vignesh
EnterpriseDB: http://www.enterprisedb.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Efficient output for integer types
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: range test for hash index?