When a PostgreSQL service is switching to a new master, the old master PostgreSQL process is first gracefully shut down and once it has shut down, the PostgreSQL on the new master node is promoted. The time between the old master being shut down and new master getting promoted depends on the service and certain timing conditions but is typically about 5 seconds and almost always under 10 seconds. When the promotion has been completed, the old master node sets up TCP. The DNS update is done at the same time, but, since there's 15 second TTL the clients couldn't connect for a longer period of time without this TCP forwarding.

Once a sufficient amount of time (currently 60 seconds) has passed, the old master node assumes it is no longer needed and the node is deleted.

Did this answer your question?