| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Avoid torn copy of the control file in base backups |
| Date: | 2026-10-27 23:46:27 |
| Message-ID: | E1xLqs7-000000013Ft-2Kky@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Avoid torn copy of the control file in base backups
Base backups read the control file (pg_control) from disk without any
protection against concurrent writes by the server, making it exposed to
torn copies. Attempting to use such a control file at startup would
cause a failure with a CRC not matching.
Base backups now read the control file while holding ControlFileLock.
c558e6fd92f has done the same for some SQL functions. The contents of
the file are saved in memory and sent over the wire as-is.
Backpatch down to v15. This issue is older than v15 but v14 is left out
of the picture as it is going to be EOL soon, so it does not seem worth
taking a risk for.
Author: David Steele <david(at)pgbackrest(dot)org>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Discussion: https://postgr.es/m/d1697de1-eb7f-41bf-a4b7-bba7203df11f@pgbackrest.org
Backpatch-through: 15
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/316a870654a382d7c91b88f4c0dcc7cbb2f2c0be
Modified Files
--------------
src/backend/backup/basebackup.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2026-10-28 00:25:43 | pgsql: Detect overflows in various numerical aggregate transfns |
| Previous Message | Michael Paquier | 2026-10-27 23:02:29 | pgsql: Extend sendFileWithContent() to handle custom content length in |