From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>, James Coleman <jtc331(at)gmail(dot)com> |
Subject: | Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements |
Date: | 2020-12-04 14:37:20 |
Message-ID: | 20201204143720.GA32678@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.)
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2020-12-04 14:41:21 | Re: Hybrid Hash/Nested Loop joins and caching results from subplans |
Previous Message | Ashutosh Bapat | 2020-12-04 13:42:30 | Re: Single transaction in the tablesync worker? |