Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for _wait_for_agreement in system manager. #105

Merged
merged 3 commits into from

2 participants

@carlopires

Fix for _wait_for_agreement in system manager. Now it works if some cluster's node is down.

pycassa/system_manager.py
@@ -589,6 +590,11 @@ def drop_index(self, keyspace, column_family, column):
def _wait_for_agreement(self):
while True:
versions = self._conn.describe_schema_versions()
- if len(versions) == 1:
- break
+ for key, _nodes in versions.items():
+ try:
+ uuid.UUID(key)
+ except:
+ continue
+ else:
+ return True
@thobbs Owner
thobbs added a note

This breaks out of the retry loop as soon as you see the first key. Perhaps I'm missing something, but if you have multiple keys, that means there are multiple schemas in the cluster, which is what we're waiting to settle. How does this accomplish that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@carlopires

Thanks for catching that. I fixed the patch now.

@thobbs thobbs merged commit cb8eae9 into pycassa:master
@thobbs
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 3 deletions.
  1. +8 −3 pycassa/system_manager.py
View
11 pycassa/system_manager.py
@@ -589,6 +589,11 @@ def drop_index(self, keyspace, column_family, column):
def _wait_for_agreement(self):
while True:
versions = self._conn.describe_schema_versions()
- if len(versions) == 1:
- break
- time.sleep(_SAMPLE_PERIOD)
+
+ # ignore unreachable nodes
+ live_versions = [key for key in versions.keys() if key != 'UNREACHABLE']
+
+ if len(live_versions) == 1:
+ break
+ else:
+ time.sleep(_SAMPLE_PERIOD)
Something went wrong with that request. Please try again.