mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-29 17:09:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e754e0927e | ||
|
|
4a91063c82 | ||
|
|
9e545a95b4 | ||
|
|
168c361e59 | ||
|
|
200412fbba | ||
|
|
be187460f4 | ||
|
|
86420e20b4 | ||
|
|
dfd44628a6 | ||
|
|
02698acd69 |
+2
-2
@@ -300,8 +300,8 @@ class RestApiHandler(BaseHTTPRequestHandler):
|
||||
members = [m for m in cluster.members if m.name != cluster.leader.name and m.api_url]
|
||||
if not members:
|
||||
return 'failover is not possible: cluster does not have members except leader'
|
||||
for st in self.server.patroni.ha.fetch_nodes_statuses(members):
|
||||
if st.failover_limitation() is None:
|
||||
for _, reachable, _, _, tags in self.server.patroni.ha.fetch_nodes_statuses(members):
|
||||
if reachable and not tags.get('nofailover', False):
|
||||
return None
|
||||
return 'failover is not possible: no good candidates have been found'
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ class _MemberStatus(namedtuple('_MemberStatus', 'member,reachable,in_recovery,wa
|
||||
in_recovery - `!True` if pg_is_in_recovery() == true
|
||||
wal_position - value of `replayed_location` or `location` from JSON, dependin on its role.
|
||||
tags - dictionary with values of different tags (i.e. nofailover)
|
||||
watchdog_failed - indicates that watchdog is required by configuration but not available or failed
|
||||
"""
|
||||
@classmethod
|
||||
def from_api_response(cls, member, json):
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
__version__ = '1.3.1'
|
||||
__version__ = '1.3'
|
||||
|
||||
+2
-3
@@ -6,7 +6,6 @@ import unittest
|
||||
from mock import Mock, patch
|
||||
from patroni.api import RestApiHandler, RestApiServer
|
||||
from patroni.dcs import ClusterConfig, Member
|
||||
from patroni.ha import _MemberStatus
|
||||
from patroni.utils import tzutc
|
||||
from six import BytesIO as IO
|
||||
from six.moves import BaseHTTPServer
|
||||
@@ -39,7 +38,7 @@ class MockPostgresql(object):
|
||||
|
||||
|
||||
class MockWatchdog(object):
|
||||
is_healthy = False
|
||||
is_healthy = True
|
||||
|
||||
|
||||
class MockHa(object):
|
||||
@@ -65,7 +64,7 @@ class MockHa(object):
|
||||
|
||||
@staticmethod
|
||||
def fetch_nodes_statuses(members):
|
||||
return [_MemberStatus(None, True, None, None, {}, False)]
|
||||
return [[None, True, None, None, {}]]
|
||||
|
||||
@staticmethod
|
||||
def schedule_future_restart(data):
|
||||
|
||||
@@ -135,7 +135,6 @@ class TestWatchdog(unittest.TestCase):
|
||||
self.assertIsNone(wd.disable())
|
||||
self.assertIsNone(wd.keepalive())
|
||||
|
||||
@patch('platform.system', Mock(return_value='Linux'))
|
||||
def test_config_reload(self):
|
||||
watchdog = Watchdog({'ttl': 30, 'loop_wait': 15, 'watchdog': {'mode': 'required'}})
|
||||
self.assertTrue(watchdog.activate())
|
||||
|
||||
Reference in New Issue
Block a user