Commit 40e5f996 authored by Tres Seaver's avatar Tres Seaver

Make the maximum number of retries on ConflictError a configuration option.

  
 fixes lp:143013 on trunk
parent ade87e13
...@@ -100,6 +100,9 @@ Restructuring ...@@ -100,6 +100,9 @@ Restructuring
Features Added Features Added
++++++++++++++ ++++++++++++++
- LP #143013: make the maximum number of retries on ConflictError a
configuration option.
- LP #142502: Added a knob to the Debug control panel for resetting - LP #142502: Added a knob to the Debug control panel for resetting
profile data. Thanks to Vladimir Patukhov for the patch. profile data. Thanks to Vladimir Patukhov for the patch.
......
...@@ -188,12 +188,17 @@ def root_handler(config): ...@@ -188,12 +188,17 @@ def root_handler(config):
# set up trusted proxies # set up trusted proxies
if config.trusted_proxies: if config.trusted_proxies:
import ZPublisher.HTTPRequest from ZPublisher import HTTPRequest
# DM 2004-11-24: added host name mapping (such that examples in # DM 2004-11-24: added host name mapping (such that examples in
# conf file really have a chance to work # conf file really have a chance to work
mapped = [] mapped = []
for name in config.trusted_proxies: mapped.extend(_name2Ips(name)) for name in config.trusted_proxies: mapped.extend(_name2Ips(name))
ZPublisher.HTTPRequest.trusted_proxies = tuple(mapped) HTTPRequest.trusted_proxies = tuple(mapped)
# set the maximum number of ConflictError retries
if config.max_conflict_retries:
from ZPublisher import HTTPRequest
HTTPRequest.retry_max_count = config.max_conflict_retries
def handleConfig(config, multihandler): def handleConfig(config, multihandler):
......
...@@ -208,6 +208,19 @@ class StartupTestCase(unittest.TestCase): ...@@ -208,6 +208,19 @@ class StartupTestCase(unittest.TestCase):
self.assertEqual(conf.databases[0].config.connection_class.__name__, self.assertEqual(conf.databases[0].config.connection_class.__name__,
'LowConflictConnection') 'LowConflictConnection')
def test_max_conflict_retries_default(self):
conf, handler = self.load_config_text("""\
instancehome <<INSTANCE_HOME>>
""")
self.assertEqual(conf.max_conflict_retries, 3)
def test_max_conflict_retries_explicit(self):
conf, handler = self.load_config_text("""\
instancehome <<INSTANCE_HOME>>
max-conflict-retries 15
""")
self.assertEqual(conf.max_conflict_retries, 15)
def test_suite(): def test_suite():
return unittest.makeSuite(StartupTestCase) return unittest.makeSuite(StartupTestCase)
......
...@@ -661,6 +661,12 @@ ...@@ -661,6 +661,12 @@
<metadefault>unset</metadefault> <metadefault>unset</metadefault>
</multikey> </multikey>
<key name="max-conflict-retries" datatype="integer" default="3" attribute="max_conflict_retries">
<description>
The maximum number of retries on a conflict error
</description>
</key>
<key name="security-policy-implementation" <key name="security-policy-implementation"
datatype=".security_policy_implementation" datatype=".security_policy_implementation"
default="C"> default="C">
......
...@@ -808,6 +808,18 @@ instancehome $INSTANCE ...@@ -808,6 +808,18 @@ instancehome $INSTANCE
# #
# conflict-error-log-level blather # conflict-error-log-level blather
# Directive: max-conflict-retries
#
# Description:
# Specifies how many times a transaction will be re-tried when
# it generates ConflictErrors. This can be a problem when using
# a ZEO server and you have large numbers of simultaneous writes.
#
# Default: 3
#
# Example:
#
# max-conflict-retries 10
# Directive: warnfilter # Directive: warnfilter
# #
......
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