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
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
profile data. Thanks to Vladimir Patukhov for the patch.
......
......@@ -188,12 +188,17 @@ def root_handler(config):
# set up 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
# conf file really have a chance to work
mapped = []
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):
......
......@@ -208,6 +208,19 @@ class StartupTestCase(unittest.TestCase):
self.assertEqual(conf.databases[0].config.connection_class.__name__,
'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():
return unittest.makeSuite(StartupTestCase)
......
......@@ -661,6 +661,12 @@
<metadefault>unset</metadefault>
</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"
datatype=".security_policy_implementation"
default="C">
......
......@@ -808,6 +808,18 @@ instancehome $INSTANCE
#
# 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
#
......
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