Choose synchronous nodes based on replication lag (#1786)

This commit makes it possible to configure the maximum lag (`maximum_lag_on_syncnode`) after which Patroni will "demote" the node from synchronous and replace it with another node.

The previous implementation always tried to stick to the same synchronous nodes (even if they are not optimal ones).
This commit is contained in:
krishna
2021-02-02 15:45:02 +01:00
committed by GitHub
parent 9d7d4423e3
commit b3dc765e6d
9 changed files with 92 additions and 23 deletions
+2
View File
@@ -194,6 +194,8 @@ class PatroniController(AbstractController):
if custom_config is not None:
self.recursive_update(config, custom_config)
self.recursive_update(config, {
'bootstrap': {'dcs': {'postgresql': {'parameters': {'wal_keep_segments': 100}}}}})
if config['postgresql'].get('callbacks', {}).get('on_role_change'):
config['postgresql']['callbacks']['on_role_change'] += ' ' + str(self.__PORT)