Retry on raft internal error (#1241)

Fixes https://github.com/zalando/patroni/issues/1237
This commit is contained in:
Alexander Kukushkin
2019-10-22 17:20:06 +02:00
committed by GitHub
parent 367d787ff9
commit 78a3848e73
+8 -3
View File
@@ -25,6 +25,10 @@ from threading import Thread
logger = logging.getLogger(__name__)
class EtcdRaftInternal(etcd.EtcdException):
"""Raft Internal Error"""
class EtcdError(DCSError):
pass
@@ -312,9 +316,7 @@ class Etcd(AbstractDCS):
super(Etcd, self).__init__(config)
self._ttl = int(config.get('ttl') or 30)
self._retry = Retry(deadline=config['retry_timeout'], max_delay=1, max_tries=-1,
retry_exceptions=(etcd.EtcdLeaderElectionInProgress,
etcd.EtcdWatcherCleared,
etcd.EtcdEventIndexCleared))
retry_exceptions=(etcd.EtcdLeaderElectionInProgress, EtcdRaftInternal))
self._client = self.get_etcd_client(config)
self.__do_not_watch = False
self._has_failed = False
@@ -596,3 +598,6 @@ class Etcd(AbstractDCS):
return super(Etcd, self).watch(None, timeout)
finally:
self.event.clear()
etcd.EtcdError.error_exceptions[300] = EtcdRaftInternal