Skip to content

Instantly share code, notes, and snippets.

@clayg
Created April 7, 2017 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/e03558e557097debde1d99d2f5b43cb1 to your computer and use it in GitHub Desktop.
Save clayg/e03558e557097debde1d99d2f5b43cb1 to your computer and use it in GitHub Desktop.
This fixes you if you're already in lp bug #1675500
diff --git a/swift/common/db_replicator.py b/swift/common/db_replicator.py
index 23ba757..4445973 100644
--- a/swift/common/db_replicator.py
+++ b/swift/common/db_replicator.py
@@ -548,6 +548,8 @@ class Replicator(Daemon):
local_dev = node
break
for node in repl_nodes:
+ if node == local_dev:
+ continue
different_region = False
if local_dev and local_dev['region'] != node['region']:
# This additional information will help later if we
@@ -577,9 +579,11 @@ class Replicator(Daemon):
except (Exception, Timeout):
self.logger.exception('UNHANDLED EXCEPTION: in post replicate '
'hook for %s', broker.db_file)
- if not shouldbehere and responses and all(responses):
+ num_success = len([s for s in responses if s])
+ print local_dev, shouldbehere, responses, num_success, len(nodes), num_success >= len(nodes)
+ if not shouldbehere and num_success >= len(nodes):
# If the db shouldn't be on this node and has been successfully
- # synced to all of its peers, it can be removed.
+ # synced to >= replica count of its peers, it can be removed.
if not self.delete_db(broker):
failure_devs_info.update(
[(failure_dev['replication_ip'], failure_dev['device'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment