pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Parallel Append subplan order instability on aye-aye
Date: Wed, 17 Jul 2019 11:53:48 -0400
Message-ID: <22315.1563378828@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKJS1f-t4QUS3z9QeNbg2+2ExwNZtXZLxie5AxNw9s8spo=M-g@mail.gmail.com>
References: <CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com>
	<2863.1558327585@sss.pgh.pa.us>
	<CA+hUKGL1jZaZuUAtBhx0Bh6-qcOi5YwT9dZh8eZWmNmPauJvjA@mail.gmail.com>
	<CAKJS1f-KovGF5-j8xMdMufrF-i=dJqmS=nh0Y3=pBtvLnAN6hw@mail.gmail.com>
	<3341.1558449552@sss.pgh.pa.us>
	<CA+hUKGJLgTy36PLGcMJWFqaYwyHWugtmYjaZD179z_FcxHp9cQ@mail.gmail.com>
	<1588.1558500275@sss.pgh.pa.us>
	<1554.1563236463@sss.pgh.pa.us>
	<4174.1563239552@sss.pgh.pa.us>
	<20190716192344.5jrt5pgzczi545zr@alap3.anarazel.de>
	<CAKJS1f-t4QUS3z9QeNbg2+2ExwNZtXZLxie5AxNw9s8spo=M-g@mail.gmail.com>

David Rowley <david.rowley@2ndquadrant.com> writes:
> Surely it can't be that since that just sets what *pages gets set to.
> Tom mentioned that following was returning 0 pages and tuples:

> -- Temporary hack to investigate whether extra vacuum/analyze is happening
> select relname, relpages, reltuples
> from pg_class
> where relname like '__star' order by relname;
>  relname | relpages | reltuples
> ---------+----------+-----------
>  a_star  |        1 |         3

I poked around a little and came up with a much simpler theory:
VACUUM will not change relpages/reltuples if it does not scan any pages
(cf. special case for tupcount_pages == 0 in heap_vacuum_rel, at line 343
in HEAD's vacuumlazy.c).  And, because sanity_check.sql's VACUUM is a
plain unaggressive vacuum, all that it takes to make it skip over a_star's
one page is for somebody else to have a pin on that page.  So a chance
collision with the bgwriter or checkpointer could cause the observed
symptom, not just for a_star but for the other single-page relations that
are at stake here.  Those pages are certainly dirty after create_misc.sql,
so it's hardly implausible for one of these processes to be holding pin
while trying to write out the buffer at the time sanity_check.sql runs.

A brute-force way to fix this (or at least reduce the odds quite a bit)
would be to have sanity_check.sql issue a CHECKPOINT before its VACUUM,
thereby guaranteeing that none of these pages are still in need of being
written.  Not sure how much that'd penalize the regression tests' runtime,
or whether we'd have a loss of test coverage of VACUUM behaviors.

			regards, tom lane





view thread (21+ messages)  latest in thread

Message-ID: <22315.1563378828@sss.pgh.pa.us>
Permalink:  ../22315.1563378828@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22315.1563378828@sss.pgh.pa.us

 · 

reply

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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.rowley@2ndquadrant.com, andres@anarazel.de, thomas.munro@gmail.com
  Subject: Re: Parallel Append subplan order instability on aye-aye
  In-Reply-To: <22315.1563378828@sss.pgh.pa.us>
  References: <CA+hUKG+0CxrKRWRMf5ymN3gm+BECHna2B-q1w8onKBep4HasUw@mail.gmail.com> <2863.1558327585@sss.pgh.pa.us> <CA+hUKGL1jZaZuUAtBhx0Bh6-qcOi5YwT9dZh8eZWmNmPauJvjA@mail.gmail.com> <CAKJS1f-KovGF5-j8xMdMufrF-i=dJqmS=nh0Y3=pBtvLnAN6hw@mail.gmail.com> <3341.1558449552@sss.pgh.pa.us> <CA+hUKGJLgTy36PLGcMJWFqaYwyHWugtmYjaZD179z_FcxHp9cQ@mail.gmail.com> <1588.1558500275@sss.pgh.pa.us> <1554.1563236463@sss.pgh.pa.us> <4174.1563239552@sss.pgh.pa.us> <20190716192344.5jrt5pgzczi545zr@alap3.anarazel.de> <CAKJS1f-t4QUS3z9QeNbg2+2ExwNZtXZLxie5AxNw9s8spo=M-g@mail.gmail.com> <22315.1563378828@sss.pgh.pa.us>

* 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