Skip to content

qa: Add a shutdown timeout for postgres services

The default timeout of 30 seconds, as set in the bitnami charts, seem not well integrated with the shudown sequence for PostgreSQL + k8s. This proposed change increases it to 60 seconds.

The shutdown sequence of Postgres needs to be well integrated with the service shutdown sequence of k8s

Quoting the Postgres docs:

When managing the server directly, you can control the type
of shutdown by sending different signals to the postgres process:

SIGTERM
This is the Smart Shutdown mode. After receiving SIGTERM, the server disallows new connections, but lets existing sessions end their work normally. It shuts down only after all of the sessions terminate. If the server is in recovery when a smart shutdown is requested, recovery and streaming replication will be stopped only after all regular sessions have terminated.

SIGINT
This is the Fast Shutdown mode. The server disallows new connections and sends all existing server processes SIGTERM, which will cause them to abort their current transactions and exit promptly. It then waits for all server processes to exit and finally shuts down.

SIGQUIT
This is the Immediate Shutdown mode. The server will send SIGQUIT to all child processes and wait for them to terminate. If any do not terminate within 5 seconds, they will be sent SIGKILL. The supervisor server process exits as soon as all child processes have exited, without doing normal database shutdown processing. This will lead to recovery (by replaying the WAL log) upon next start-up. This is recommended only in emergencies.

Signed-off-by: Ritesh Raj Sarraf ritesh.sarraf@collabora.com

Merge request reports