Re: ALTER TABLE lock strength reduction patch is unsafe

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLE lock strength reduction patch is unsafe
Date: 2012-01-02 19:33:28
Message-ID: 1325532677-sup-1833@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Excerpts from Noah Misch's message of lun ene 02 16:25:25 -0300 2012:
> On Mon, Jan 02, 2012 at 06:41:31PM +0000, Simon Riggs wrote:
> > On Mon, Jan 2, 2012 at 6:06 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> > > On Mon, Jan 02, 2012 at 05:09:16PM +0000, Simon Riggs wrote:
> > >> Attached patch makes SnapshotNow into an MVCC snapshot, initialised at
> > >> the start of each scan iff SnapshotNow is passed as the scan's
> > >> snapshot. It's fairly brief but seems to do the trick.
> > >
> > > That's a neat trick. ?However, if you start a new SnapshotNow scan while one is
> > > ongoing, the primordial scan's snapshot will change mid-stream.
> >
> > Do we ever do that? (and if so, Why?!? or perhaps just Where?)
>
> I hacked up your patch a bit, as attached, to emit a WARNING for any nested
> use of SnapshotNow. This made 97/127 test files fail. As one example,
> RelationBuildRuleLock() does TextDatumGetCString() for every tuple of its
> SnapshotNow scan. That may need a detoast, which itself runs a scan.

Uh, I thought detoasting had its own visibility test function .. I mean,
otherwise, what is HeapTupleSatisfiesToast for?

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-01-02 19:39:09 Re: ALTER TABLE lock strength reduction patch is unsafe
Previous Message Magnus Hagander 2012-01-02 19:32:54 Re: backup_label during crash recovery: do we know how to solve it?