From 0c5a21e57d106f42028f41ea906b5091c17ed37b Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Fri, 23 Oct 2015 10:46:55 +0200 Subject: [PATCH] Fix removal of keys on failed initialization. The initialize key was checked against the value of the node name before removal, but it was changed recently to contain either an empty string, or cluster sysid. To fix this, the check for the previous value was simply removed: we can guarantee that the code path that removes the key is the one that created it. --- patroni/etcd.py | 2 +- patroni/zookeeper.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patroni/etcd.py b/patroni/etcd.py index d84f5a50..4a82f2d7 100644 --- a/patroni/etcd.py +++ b/patroni/etcd.py @@ -249,7 +249,7 @@ class Etcd(AbstractDCS): @catch_etcd_errors def cancel_initialization(self): - return self.retry(self.client.delete, self.initialize_path, prevValue=self._name) + return self.retry(self.client.delete, self.initialize_path) def watch(self, timeout): cluster = self.cluster diff --git a/patroni/zookeeper.py b/patroni/zookeeper.py index 1fa2cca3..bc9b83c4 100644 --- a/patroni/zookeeper.py +++ b/patroni/zookeeper.py @@ -271,7 +271,7 @@ class ZooKeeper(AbstractDCS): def _cancel_initialization(self): node = self.get_node(self.initialize_path) - if node and node[0] == self._name: + if node: self.client.delete(self.initialize_path, version=node[1].version) def cancel_initialization(self):