pgsql: Use CREATE DATABASE ... STRATEGY = FILE_COPY in pg_upgrade.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use CREATE DATABASE ... STRATEGY = FILE_COPY in pg_upgrade.
Date: 2024-07-08 21:19:49
Message-ID: E1sQvm1-000twG-P3@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use CREATE DATABASE ... STRATEGY = FILE_COPY in pg_upgrade.

While this strategy is ordinarily quite costly because it requires
performing two checkpoints, testing shows that it tends to be a
faster choice than WAL_LOG during pg_upgrade, presumably because
fsync is turned off. Furthermore, we can skip the checkpoints
altogether because the problems they are intended to prevent don't
apply to pg_upgrade. Instead, we just need to CHECKPOINT once in
the new cluster after making any changes to template0 and before
restoring the rest of the databases. This ensures that said
template0 changes are written out to disk prior to creating the
databases via FILE_COPY.

Co-authored-by: Matthias van de Meent
Reviewed-by: Ranier Vilela, Dilip Kumar, Robert Haas, Michael Paquier
Discussion: https://postgr.es/m/Zl9ta3FtgdjizkJ5%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/64f34eb2e2ce4bca7351d8c88a6999aeed000c4a

Modified Files
--------------
src/backend/commands/dbcommands.c | 18 +++++++++++++++---
src/bin/pg_dump/pg_dump.c | 8 +++++++-
src/bin/pg_upgrade/pg_upgrade.c | 12 ++++++++++++
3 files changed, 34 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2024-07-08 21:36:01 pgsql: Symlink pg_replslot robustly on Windows in pg_basebackup test
Previous Message Andrew Dunstan 2024-07-08 20:14:05 pgsql: Choose ports for test servers less likely to result in conflicts