Re: LOCK DATABASE

From: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LOCK DATABASE
Date: 2011-05-18 05:02:43
Message-ID: BANLkTimioq=USgp7m8Drcji=Qo0fa97tcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 17, 2011 at 10:21 PM, Alvaro Herrera
<alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> So we would have a new command LOCK DATABASE [FOR SESSION] or something
> like that; the pooler software would call that and then kill other
> existing application connections (using pg_terminate_backend() perhaps),
> then drop the database.  This LOCK DATABASE thingy would just be a
> simple function on top of LockSharedObject.  Since establishing a new
> connection requires grabbing a lock on the database via
> LockSharedObject, things would Just Work (or at least so it seems to
> me).
>
> UNLOCK DATABASE would be needed to release a session-level lock acquired
> by LOCK DATABASE FOR SESSION for the cases where you want to lock a
> database to safely do schema upgrades and the like.
>

So we the lock will be released at end of the session or when the
UNLOCK DATABASE command is invoked, right?
A question: why will we beign so rude by killing other sessions
instead of avoid new connections and wait until the current sessions
disconnect?

--
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte y capacitación de PostgreSQL

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Max Bourinov 2011-05-18 05:40:29 Passing an array or record to a stored procedure in PostgreSQL
Previous Message Devrim GÜNDÜZ 2011-05-18 04:28:54 Re: deprecating contrib for PGXN