From 83662f71cba6c3af3fe7e6bdcbf1346585a3fc24 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Fri, 16 Oct 2015 16:38:05 +0200 Subject: [PATCH] Exit right away if the node sysid is different from the cluster's one --- patroni/ha.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patroni/ha.py b/patroni/ha.py index 82921a74..283d3678 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -2,6 +2,7 @@ import json import logging import psycopg2 import requests +import sys from patroni.async_executor import AsyncExecutor from patroni.exceptions import DCSError, PostgresConnectionException @@ -383,7 +384,8 @@ class Ha: else: # check if we are allowed to join if self.sysid_valid(self.cluster.initialize) and self.cluster.initialize != self.state_handler.sysid: - return "system ID mismatch, node {0} belongs to a different cluster".format(self.state_handler.name) + logger.fatal("system ID mismatch, node {0} belongs to a different cluster".format(self.state_handler.name)) + sys.exit(1) # try to start dead postgres if not self.state_handler.is_healthy():