Wait for reload change to complete in patroni configure_context

Reloading patroni issues a PostgreSQL reload, which is asynchronous. And unfortunately Patroni doesn't expose any event or status via its API to ensure that PostgreSQL reload is finished.

To do so we compare that the time of last successful reload of PostgreSQL configuration has changed.

This is important mostly in the case where a restart is required. The restart must happen after the reload is finished otherwise changes won't be taken into account.

In the case of a port change, the retry loop fails at some point because the connection to the instance can't be established after the port is changed in PostgreSQL configuration file (written by Patroni). We handled this case (OperationalError) and leave the retry loop, considering that the reload is effective.

Fixes #518 (closed)

Merge request reports

Loading