Commit 7200ec2d authored by Levin Zimmermann's avatar Levin Zimmermann

lib/zodb: Drop client-only parameters from normalized NEO URI

We need to drop client-specific options so that NEO URI that only differ
due to client options while actually pointing to the same NEO server
are equal after normalization.
parent ba84a93c
...@@ -560,6 +560,8 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict): ...@@ -560,6 +560,8 @@ def test_zstor_2zurl(tmpdir, neo_ssl_dict):
("neos://cluster@xyz:1?ca=α&key=β&cert=γ", "neos://cluster@xyz:1"), ("neos://cluster@xyz:1?ca=α&key=β&cert=γ", "neos://cluster@xyz:1"),
# neo:// with anything SSL-related in query -> neos:// # neo:// with anything SSL-related in query -> neos://
("neo://cluster@xyz:1?cert=c", "neos://cluster@xyz:1"), ("neo://cluster@xyz:1?cert=c", "neos://cluster@xyz:1"),
# client options
("neo://cluster@xyz:1?compress=1&read-only=true&logfile=abc.log&cache-size=1024", "neo://cluster@xyz:1"),
], ],
) )
def test_zurl_normalize_main(zurl, zurl_norm_ok): def test_zurl_normalize_main(zurl, zurl_norm_ok):
......
...@@ -492,6 +492,11 @@ def _znormalize_neo(scheme, netloc, path, query, frag): ...@@ -492,6 +492,11 @@ def _znormalize_neo(scheme, netloc, path, query, frag):
# ca/cert/key is different than a URL with 'neos' scheme, # ca/cert/key is different than a URL with 'neos' scheme,
# although both point to the same database. # although both point to the same database.
scheme = "neos" scheme = "neos"
# Drop client specific options.
# These options only affect the behaviour of the NEO client, but don't specify
# a different NEO server, and therefore need to be dropped.
for k in ("compress", "read-only", "logfile", "cache-size"):
q.pop(k, 0)
query = urlparse.urlencode(q, doseq=True) query = urlparse.urlencode(q, doseq=True)
# Sort multiple master nodes: if a NEO cluster has multiple master # Sort multiple master nodes: if a NEO cluster has multiple master
# nodes, there is no agreed on order in which the master node # nodes, there is no agreed on order in which the master node
......
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