Commit 7537ef3b authored by Jérome Perrin's avatar Jérome Perrin

stack/erp5: enable server-sync for ZEO

For ZEO4, this was implemented as a monkey patch in ERP5, but this is
now supported in ZEO5, but not enabled by default.

The setting is only avaiable through ZEO's own ZConfig, but not with
ZODB's <zeoclient> so we also adjust the config to import ZEO and use
ZEO's <clientstorage>.
parent fe3f4345
...@@ -365,16 +365,18 @@ class TestZopeNodeParameterOverride(ERP5InstanceTestCase, TestPublishedURLIsReac ...@@ -365,16 +365,18 @@ class TestZopeNodeParameterOverride(ERP5InstanceTestCase, TestPublishedURLIsReac
zodb["mount-point"] = "/" zodb["mount-point"] = "/"
zodb["pool-size"] = 4 zodb["pool-size"] = 4
zodb["pool-timeout"] = "10m" zodb["pool-timeout"] = "10m"
zodb["%import"] = "ZEO"
storage["storage"] = "root" storage["storage"] = "root"
storage["server"] = zeo_addr storage["server"] = zeo_addr
storage["server-sync"] = "true"
with open(f'{partition}/etc/zope-{zope}.conf') as f: with open(f'{partition}/etc/zope-{zope}.conf') as f:
conf = list(map(str.strip, f.readlines())) conf = list(map(str.strip, f.readlines()))
i = conf.index("<zodb_db root>") + 1 i = conf.index("<zodb_db root>") + 1
conf = iter(conf[i:conf.index("</zodb_db>", i)]) conf = iter(conf[i:conf.index("</zodb_db>", i)])
for line in conf: for line in conf:
if line == '<zeoclient>': if line == '<clientstorage>':
for line in conf: for line in conf:
if line == '</zeoclient>': if line == '</clientstorage>':
break break
checkParameter(line, storage) checkParameter(line, storage)
for k, v in storage.items(): for k, v in storage.items():
......
...@@ -34,7 +34,7 @@ md5sum = 45cc45510b59ceb730b6e38448b5c0c3 ...@@ -34,7 +34,7 @@ md5sum = 45cc45510b59ceb730b6e38448b5c0c3
[template-zope-conf] [template-zope-conf]
filename = zope.conf.in filename = zope.conf.in
md5sum = ce8d03a1b4c1a9e5085ec54ea2744007 md5sum = e8e1e76385d76cafbc6ad33e1c8573f2
[site-zcml] [site-zcml]
filename = site.zcml filename = site.zcml
...@@ -78,7 +78,7 @@ md5sum = 30a1e738a8211887e75a5e75820e5872 ...@@ -78,7 +78,7 @@ md5sum = 30a1e738a8211887e75a5e75820e5872
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
md5sum = 0ba5735ab87ee53e2c203b1563b55ff0 md5sum = d86d6808b745ee66be3a914487b25744
[template-zodb-base] [template-zodb-base]
filename = instance-zodb-base.cfg.in filename = instance-zodb-base.cfg.in
......
...@@ -28,7 +28,7 @@ ip = {{ ipv4 }} ...@@ -28,7 +28,7 @@ ip = {{ ipv4 }}
{% set current_port = next(ports) -%} {% set current_port = next(ports) -%}
{% set known_tid_storage_identifier_host = (ipv4, current_port), -%} {% set known_tid_storage_identifier_host = (ipv4, current_port), -%}
{% for name, zodb in zodb -%} {% for name, zodb in zodb -%}
{% do storage_dict.__setitem__(name, {'server': ipv4 ~ ':' ~ current_port, 'storage': name}) %} {% do storage_dict.__setitem__(name, {'server': ipv4 ~ ':' ~ current_port, 'storage': name, 'server-sync': 'true'}) %}
{% set path = zodb.get('path', '%(zodb)s/%(name)s.fs') % {'zodb': default_zodb_path, 'name': name} -%} {% set path = zodb.get('path', '%(zodb)s/%(name)s.fs') % {'zodb': default_zodb_path, 'name': name} -%}
{% do storage_list.append((name, path)) -%} {% do storage_list.append((name, path)) -%}
{% set backup_directory = zodb.get('backup', '%(backup)s/%(name)s') % {'backup': default_backup_path, 'name': name} -%} {% set backup_directory = zodb.get('backup', '%(backup)s/%(name)s') % {'backup': default_backup_path, 'name': name} -%}
......
...@@ -152,9 +152,12 @@ large-file-threshold {{ parameter_dict['large-file-threshold'] }} ...@@ -152,9 +152,12 @@ large-file-threshold {{ parameter_dict['large-file-threshold'] }}
{% for m in parameter_dict['import-list'] -%} {% for m in parameter_dict['import-list'] -%}
%import {{ m }} %import {{ m }}
{% endfor -%} {% endfor -%}
{% set type_dict = {'neo': 'NEOStorage', 'zeo': 'zeoclient'} %} {% set type_dict = {'neo': 'NEOStorage', 'zeo': 'clientstorage'} %}
{% for name, zodb_dict in six.iteritems(parameter_dict['zodb-dict']) %} {% for name, zodb_dict in six.iteritems(parameter_dict['zodb-dict']) %}
<zodb_db {{ name }}> <zodb_db {{ name }}>
{%- if zodb_dict['type'] == 'zeo' %}
%import ZEO
{%- endif %}
{%- set storage_type = type_dict[zodb_dict.pop('type')] %} {%- set storage_type = type_dict[zodb_dict.pop('type')] %}
{%- set storage_dict = zodb_dict.pop('storage-dict') %} {%- set storage_dict = zodb_dict.pop('storage-dict') %}
{%- do root_common.apply_overrides(zodb_dict, node_id) %} {%- do root_common.apply_overrides(zodb_dict, node_id) %}
......
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