Commit 95610018 authored by Levin Zimmermann's avatar Levin Zimmermann

lib/zodb: Insure NEO with > 1 master always normalizes to same URI

If a NEO cluster has multiple master nodes, there is no agreed
on order in which the master node addresses appear in the URI.
In order to insure we always get the same normalized URI among different
clients of a NEO cluster with more than one master node, we explicitly
sort the master node address order with this patch.
parent ec59b979
...@@ -483,6 +483,12 @@ def _znormalize_neo(scheme, netloc, path, query, frag): ...@@ -483,6 +483,12 @@ def _znormalize_neo(scheme, netloc, path, query, frag):
# instance. # instance.
if "@" in netloc: if "@" in netloc:
netloc = netloc[netloc.index("@") + 1 :] netloc = netloc[netloc.index("@") + 1 :]
# Sort multiple master nodes: if a NEO cluster has multiple master
# nodes, there is no agreed on order in which the master node
# addresses appear in the netloc. In order to insure we always
# get the same mountpoint among different clients we explicitly
# sort the master node addr order.
netloc = ",".join(sorted(netloc.split(',')))
return (scheme, netloc, path, query, frag) return (scheme, netloc, path, query, frag)
_znormalizer('neo', _znormalize_neo) _znormalizer('neo', _znormalize_neo)
_znormalizer('neos', _znormalize_neo) _znormalizer('neos', _znormalize_neo)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment