agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Initialize read stream before fetching metapage in hash bulk-del
2+ messages / 1 participants
[nested] [flat]

* pgsql: Initialize read stream before fetching metapage in hash bulk-del
@ 2026-08-05 07:57  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-08-05 07:57 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Initialize read stream before fetching metapage in hash bulk-deletion

hashbulkdelete() fetched the relcache's cached hash metapage before
calling read_stream_begin_relation().  During the read stream
initialization, relation lookups may process pending relcache
invalidation messages, which could cause the cached metapage to be
invalidated before the read stream uses it, leading to the failure of a
VACUUM bulk-deletion for a hash index.

This commit reworks the order of hashbulkdelete() so as its read stream
is initialized before fetching the cached metapage, so as pending
invalidation messages do not interfere with the relation scan.

Issue introduced by bfa3c4f106b1.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CADzfLwVEJ2_7ioX3ZSB1P7qXW40ghUy_ZCzeFvhDLoa_3Muztg@mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ca86d7439b1947e97d0d86036f29ebc5cb0397aa

Modified Files
--------------
src/backend/access/hash/hash.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Initialize read stream before fetching metapage in hash bulk-del
@ 2026-08-05 07:57  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2026-08-05 07:57 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Initialize read stream before fetching metapage in hash bulk-deletion

hashbulkdelete() fetched the relcache's cached hash metapage before
calling read_stream_begin_relation().  During the read stream
initialization, relation lookups may process pending relcache
invalidation messages, which could cause the cached metapage to be
invalidated before the read stream uses it, leading to the failure of a
VACUUM bulk-deletion for a hash index.

This commit reworks the order of hashbulkdelete() so as its read stream
is initialized before fetching the cached metapage, so as pending
invalidation messages do not interfere with the relation scan.

Issue introduced by bfa3c4f106b1.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CADzfLwVEJ2_7ioX3ZSB1P7qXW40ghUy_ZCzeFvhDLoa_3Muztg@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0e2fb2c8c307aaee5ab47aa92055b53ca146706b

Modified Files
--------------
src/backend/access/hash/hash.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-08-05 07:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05 07:57 pgsql: Initialize read stream before fetching metapage in hash bulk-del Michael Paquier <michael@paquier.xyz>
2026-08-05 07:57 pgsql: Initialize read stream before fetching metapage in hash bulk-del Michael Paquier <michael@paquier.xyz>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox