pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_upgrade: Move live_check variable to user_opts.
Date: Fri, 26 Jul 2024 18:38:24 +0000
Message-ID: <E1sXPpg-001LLE-Qt@gemulon.postgresql.org> (raw)

pg_upgrade: Move live_check variable to user_opts.

At the moment, pg_upgrade stores whether it is doing a "live check"
(i.e., the user specified --check and the old server is still
running) in a local variable scoped to main().  This live_check
variable is passed to several functions.  To further complicate
matters, a few call sites provide a hard-coded "false" as the
live_check argument.  Specifically, this is done when calling these
functions for the new cluster, for which any live-check-only paths
won't apply.

This commit moves the live_check variable to the global user_opts
variable, which stores information about the options the user
specified on the command line.  This allows us to remove the
live_check parameter from several functions.  For the functions
with callers that provide a hard-coded "false" as the live_check
argument (e.g., get_control_data()), we verify the given cluster is
the old cluster before taking any live-check-only paths.

This small refactoring effort helps simplify some proposed changes
that would parallelize many of pg_upgrade's once-in-each-database
tasks using libpq's asynchronous APIs.  By removing the live_check
parameter, we can more easily convert the functions to callbacks
for the new parallel system.

Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20240516211638.GA1688936%40nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4b56bb4ab4856070d5ea4aeafdd663d8bf96b874

Modified Files
--------------
src/bin/pg_upgrade/check.c       | 30 +++++++++++++++---------------
src/bin/pg_upgrade/controldata.c |  3 ++-
src/bin/pg_upgrade/info.c        | 12 +++++-------
src/bin/pg_upgrade/option.c      |  4 ++--
src/bin/pg_upgrade/pg_upgrade.c  | 21 ++++++++++-----------
src/bin/pg_upgrade/pg_upgrade.h  | 13 +++++++------
6 files changed, 41 insertions(+), 42 deletions(-)



Message-ID: <E1sXPpg-001LLE-Qt@gemulon.postgresql.org>
Permalink:  ../E1sXPpg-001LLE-Qt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sXPpg-001LLE-Qt@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_upgrade: Move live_check variable to user_opts.
  In-Reply-To: <E1sXPpg-001LLE-Qt@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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