0

Is it correct to assume that shutdown mode smart, i.e.

pg_ctlcluster 9.6 main stop

won't work for PostgreSQL standby servers and that I will always have to use shutdown mode fast (or immediate) instead:

pg_ctlcluster 9.6 main stop -m fast

I am assuming so because of this paragrah in pg_ctl(1):

Three different shutdown methods can be selected with the -m option. “Smart” mode waits for all active clients to disconnect and any online backup to finish. If the server is in hot standby, recovery and streaming replication will be terminated once all clients have disconnected. “Fast” mode (the default) does not wait for clients to disconnect and will terminate an online backup in progress. All active transactions are rolled back and clients are forcibly disconnected, then the server is shut down. “Immediate” mode will abort all server processes immediately, without a clean shutdown. This will lead to a crash-recovery run on the next restart.

I am hesitating a bit, because I have been used so far in using fast (or immediate) only in cases of relative emergencies.

0

A WAL receiver is neither an active client, nor an online backup. So a so-called "smart" shutdown executed on the master will not wait indefinitely for the WAL receiver to go away on its own. Rather, it will actively disconnect the WAL receiver. This is pretty much the last thing it does--it waits for the shutdown checkpoint to finish, and streams the WAL containing that checkpoint record over to the replica, and then disconnects it.

If you are concerned about "If the server is in hot standby, recovery and streaming replication will be terminated once all clients have disconnected", that is describing what happens when smart shutdown is initiated against the replica, not against the master. The master is never "in hot standby", that is a status that only a replica can be in.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.