Log message for revision 111017:
  Make the maximum number of retries on ConflictError a configuration option.
    
   fixes lp:143013 on trunk
  

Changed:
  U   Zope/trunk/doc/CHANGES.rst
  U   Zope/trunk/src/Zope2/Startup/handlers.py
  U   Zope/trunk/src/Zope2/Startup/tests/test_schema.py
  U   Zope/trunk/src/Zope2/Startup/zopeschema.xml
  U   Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in

-=-
Modified: Zope/trunk/doc/CHANGES.rst
===================================================================
--- Zope/trunk/doc/CHANGES.rst  2010-04-17 21:00:04 UTC (rev 111016)
+++ Zope/trunk/doc/CHANGES.rst  2010-04-17 21:26:02 UTC (rev 111017)
@@ -100,6 +100,9 @@
 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.
 

Modified: Zope/trunk/src/Zope2/Startup/handlers.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/handlers.py    2010-04-17 21:00:04 UTC (rev 
111016)
+++ Zope/trunk/src/Zope2/Startup/handlers.py    2010-04-17 21:26:02 UTC (rev 
111017)
@@ -188,12 +188,17 @@
 
     # 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):

Modified: Zope/trunk/src/Zope2/Startup/tests/test_schema.py
===================================================================
--- Zope/trunk/src/Zope2/Startup/tests/test_schema.py   2010-04-17 21:00:04 UTC 
(rev 111016)
+++ Zope/trunk/src/Zope2/Startup/tests/test_schema.py   2010-04-17 21:26:02 UTC 
(rev 111017)
@@ -208,6 +208,19 @@
         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)
 

Modified: Zope/trunk/src/Zope2/Startup/zopeschema.xml
===================================================================
--- Zope/trunk/src/Zope2/Startup/zopeschema.xml 2010-04-17 21:00:04 UTC (rev 
111016)
+++ Zope/trunk/src/Zope2/Startup/zopeschema.xml 2010-04-17 21:26:02 UTC (rev 
111017)
@@ -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">

Modified: Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in
===================================================================
--- Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in        2010-04-17 
21:00:04 UTC (rev 111016)
+++ Zope/trunk/src/Zope2/utilities/skel/etc/zope.conf.in        2010-04-17 
21:26:02 UTC (rev 111017)
@@ -808,6 +808,18 @@
 #
 #    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
 #

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to