Re: Review: rollback sequence reset for TRUNCATE ... RESTART IDENTITY

From: Marc Cousin <cousinmarc(at)gmail(dot)com>
To: Jaime Casanova <jaime(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Review: rollback sequence reset for TRUNCATE ... RESTART IDENTITY
Date: 2010-11-17 15:00:46
Message-ID: 201011171600.47254.cousinmarc@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The Wednesday 17 November 2010 15:50:36, Jaime Casanova wrote :
> On Wed, Nov 17, 2010 at 8:13 AM, Marc Cousin <cousinmarc(at)gmail(dot)com> wrote:
> > - Does the feature work as advertised?
> >
> > Yes. It works consistently, isn't fooled by savepoints or multiple
> > serials in a table, or concurrent transactions
>
> i haven't tested this nor readed the patch but i wondering what
> happens in the presence of a prepared transaction (2PC), did you try
> with concurrent transactions with different serialization levels?
I haven't tested with 2PC.

I didn't check with different isolations levels either.

I just verified that locking was happening as it should : truncate is blocked
by a transaction already locking the table with an AccessShareLock and vice-
versa.

And that Rollbacking and rollbacking to savepoint restores the sequence to the
correct state : the sequence isn't restored to its value at the savepoint, but
at its last value before the truncate.

I don't see a special test-case with different isolation levels or 2PC. What
do you have in mind ?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-11-17 15:11:51 Re: unlogged tables
Previous Message Jaime Casanova 2010-11-17 14:50:36 Re: Review: rollback sequence reset for TRUNCATE ... RESTART IDENTITY