Skip to content

Conversation

cbandy
Copy link
Member

@cbandy cbandy commented Sep 29, 2025

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?

Data directories created by PostgresCluster have checksums enabled, so existing tests exercise the logic that invokes initdb with the --data-checksums argument.

Type of Changes:

  • New feature
  • Bug fix

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

A data directory without checksums enabled fails during pg_upgrade.

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

  • Breaking change (fix or feature that would cause existing functionality to change)

PGUpgrade can upgrade a data directory that does not have checksums enabled.

Other Information:

This can happen when a data directory is imported from an external system.

Issue: PGO-619

This can happen when a data directory is imported from an external system.

Issue: PGO-619

`section 'Step 3 of 7: Initializing new data directory...'`,
`PGDATA="${new_data}" "${new_bin}/initdb" --allow-group-access --data-checksums` + argEncryptionKeyCommand,
`PGDATA="${new_data}" "${new_bin}/initdb" --allow-group-access ${checksums:+--data-checksums}` + argEncryptionKeyCommand,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok, if checksum == 0, we drop the --data-checksums flag.

Looks like this flag is enabled by default in PG 18: https://www.postgresql.org/docs/18/app-initdb.html#APP-INITDB-DATA-CHECKSUMS (but not in PG 17 or earlier -- according to the docs)

Copy link
Member Author

Choose a reason for hiding this comment

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

🔧 Good find. I'll update this for PG 18.

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