]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Add table relcache invalidation to index builds.
authorPeter Geoghegan <pg@bowt.ie>
Fri, 3 Aug 2018 21:44:33 +0000 (14:44 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Fri, 3 Aug 2018 21:44:33 +0000 (14:44 -0700)
commit250528cec09fa56c27915b5a18ec8fae37c2b447
treed15d6ea77c7b4c2312c083dd6db9b6198bd8714a
parent12dd070081de931a45af42bbdacc65ff0f8066eb
Add table relcache invalidation to index builds.

It's necessary to make sure that owning tables have a relcache
invalidation prior to advancing the command counter to make
newly-entered catalog tuples for the index visible.  inval.c must be
able to maintain the consistency of the local caches in the event of
transaction abort.  There is usually only a problem when CREATE INDEX
transactions abort, since there is a generic invalidation once we reach
index_update_stats().

This bug is of long standing.  Problems were made much more likely by
the addition of parallel CREATE INDEX (commit 9da0cc35284), but it is
strongly suspected that similar problems can be triggered without
involving plan_create_index_workers().  (plan_create_index_workers()
triggers a relcache build or rebuild, which previously only happened in
rare edge cases.)

Author: Peter Geoghegan
Reported-By: Luca Ferrari
Diagnosed-By: Andres Freund
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CAKoxK+5fVodiCtMsXKV_1YAKXbzwSfp7DgDqUmcUAzeAhf=HEQ@mail.gmail.com
Backpatch: 9.3-
src/backend/catalog/index.c