Closed Aqualie closed 3 years ago
pg_restore: dropping DATABASE postgres
Why is it trying to drop postgres database? Have you dropped and re-created it?
I have no idea I'm just running the upgrade script I'm not doing anything else. I haven't touched the postgres database since I deployed spilo long time ago.
Maybe there is something special about this cluster? Could you please show the content of postgres.yml file and the patronictl show-config
output?
I don't remember creating this cluster with any special configs/options, output below.
kc exec -t postgres-0 -- patronictl show-config
loop_wait: 10
maximum_lag_on_failover: 1048576
pause: false
postgresql:
parameters:
archive_mode: 'on'
archive_timeout: 1800s
autovacuum_analyze_scale_factor: 0.02
autovacuum_max_workers: 5
autovacuum_vacuum_scale_factor: 0.05
checkpoint_completion_target: 0.9
hot_standby: 'on'
log_autovacuum_min_duration: 0
log_checkpoints: 'on'
log_connections: 'on'
log_disconnections: 'on'
log_line_prefix: '%t [%p]: [%l-1] %c %x %d %u %a %h '
log_lock_waits: 'on'
log_min_duration_statement: 500
log_statement: ddl
log_temp_files: 0
max_connections: 100
max_replication_slots: 10
max_wal_senders: 10
tcp_keepalives_idle: 900
tcp_keepalives_interval: 100
track_functions: all
wal_keep_segments: 8
wal_level: hot_standby
wal_log_hints: 'on'
use_pg_rewind: true
use_slots: true
retry_timeout: 10
ttl: 30
kubectl exec -t postgres-0 -- cat /home/postgres/postgres.yml
bootstrap:
dcs:
loop_wait: 10
maximum_lag_on_failover: 33554432
postgresql:
parameters:
archive_mode: 'on'
archive_timeout: 1800s
autovacuum_analyze_scale_factor: 0.02
autovacuum_max_workers: 5
autovacuum_vacuum_scale_factor: 0.05
checkpoint_completion_target: 0.9
hot_standby: 'on'
log_autovacuum_min_duration: 0
log_checkpoints: 'on'
log_connections: 'on'
log_disconnections: 'on'
log_line_prefix: '%t [%p]: [%l-1] %c %x %d %u %a %h '
log_lock_waits: 'on'
log_min_duration_statement: 500
log_statement: ddl
log_temp_files: 0
max_connections: 100
max_replication_slots: 10
max_wal_senders: 10
tcp_keepalives_idle: 900
tcp_keepalives_interval: 100
track_functions: all
wal_level: hot_standby
wal_log_hints: 'on'
use_pg_rewind: true
use_slots: true
retry_timeout: 10
ttl: 30
initdb:
- auth-host: md5
- auth-local: trust
post_init: /scripts/post_init.sh "zalandos"
users:
admin:
options:
- createrole
- createdb
password: REPLACED
kubernetes:
bypass_api_service: true
labels:
app: postgres
pod_ip: REPLACED
ports:
- name: postgresql
port: 5432
role_label: role
scope_label: spilo-cluster
use_endpoints: true
namespace: database
postgresql:
authentication:
replication:
password: REPLACED
username: repluser
superuser:
password: REPLACED
username: postgres
basebackup_fast_xlog:
command: /scripts/basebackup.sh
retries: 2
bin_dir: /usr/lib/postgresql/12/bin
callbacks:
on_role_change: /scripts/on_role_change.sh zalandos true
connect_address: REPLACED:5432
create_replica_method:
- basebackup_fast_xlog
data_dir: /home/postgres/pgdata/pgroot/data
listen: '*:5432'
name: postgres-0
parameters:
archive_command: /bin/true
bg_mon.history_buckets: 120
bg_mon.listen_address: 0.0.0.0
extwlist.custom_path: /scripts
extwlist.extensions: btree_gin,btree_gist,citext,hstore,intarray,ltree,pgcrypto,pgq,pg_trgm,postgres_fdw,tablefunc,uuid-ossp,hypopg,timescaledb,pg_partman
log_destination: csvlog
log_directory: ../pg_log
log_file_mode: '0644'
log_filename: postgresql-%u.log
log_rotation_age: 1d
log_truncate_on_rotation: 'on'
logging_collector: 'on'
pg_stat_statements.track_utility: 'off'
shared_buffers: 188MB
shared_preload_libraries: bg_mon,pg_stat_statements,pgextwlist,pg_auth_mon,set_user,timescaledb,pg_cron,pg_stat_kcache
ssl: 'on'
ssl_cert_file: /run/certs/server.crt
ssl_key_file: /run/certs/server.key
pg_hba:
- local all all trust
- hostssl all +zalandos 127.0.0.1/32 pam
- host all all 127.0.0.1/32 md5
- hostssl all +zalandos ::1/128 pam
- host all all ::1/128 md5
- hostssl replication repluser all md5
- hostnossl all all all reject
- hostssl all +zalandos all pam
- hostssl all all all md5
pgpass: /run/postgresql/pgpass
use_unix_socket: true
restapi:
connect_address: REPLACED:8008
listen: :8008
scope: postgres
Yes, interesting. I suspect that bg_mon could be a culprit. https://github.com/zalando/spilo/pull/553 contains a possible fix.
Got it let me switch to this tree and give it a try. I'll update with my results soon.
Upgrade completed successfully no issues and everything is running 👌
Having issues with this script trying to upgrade from 12 to 13:
postgres@postgres-0:~/pgdata/pgroot$ patronictl list
postgres@postgres-0:~/pgdata/pgroot$ python3 /scripts/inplace_upgrade.py 3
pg_upgrade_dump_13398.log
postgres-# from pg_stat_activity where datname='postgres';