From 4a730bb34bfc5c7e7b7776f7b2e87ab305b5c104 Mon Sep 17 00:00:00 2001 From: "Aaser, Douglas (da519m)" Date: Tue, 2 Jul 2019 17:32:46 +0000 Subject: [PATCH] Postgres PVC Soak Fix This patch fixes an issue with Postgres HA where the PVC which stores the database was filling up with WAL records and not deleting them due to some misconfigurations with Postgres. Once the PVC would fill up, replication would fail across the node and the database would not be able to start, crashing the system. Specifically, archive_mode was turned on, but was not supplied with a function through which to archive the logs. When WAL archiving is turned on, old WAL files cannot be removed until the system has archived them first. However, since we never told the system how to archive the files, it would repeatedly fail so the WAL files would never be cleaned up. Also in this patch are some small house keeping items: - Lowered the wal_keep_segments drastically so Postgres can't keep as many WAL segments around to minimize the chance of PVC fill issues - Turned the wal_level from 'logical' to 'hot_standby' to keep it consistent with the fact that Patroni uses streaming replication and not logical replication - Removed the autovaccuum configurations as they are not needed Change-Id: Id48c3ee9976823b2bdb4395a029fe75476bdaa62 --- postgresql/values.yaml | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/postgresql/values.yaml b/postgresql/values.yaml index fff14d8d9..796ac3d1e 100644 --- a/postgresql/values.yaml +++ b/postgresql/values.yaml @@ -238,11 +238,7 @@ conf: pgpass: '{{ .Values.storage.mount.path }}/pgpass' use_pg_rewind: true parameters: - archive_mode: 'on' - archive_timeout: 1800s - autovacuum_analyze_scale_factor: 0.02 - autovacuum_max_workers: 5 - autovacuum_vacuum_scale_factor: 0.05 + archive_mode: 'off' checkpoint_completion_target: 0.9 datestyle: 'iso, mdy' default_text_search_config: 'pg_catalog.english' @@ -271,8 +267,8 @@ conf: timezone: 'UTC' track_commit_timestamp: 'on' track_functions: all - wal_keep_segments: 100 - wal_level: 'logical' + wal_keep_segments: 8 + wal_level: hot_standby wal_log_hints: 'on' initdb: - auth-host: md5 @@ -300,11 +296,7 @@ conf: on_start: /tmp/set_password.sh use_pg_rewind: true parameters: - archive_mode: 'on' - archive_timeout: 1800s - autovacuum_analyze_scale_factor: 0.02 - autovacuum_max_workers: 5 - autovacuum_vacuum_scale_factor: 0.05 + archive_mode: 'off' checkpoint_completion_target: 0.9 datestyle: 'iso, mdy' default_text_search_config: 'pg_catalog.english' @@ -333,9 +325,8 @@ conf: timezone: 'UTC' track_commit_timestamp: 'on' track_functions: all - shared_buffers: {{ .Values.conf.postgresql.shared_buffers }} - wal_keep_segments: 100 - wal_level: 'logical' + wal_keep_segments: 8 + wal_level: hot_standby wal_log_hints: 'on' pg_hba: - host all all 127.0.0.1/32 trust