enable replication support slot management via hiera - #1693
Closed
ikonia wants to merge 1614 commits into
Closed
Conversation
Prefer $connect_settings over explicit parameters
…e_title service name should be unique to allow instances
…ce_titles unique resource titles to allow multiple instances
server::schema: Drop unused $version variable
…parameters variables to parameters for tablespace/schema/reassign_owned_by
PDK update 2.7.0->3.0.0
server::instance::initdb: simplify if condition
spec file: remove ruby shebang
…ters add port and psql_path parameter to initdb define
…encryption_in_pg_hba_conf Flexible password encryption in pg hba conf
spec file: remove ruby shebang
…encryption Fix password_encryption for DBVERSION in server::role
…x_parameter add $manage_selinux as a parameter, keep default, simpler condition
Only EL6 used sysvinit, but that's no longer supported by the module.
Drop code compatibility for non-systemd Red Hat
Cherry-picked from puppetlabs#1514 both FreeBSD versions are EoL since a long time and not listed in metadata.json anymore. We can drop them.
Drop EoL FreeBSD 9.4/9.5 specific code
add EL10 basic support - align EL10 PGSQL 16 default package version
Co-authored-by: GitHub Actions <puppetlabs@users.noreply.github.com>
10.6.2 (PR puppetlabs#1646, "CAT-2385 Puppetcore update") bumped .rubocop.yml TargetRubyVersion to 3.1, so `rubocop -A` rewrote hash literals to Ruby 3.1 shorthand (`salt:` instead of `salt: salt`) in three custom functions/providers. That shorthand is a hard syntax error on Ruby < 3.1, and Puppet 7 ships Ruby 2.7 -- so any Puppet 7 catalog using postgresql::postgresql_password, postgresql_conf or postgresql_replication_slot failed to compile with "syntax error, unexpected ','" (issue puppetlabs#1685). Fix the Ruby side so existing Puppet 7 installations keep working: - .rubocop.yml: TargetRubyVersion back to '2.6' so autocorrect can't reintroduce the shorthand. - Revert the Ruby 3.1 shorthand hash syntax in the three lib files (keeping the unrelated postgresql_conf entry_regex bugfix from puppetlabs#1657). - Revert the same shorthand autocorrection in four spec files so they parse under the 2.6 target. Verified with `pdk validate`, the full unit suite (685 examples, 0 failures), and Litmus end-to-end applies on both Puppet 7.34/Ruby 2.7 and Puppet 8.10/Ruby 3.2 (install, idempotency, and a SCRAM-SHA-256 password hash stored in the live database). Fixes puppetlabs#1685 Co-Authored-By: Claude <noreply@anthropic.com>
…ore-puppet7 (MODULES-11858) Restore Puppet 7 support broken by 10.6.2
Release prep v10.6.3
Generate postgresql::server::database resources from a $databases hash, mirroring the existing $roles/$grants pattern. Carried forward from be (3940f30/a30df35) during resync onto upstream/main.
Generate postgresql::server::grant_role resources from a $grant_roles hash. Declaring grant_role from inside class postgresql::server means its own Class['postgresql::server'] -> Postgresql_psql[...] ordering edge (used when connect_settings is empty) now cycles back on itself, so drop that edge here; the Postgresql::Server::Role ordering below is unaffected and still applies when the role is known. Carried forward from be (payload of 3a24f48 + 9527c31) during resync onto upstream/main.
Generate postgresql::server::extension resources from an $extensions
hash keyed by database name, auto-creating the database first if it
isn't already declared. Resources are titled "${database}:${extension}"
to keep titles unique across databases, so extension.pp's $extension
default now parses the extension name back out of that title instead
of assuming $name is the bare extension name.
Carried forward from be (payload of c55d2fc + 9bd9595 + 1b16edc)
during resync onto upstream/main.
The unless clause's SQL query didn't quote the role name, causing server-side errors when the role name contains a character like a hyphen (e.g. "monitoring-user"). Carried forward from be (70edc1b, originally from antaflos/fix_default_privileges_quoting) during resync onto upstream/main. Not yet present in upstream/main.
PostgreSQL has ignored recovery.conf since v12, but this module has never accounted for that: postgresql::server::recovery always wrote a recovery.conf-style file regardless of PostgreSQL version. Gate the define on versioncmp($postgresql::server::_version, '12'): - < 12 keeps the existing concat + recovery.conf.epp behavior, byte-for-byte unchanged, so existing hand-declared usages on older hosts are unaffected. - >= 12 instead creates an empty standby.signal marker file and writes primary_conninfo/primary_slot_name/restore_command/etc. as ordinary postgresql.conf GUCs via postgresql::server::config_entry, ordered to land before the instance's first service start (these are startup-only settings a reload cannot apply). Adds promote_trigger_file and recovery_target_action (their PG12+ replacements for trigger_file and pause_at_recovery_target); the legacy-only params are still accepted with a warning for a softer migration path. Also adds a new $standby hash parameter on postgresql::server (with a Postgresql::Standby type alias) so standby/recovery configuration is finally reachable from a single Hiera key, the same way roles, pg_hba_rules and config_entries already are -- previously postgresql::server::recovery had no hash-of-resources wrapper at all and could only be hand-declared in a manifest. Replication slot creation on the primary (postgresql_replication_slot) is a separate, still-unreachable-from-Hiera gap and is intentionally out of scope here.
postgresql::server::recovery still notified the pre-multi-instance Class['postgresql::server::reload'] token. Every sibling resource (pg_hba, pg_ident, config_entry) was migrated to the instance-scoped Postgresql::Server::Instance::Reload['main'] during the 2023 multi-instance refactor; this define was missed. Unrelated to the PG12+ standby-config work in the preceding commit.
The describe block named postgresql_replication_slot, but its subject instantiated Puppet::Type.type(:postgresql_psql) instead, so it never actually exercised this type. Point subject at the right type and add coverage for name validation and ensurable.
Generates postgresql_replication_slot resources from a $replication_slots hash, so a primary can Hiera-drive the named physical replication slots that a standby's primary_slot_name (postgresql::server::recovery/$standby) connects through. Mirrors the existing $grant_roles pattern: a single-level hash splatted straight onto the resource, since the native type has nothing beyond name/ensure to wrap. Deliberately not extending the native postgresql_replication_slot type or provider here: it has no port/psql_path/connect_settings, unlike every sibling resource, so this only supports the default instance. That only matters for multi-instance-per-host deployments; fixing it also requires redesigning self.instances/prefetch, which currently lists slots via a single connection-oblivious psql call. Left as a documented limitation rather than scope for this change.
ikonia
requested review from
a team,
SimonHoenscheid,
alexjfisher,
bastelfreak,
deric,
ekohl and
smortex
as code owners
August 12, 2026 12:30
|
GitHub Actions seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
corporate-gadfly
suggested changes
Aug 12, 2026
Co-authored-by: Corporate Gadfly <corporate-gadfly@users.noreply.github.com>
ikonia
force-pushed
the
be-pg12-standby
branch
from
August 13, 2026 09:20
ebd1b83 to
998ed80
Compare
Contributor
Author
|
messed up the repo trying to fix a commit error will re-submit from a correctly formatted repo, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
the branch is rebased from master as of 12/08/2026 and includes a few outstanding PR's to get the functionality needed.
enables replication support for Postgres r
Adds primary-side named replication slot management to postgresql::server closing the last gap in this branch's physical streaming replication support: a standby configured via postgresql::server::recovery
postgresql::server::recovery primary_slot_name had nothing on the primary side to actually create the slot it connects to.
Previously this required hand-declaring the native postgresql_replication_slot resource directly in a manifest; it's now Hiera-drivable the same way databases/roles/grant_roles/extensions already are.
Validated end-to-end against a real PostgreSQL 18 master/replica pair
postgresql::server::replication_slots (new hash parameter)
Testing
Additional Context
Add any additional context about the problem here.
Related Issues (if any)
this branch and merge contains open PR's already merged in
#1661
#1674
Checklist
puppet apply)