zalando / patroni

A template for PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

load available_parameters/0_postgres.yml failed silently when package using zipapp

waynerv opened this issue · comments

What happened?

In some cases I use zipapp to distribute patroni package. After upgrading to the new version, I found that pg10/11 cannot properly init standby servers.
After some research, I found default validator rule files under postgresql/available_parameters directory failed to load, causing the recovery parameters in recovery.conf to be removed abnormally.

read package data files using __file__ is fragile, I think using Python's import system to locate data files is more robust and reliable. I have implemented a patch using importlib_resources (for better compatibility than std importlib).

How can we reproduce it (as minimally and precisely as possible)?

use zip archives to distribute patroni (zipapp or zipfile).

What did you expect to happen?

Patroni/PostgreSQL/DCS version

  • Patroni version: 3.2.2
  • PostgreSQL version: 10
  • DCS (and its version):

Patroni configuration file

-

patronictl show-config

-

Patroni log files

2024-02-02 10:00:12,123 INFO: Lock owner: postgres-3dfb502f-0-0; I am postgres-3dfb502f-1-0
2024-02-02 10:00:12,132 INFO: Reaped pid=3958, exit status=0
2024-02-02 10:00:12,135 INFO: Reaped pid=3959, exit status=0
2024-02-02 10:00:12,135 INFO: Local timeline=1 lsn=0/4000028
2024-02-02 10:00:12,157 INFO: primary_timeline=1
2024-02-02 10:00:12,158 INFO: Lock owner: postgres-3dfb502f-0-0; I am postgres-3dfb502f-1-0
2024-02-02 10:00:12,158 INFO: starting as a secondary
2024-02-02 10:00:12,160 WARNING: Removing unexpected parameter=primary_slot_name value=postgres_3dfb502f_1_0 from the config
2024-02-02 10:00:12,160 WARNING: Removing unexpected parameter=recovery_target_timeline value=latest from the config
2024-02-02 10:00:12,160 WARNING: Removing unexpected parameter=restore_command value=/home/postgres/bin/pre_failover_restore.sh && pgbackrest archive-get --archive-async=y --process-max=2 --archive-get-queue-max=1GiB %f "%p" from the config
2024-02-02 10:00:12,160 WARNING: Removing unexpected parameter=standby_mode value=on from the config
2024-02-02 10:00:12,165 WARNING: Removing unexpected parameter=jit value=False from the config
2024-02-02 10:00:12.781 CST [3967] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-02-02 10:00:12.782 CST [3967] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2024-02-02 10:00:12,791 INFO: postmaster pid=3967
2024-02-02 10:00:12.815 CST [3967] LOG:  redirecting log output to logging collector process
2024-02-02 10:00:12.815 CST [3967] HINT:  Future log output will appear in directory "/pglog".
/tmp:5432 - rejecting connections
/tmp:5432 - no response
2024-02-02 10:00:22,110 INFO: Lock owner: postgres-3dfb502f-0-0; I am postgres-3dfb502f-1-0
2024-02-02 10:00:22,111 INFO: failed to start postgres
2024-02-02 10:00:32,106 WARNING: Postgresql is not running.

PostgreSQL log files

-

Have you tried to use GitHub issue search?

  • Yes

Anything else we need to know?

No response