Merge ~arturo-seijas/postgresql-charm:fix-unknown-option-wal-keep-segments into postgresql-charm:master

Proposed by Arturo Enrique Seijas Fernández
Status: Merged
Approved by: Tom Haddon
Approved revision: 5d3809d92c1402bf85894aef4413bba2b328c190
Merged at revision: f95c875da4280b477a97c0e1f86911d2ba69c0f7
Proposed branch: ~arturo-seijas/postgresql-charm:fix-unknown-option-wal-keep-segments
Merge into: postgresql-charm:master
Diff against target: 45 lines (+10/-9)
1 file modified
reactive/postgresql/service.py (+10/-9)
Reviewer Review Type Date Requested Status
Tom Haddon Approve
Canonical IS Reviewers Pending
Review via email: mp+440226@code.launchpad.net

Commit message

Fix unknown option was_keep_segments in Jammy

Description of the change

was_keep_segments and replicated_wal_keep_segments have been renamed to wal_keep_size and replicated_wal_keep_size and in PostgreSQL 14

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Tom Haddon (mthaddon) wrote :

I'd be surprised if this works - you're referencing `config["replicated_wal_keep_size"]` but I don't see that as a config option (in `config.yaml`) - only `replicated_wal_keep_segments`.

Can you test and confirm?

Revision history for this message
Tom Haddon (mthaddon) wrote :

LGTM, thx

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision f95c875da4280b477a97c0e1f86911d2ba69c0f7

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/reactive/postgresql/service.py b/reactive/postgresql/service.py
index d42cbbf..d1a7f62 100644
--- a/reactive/postgresql/service.py
+++ b/reactive/postgresql/service.py
@@ -20,22 +20,16 @@ import subprocess
20import textwrap20import textwrap
21import time21import time
2222
23import context
23import yaml24import yaml
24
25from charmhelpers.core import hookenv, host, sysctl, templating, unitdata25from charmhelpers.core import hookenv, host, sysctl, templating, unitdata
26from charmhelpers.core.hookenv import DEBUG, WARNING26from charmhelpers.core.hookenv import DEBUG, WARNING
27from charms import apt, coordinator, reactive27from charms import apt, coordinator, reactive
28from charms.reactive import hook, when, when_any, when_not28from charms.reactive import hook, when, when_any, when_not
29
30import context
31from everyhook import everyhook29from everyhook import everyhook
3230
31from reactive.postgresql import helpers, nagios, postgresql, replication, wal_e
33from reactive.workloadstatus import status_set32from reactive.workloadstatus import status_set
34from reactive.postgresql import helpers
35from reactive.postgresql import nagios
36from reactive.postgresql import postgresql
37from reactive.postgresql import replication
38from reactive.postgresql import wal_e
3933
4034
41@hook("install")35@hook("install")
@@ -732,7 +726,14 @@ def ensure_viable_postgresql_conf(opts):
732726
733 # Having two config options for the one setting is confusing. Perhaps727 # Having two config options for the one setting is confusing. Perhaps
734 # we should deprecate this.728 # we should deprecate this.
735 if num_standbys and (int(config["replicated_wal_keep_segments"]) > int(opts.get("wal_keep_segments", 0))):729 # PostgreSQL 14 renames wal_keep_segments to wal_keep_size and
730 # replicated_wal_keep_segments to replicated_wal_keep_size.
731 # Note that for version 14 the charm does not set a default for these configs.
732 if (
733 not postgresql.has_version("14")
734 and num_standbys
735 and (int(config["replicated_wal_keep_segments"]) > int(opts.get("wal_keep_segments", 0)))
736 ):
736 force(wal_keep_segments=config["replicated_wal_keep_segments"])737 force(wal_keep_segments=config["replicated_wal_keep_segments"])
737738
738 # Log shipping with WAL-E.739 # Log shipping with WAL-E.

Subscribers

People subscribed via source and target branches