Base de données relationnelle
Find a file
Alexander Korotkov fa6f2f624c Rework ginScanToDelete() to pass Buffers instead of BlockNumbers.
Previously, ginScanToDelete() and ginDeletePage() passed BlockNumbers and
re-read pages that were already pinned and locked during the tree walk.  The
caller ginVacuumPostingTree()) held a cleanup-locked root buffer, yet
ginScanToDelete() re-read it by block number with special-case code to skip
re-locking.

At first, this commit gives both functions more appropriate names,
ginScanPostingTreeToDelete() and ginDeletePostingPage(), indicating they deal
with posting trees/pages.  This is more descriptive and similar to the way we
name other GIN functions, for instance, ginVacuumPostingTree() and
ginVacuumPostingTreeLeaves().

Then rework both functions to pass Buffers directly.  DataPageDeleteStack now
carries buffer, myoff (downlink offset in parent), and isRoot per level,
so ginScanPostingTreeToDelete() takes only GinVacuumState and
DataPageDeleteStack pointers.  Also, ginDeletePostingPage() receives the three
Buffers directly, and no longer reads or releases them itself.  The caller
reads and locks child pages before recursing, and manages buffer lifecycle
afterward.

This eliminates the confusing isRoot special cases in buffer management,
including the apparent (but unreachable) double release of the root
buffer identified by Andres Freund.

Add comments explaining the locking protocol and the DataPageDeleteStack
structure.

Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/utrlxij43fbguzw4kldte2spc4btoldizutcqyrfakqnbrp3ir@ph3sphpj4asz
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Jinbinge <jinbinge@126.com>
2026-03-13 13:50:13 +02:00
.github
config Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
contrib xml2: Fix failure with xslt_process() under -fsanitize=undefined 2026-03-13 16:06:28 +09:00
doc Document the 'command' column of pg_stat_progress_repack 2026-03-12 19:19:23 +01:00
src Rework ginScanToDelete() to pass Buffers instead of BlockNumbers. 2026-03-13 13:50:13 +02:00
.cirrus.star
.cirrus.tasks.yml Revert "Change default value of default_toast_compression to "lz4"" 2026-03-05 08:25:35 +09:00
.cirrus.yml
.dir-locals.el
.editorconfig
.git-blame-ignore-revs Add commit 7b24959434 to .git-blame-ignore-revs. 2026-03-02 13:23:28 -06:00
.gitattributes
.gitignore
.mailmap
aclocal.m4
configure Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
configure.ac Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
COPYRIGHT Update copyright for 2026 2026-01-01 13:24:10 -05:00
GNUmakefile.in
HISTORY
Makefile Restore AIX support. 2026-02-23 13:34:22 -05:00
meson.build Change copyObject() to use typeof_unqual 2026-03-13 07:06:57 +01:00
meson_options.txt Update copyright for 2026 2026-01-01 13:24:10 -05:00
README.md

PostgreSQL Database Management System

This directory contains the source code distribution of the PostgreSQL database management system.

PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.

Copyright and license information can be found in the file COPYRIGHT.

General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.

The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.