pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Andrey M. Borodin <x4mmm@yandex-team.ru>
Cc: Darafei Komяpa Praliaskouski <me@komzpa.net>
Cc: Pavel Borisov <pashkin.elfe@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Yet another fast GiST build
Date: Sun, 20 Sep 2020 17:44:46 -0500
Message-ID: <20200920224446.GF30557@telsasoft.com> (raw)
In-Reply-To: <891385.1600636205@sss.pgh.pa.us>
References: <7d9158ca-d7cb-88f0-dbbd-1d5cec32b1ae@iki.fi>
	<CAC8Q8t+KG6oeyC697X3agZmHFTMjZYKvg13X2KapbfcTiYvdhw@mail.gmail.com>
	<fdee7ef5-1ea3-e381-0611-19352c4f9d1d@iki.fi>
	<8516B6A8-11B2-41A8-B7EB-D0C38ADD06C3@yandex-team.ru>
	<50e03197-6e75-faec-16dc-41a2a38f080c@iki.fi>
	<123F5F32-9A85-4D0B-9C7A-1686E6BBE15D@yandex-team.ru>
	<85df399a-e8a4-2369-f723-fd1a3a872575@iki.fi>
	<!63596817-db40-1093-c6ce-5dea7dac67c4@iki.fi>
	<884200.1600634472@sss.pgh.pa.us>
	<891385.1600636205@sss.pgh.pa.us>

On Sun, Sep 20, 2020 at 05:10:05PM -0400, Tom Lane wrote:
> I wrote:
> > It appears that hyrax (CLOBBER_CACHE_ALWAYS) is not very happy
> > with this:
> > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=hyrax&dt=2020-09-19%2021%3A27%3A23
> 
> I reproduced that and traced it to a missing RelationOpenSmgr call.
> Fixed now.

This also appears to break checksums.

postgres=#  CREATE TABLE pvactst (i INT, a INT[], p POINT) with (autovacuum_enabled = off);
postgres=#  CREATE INDEX gist_pvactst ON pvactst USING gist (p);
postgres=#  INSERT INTO pvactst SELECT i, array[1,2,3], point(i, i+1) FROM generate_series(1,1000) i;
WARNING:  page verification failed, calculated checksum 34313 but expected 0
ERROR:  invalid page in block 0 of relation base/12859/16389

I was able to make this work like so:

@@ -449,6 +450,7 @@ gist_indexsortbuild(GISTBuildState *state)
 
        /* Write out the root */
        PageSetLSN(pagestate->page, GistBuildLSN);
+       PageSetChecksumInplace(pagestate->page, GIST_ROOT_BLKNO, state->indexrel->rd_smgr);
        smgrwrite(state->indexrel->rd_smgr, MAIN_FORKNUM, GIST_ROOT_BLKNO,
                          pagestate->page, true);
        if (RelationNeedsWAL(state->indexrel))
@@ -555,6 +557,7 @@ gist_indexsortbuild_flush_ready_pages(GISTBuildState *state)
 
                PageSetLSN(page, GistBuildLSN);
 
+               PageSetChecksumInplace(page, state->pages_written, state->indexrel->rd_smgr);
                smgrextend(state->indexrel->rd_smgr,
                                   MAIN_FORKNUM,
                                   state->pages_written++,

-- 
Justin





view thread (111+ messages)  latest in thread

Message-ID: <20200920224446.GF30557@telsasoft.com>
Permalink:  ../20200920224446.GF30557@telsasoft.com/
Also on:    postgresql.org/message-id/20200920224446.GF30557@telsasoft.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, tgl@sss.pgh.pa.us, hlinnaka@iki.fi, x4mmm@yandex-team.ru, me@komzpa.net, pashkin.elfe@gmail.com, thomas.munro@gmail.com, michael@paquier.xyz, a.korotkov@postgrespro.ru
  Subject: Re: Yet another fast GiST build
  In-Reply-To: <20200920224446.GF30557@telsasoft.com>

* 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