Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider pg_ctl successful when progress is made #4038

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cbandy
Copy link
Member

@cbandy cbandy commented Nov 25, 2024

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • Bug fix

What is the current behavior (link to any open issues here)?

When the WAL immediately after a full backup contains configuration changes on Postgres 13 or earlier, restoring from that backup may retry unnecessarily.

What is the new behavior (if this is a feature change)?

The restore job detects the race that can occur in Postgres 13, addresses it, and continues.

Other Information:

Issue: PGO-1945

This parameter has been enabled by default since Postgres 10 and is
unlikely to change, but we want the behavior, so we should set it.
There is a race when using pg_ctl start --wait:

 - pg_ctl starts Postgres
 - Postgres begins recovery, detects a parameter requires restart, and exits
 - pg_ctl reports that Postgres did not start

Now we look at the LSN reported by pg_controldata to determine if Postgres
made any progress during a "failed" start.

Issue: PGO-1945
Having these lines broken into string slices allows for Go comments that
explain them without presenting those comments in YAML at runtime.

This also:

 - Uses the postgres.ParameterSet type to accumulate Postgres settings.
   A new String method renders those values safely for use in postgresql.conf.

 - Disables localization using LC_ALL=C in calls to pg_controldata
   before we parse its output.

 - Removes commands to change permissions on tablespace directories;
   pgBackRest handles this for us now.

 - Passes command line parameters to Postgres using "-c" rather than "--"
   long flags. Both work on Linux, but the former works on all systems.

 - Explains why we need a large timeout for "pg_ctl --wait" and configures
   it once using the PGCTLTIMEOUT environment variable.
Copy link
Contributor

@benjaminjb benjaminjb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked about this in meeting, LGTM, with that question about what branches we're going to put what commits in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants