Thread: pgsql: Release the exclusive lock on the table early after truncating it

pgsql: Release the exclusive lock on the table early after truncating it

From
alvherre@postgresql.org (Alvaro Herrera)
Date:
Log Message:
-----------
Release the exclusive lock on the table early after truncating it in lazy
vacuum, instead of waiting till commit.

Modified Files:
--------------
    pgsql/src/backend/commands:
        vacuumlazy.c (r1.92 -> r1.93)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuumlazy.c?r1=1.92&r2=1.93)

Re: pgsql: Release the exclusive lock on the table early after truncating it

From
Tom Lane
Date:
alvherre@postgresql.org (Alvaro Herrera) writes:
> Release the exclusive lock on the table early after truncating it in lazy
> vacuum, instead of waiting till commit.

Weren't you going to disable vacuum_delay in that stretch of code, too?

BTW, not sure if you realized this, but just deleting the
vacuum_delay_point call is probably a bad idea --- replace it
with CHECK_FOR_INTERRUPTS() instead.

            regards, tom lane

Re: pgsql: Release the exclusive lock on the table early after truncating it

From
Alvaro Herrera
Date:
Tom Lane wrote:
> alvherre@postgresql.org (Alvaro Herrera) writes:
> > Release the exclusive lock on the table early after truncating it in lazy
> > vacuum, instead of waiting till commit.
>
> Weren't you going to disable vacuum_delay in that stretch of code, too?
>
> BTW, not sure if you realized this, but just deleting the
> vacuum_delay_point call is probably a bad idea --- replace it
> with CHECK_FOR_INTERRUPTS() instead.

Hmm, I didn't.  Will fix.

Actually, now that you mention it, I remember that Alexey Kluykin (a
colleague from Command Prompt) had already mentioned it to me and I
forgot :-(

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: pgsql: Release the exclusive lock on the table early after truncating it

From
Alvaro Herrera
Date:
Tom Lane wrote:
> alvherre@postgresql.org (Alvaro Herrera) writes:
> > Release the exclusive lock on the table early after truncating it in lazy
> > vacuum, instead of waiting till commit.
>
> Weren't you going to disable vacuum_delay in that stretch of code, too?

I forgot to mention that I had patched this separately.  I back-patched
the removal of vacuum_delay all the way to 8.0, but the early release of
the AccessExclusive lock I limited to HEAD.



--
Alvaro Herrera                 http://www.amazon.com/gp/registry/DXLWNGRJD34J
"The West won the world not by the superiority of its ideas or values
or religion but rather by its superiority in applying organized violence.
Westerners often forget this fact, non-Westerners never do."
(Samuel P. Huntington)