Re: ALTER TABLE lock strength reduction patch is unsafe
Simon Riggs <simon@2ndquadrant.com>
From: Simon Riggs <simon@2ndQuadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>, Robert Haas <robertmhaas@gmail.com>, Bruce Momjian <bruce@momjian.us>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2012-01-02T21:17:34Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add bytea_agg, parallel to string_agg.
- d5448c7d31b5 9.2.0 cited
-
Fix ALTER TABLE ONLY .. DROP CONSTRAINT.
- c0f03aae0469 9.2.0 cited
On Mon, Jan 2, 2012 at 7:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Simon Riggs <simon@2ndQuadrant.com> writes: >> On Mon, Jan 2, 2012 at 6:06 PM, Noah Misch <noah@leadboat.com> wrote: >>> On Mon, Jan 02, 2012 at 05:09:16PM +0000, Simon Riggs wrote: >>>> Attached patch makes SnapshotNow into an MVCC snapshot, > >>> 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? > > Almost certainly yes. For example, a catcache load may invoke catcache > or relcache reload operations on its way to opening the table or index > needed to fetch the desired row. > > I think you can only safely do this if each caller has its own snapshot > variable, a la SnapshotDirty, and that's going to be hugely more > invasive. I think I can avoid doing things that way and keep it non-invasive. If we #define SnapshotNow (GetSnapshotNow()) and make GetSnapshotNow() reuse the static SnapshotNowData if possible. If not available we can allocate a new snapshot in TopTransactionContext. We can free the snapshot at the end of scan. That hides most of the complexity without causing any problems, ISTM. Working on this now. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services