From: Andres Freund <andres@anarazel.de>
To: Kevin Grittner <kgrittn@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Ants Aasma <ants.aasma@eesti.ee>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Kevin Grittner <kgrittn@postgresql.org>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: pgsql-committers@postgresql.org <pgsql-committers@postgresql.org>
Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Date: Thu, 16 Jun 2016 11:57:48 -0700
Message-ID: <20160616185748.32pjujl37xfo7rh7@alap3.anarazel.de> (raw)
In-Reply-To: <CACjxUsNwkUebA8upL0ehRJfA1HWVStN8uey5TmpwqEQzDNLeHg@mail.gmail.com>
References: <CACjxUsNN+Y5WyASrMS+=vL-Bk3QX-vHuYpM2jpS0K2iUp_qkig@mail.gmail.com>
<20160616015730.rtozaq5mmlhci6xy@alap3.anarazel.de>
<CACjxUsN6iCBrrNw7H5BJ7amJRx4AiUzjnpW=35FSuyZ1+Pgq1A@mail.gmail.com>
<20160616153745.upxilwj3spbi43dj@alap3.anarazel.de>
<CA+TgmobTQ=71y-c5P9VjWxOREVYWvkKd2ajQ5-J5HRkebdZ8DQ@mail.gmail.com>
<20160616161426.bapgkbh762ktzyhk@alap3.anarazel.de>
<CA+TgmoZBcUoYR4VmhLoeqdt8t1b80eOacbub4WHu1duqSy8ErA@mail.gmail.com>
<20160616165440.pla4q3gbozyciuyo@alap3.anarazel.de>
<CACjxUsORAC-=gHFYct70D33Vua5-7Zu5KgFPN-Giz4xdnnC4bg@mail.gmail.com>
<CACjxUsNwkUebA8upL0ehRJfA1HWVStN8uey5TmpwqEQzDNLeHg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
On 2016-06-16 13:53:01 -0500, Kevin Grittner wrote:
> On Thu, Jun 16, 2016 at 1:19 PM, Kevin Grittner <kgrittn@gmail.com> wrote:
> > On Thu, Jun 16, 2016 at 11:54 AM, Andres Freund <andres@anarazel.de> wrote:
> >> On 2016-06-16 12:43:34 -0400, Robert Haas wrote:
>
> >>> Maybe it would help if you lay out the whole sequence of events, like:
> >>>
> >>> S1: Does this.
> >>> S2: Does that.
> >>> S1: Now does something else.
> >>
> >> I presume it'd be something like:
> >>
> >> Assuming a 'toasted' table, which contains one row, with a 1GB field.
> >>
> >> S1: BEGIN REPEATABLE READ;
> >> S1: SELECT SUM(length(one_gb_record)) FROM toasted;
> >> S2: DELETE FROM toasted;
> >> AUTOVAC: vacuum toasted's toast table, it's large. skip toasted, it's small
> >> S1: SELECT SUM(length(one_gb_record)) FROM toasted;
> >> <missing chunk error>
> >
> > I'll put together a test like that and post in a bit.
>
> old_snapshot_threshold = '1min'
> autovacuum_vacuum_threshold = 0\
> autovacuum_vacuum_scale_factor = 0.0000000001
>
> test=# CREATE TABLE gb (rec bytea not null);
> CREATE TABLE
> test=# ALTER TABLE gb ALTER COLUMN rec SET STORAGE external;
> ALTER TABLE
> test=# INSERT INTO gb SELECT t FROM (SELECT repeat('x',
> 1000000000)::bytea) x(t);
> INSERT 0 1
> test=# BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
> BEGIN
> test=# SELECT SUM(length(rec)) FROM gb;
> sum
> ------------
> 1000000000
> (1 row)
>
> [wait for autovacuum to run]
>
> test=# SELECT SUM(length(rec)) FROM gb;
> ERROR: snapshot too old
See https://www.postgresql.org/message-id/20160616183207.wygoktoplycdzav7@alap3.anar
for a recipe that reproduce the issue. I presume your example also
vacuums the main table due to the threshold and scale factor you set
(which will pretty much alwasy vacuum a table, no?).
Andres Freund
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, kgrittn@gmail.com, robertmhaas@gmail.com, alvherre@2ndquadrant.com, ants.aasma@eesti.ee, amit.kapila16@gmail.com, noah@leadboat.com, kgrittn@postgresql.org, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Re: pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
In-Reply-To: <20160616185748.32pjujl37xfo7rh7@alap3.anarazel.de>
References: <CACjxUsNN+Y5WyASrMS+=vL-Bk3QX-vHuYpM2jpS0K2iUp_qkig@mail.gmail.com> <20160616015730.rtozaq5mmlhci6xy@alap3.anarazel.de> <CACjxUsN6iCBrrNw7H5BJ7amJRx4AiUzjnpW=35FSuyZ1+Pgq1A@mail.gmail.com> <20160616153745.upxilwj3spbi43dj@alap3.anarazel.de> <CA+TgmobTQ=71y-c5P9VjWxOREVYWvkKd2ajQ5-J5HRkebdZ8DQ@mail.gmail.com> <20160616161426.bapgkbh762ktzyhk@alap3.anarazel.de> <CA+TgmoZBcUoYR4VmhLoeqdt8t1b80eOacbub4WHu1duqSy8ErA@mail.gmail.com> <20160616165440.pla4q3gbozyciuyo@alap3.anarazel.de> <CACjxUsORAC-=gHFYct70D33Vua5-7Zu5KgFPN-Giz4xdnnC4bg@mail.gmail.com> <CACjxUsNwkUebA8upL0ehRJfA1HWVStN8uey5TmpwqEQzDNLeHg@mail.gmail.com> <20160616185748.32pjujl37xfo7rh7@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox