From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: James Coleman <jtc331@gmail.com>
Subject: Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements
Date: Fri, 4 Dec 2020 11:37:20 -0300
Message-ID: <20201204143720.GA32678@alvherre.pgsql> (raw)
In-Reply-To: <20201204113832.yuneqs6t4fhjo6k3@localhost>
On 2020-Dec-04, Dmitry Dolgov wrote:
> * This one is mostly for me to understand. There are couple of places
> with a commentary that 'PROC_IN_SAFE_IC is not necessary, because the
> transaction only takes a snapshot to do some catalog manipulation'.
> But for some of them I don't immediately see in the relevant code
> anything related to snapshots. E.g. one in DefineIndex is followed by
> WaitForOlderSnapshots (which seems to only do waiting, not taking a
> snapshot), index_set_state_flags and CacheInvalidateRelcacheByRelid.
> Is taking a snapshot hidden somewhere there inside?
Well, they're actually going to acquire an Xid, not a snapshot, so the
comment is slightly incorrect; I'll fix it, thanks for pointing that
out. The point stands: because those transactions are of very short
duration (at least of very short duration after the point where the XID
is obtained), it's not necessary to set the PROC_IN_SAFE_IC flag, since
it won't cause any disruption to other processes.
It is possible that I copied the wrong comment in DefineIndex. (I only
noticed that one after I had mulled over the ones in
ReindexRelationConcurrently, each of which is skipping setting the flag
for slightly different reasons.)
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: alvherre@alvh.no-ip.org, 9erthalion6@gmail.com, pgsql-hackers@lists.postgresql.org, michael@paquier.xyz, jtc331@gmail.com
Subject: Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements
In-Reply-To: <20201204143720.GA32678@alvherre.pgsql>
* 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