patroni.postgresql.postmaster module
- class patroni.postgresql.postmaster.PostmasterProcess(pid: int)
Bases:
Process- classmethod _from_pidfile(data_dir: str) PostmasterProcess | None
- static _read_postmaster_pidfile(data_dir: str) Dict[str, str]
Reads and parses postmaster.pid from the data directory
:returns dictionary of values if successful, empty dictionary otherwise
- classmethod from_pid(pid: int) PostmasterProcess | None
- static from_pidfile(data_dir: str) PostmasterProcess | None
- signal_kill() bool
to suspend and kill postmaster and all children
:returns True if postmaster and children are killed, False if error
- signal_stop(mode: str, pg_ctl: str = 'pg_ctl') bool | None
Signal postmaster process to stop
:returns None if signaled, True if process is already gone, False if error
- static start(pgcommand: str, data_dir: str, conf: str, options: List[str]) PostmasterProcess | None
- wait_for_user_backends_to_close(stop_timeout: float | None) bool | None
Wait for all user backend processes to close before the postmaster shuts down.
Auxiliary/background PostgreSQL processes (archiver, checkpointer, wal senders, logical replication workers, and so on) are identified via their command line and excluded, so that only genuine client backends are awaited.
- Parameters:
stop_timeout – maximum number of seconds to wait for the user backends to close. If
None, wait indefinitely.- Returns:
Trueif there were no user backends or all of them closed in time;Noneif the list of children could not be retrieved or some backends were still alive after stop_timeout.