From 6af56900ac77d083b8c3abc76bd808e6718412ee Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Mon, 19 Sep 2005 11:56:11 +0000 Subject: [PATCH] Michael Haardt's randomized retry stuff, using the new letter "H". --- doc/doc-txt/ChangeLog | 5 ++++- doc/doc-txt/NewStuff | 12 +++++++++++- src/ACKNOWLEDGMENTS | 5 +++-- src/src/readconf.c | 5 +++-- src/src/retry.c | 17 +++++++++++++---- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 3f2121c1c..c3d1fe70a 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.235 2005/09/19 09:41:37 fanf2 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.236 2005/09/19 11:56:11 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -207,6 +207,9 @@ TF/06 The fix for widen_domains has also been applied to qualify_single and search_parents which are the other dnslookup options that can cause header rewrites. +PH/49 Michael Haardt's randomized retrying, but as a separate retry parameter + type ("H"). + Exim version 4.52 ----------------- diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff index cd69ef60e..4640547ae 100644 --- a/doc/doc-txt/NewStuff +++ b/doc/doc-txt/NewStuff @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/NewStuff,v 1.71 2005/09/15 12:22:41 fanf2 Exp $ +$Cambridge: exim/doc/doc-txt/NewStuff,v 1.72 2005/09/19 11:56:11 ph10 Exp $ New Features in Exim -------------------- @@ -155,6 +155,16 @@ TF/01 There's a new script in util/ratelimit.pl which extracts sending rates from log files, to assist with choosing appropriate settings when deploying the ratelimit ACL condition. +PH/13 A new letter, "H", is available in retry parameter sets. It is similar + to "G" (geometric increasing time intervals), except that the interval + before the next retry is randomized. Each time, the previous interval is + multiplied by the factor in order to get a maximum for the next interval. + The mininum interval is the first argument of the parameter, and an + actual interval is chosen randomly between them. Such a rule has been + found to be helpful in cluster configurations when all the members of the + cluster restart at once, and may synchronize their queue processing + times. + Exim version 4.52 ----------------- diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS index 238b52d2a..9b60b6f30 100644 --- a/src/ACKNOWLEDGMENTS +++ b/src/ACKNOWLEDGMENTS @@ -1,4 +1,4 @@ -$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.34 2005/09/12 13:50:03 ph10 Exp $ +$Cambridge: exim/src/ACKNOWLEDGMENTS,v 1.35 2005/09/19 11:56:11 ph10 Exp $ EXIM ACKNOWLEDGEMENTS @@ -20,7 +20,7 @@ relatively small patches. Philip Hazel Lists created: 20 November 2002 -Last updated: 12 September 2005 +Last updated: 19 September 2005 THE OLD LIST @@ -146,6 +146,7 @@ Michael Haardt Tidies to make the code stricter continued maintenance of same Patch for faster sort algorithm in queue.c Patch for LDAP timeout handling + ... and several more Thomas Hager Patch for saslauthd crash bug Richard Hall Fix for file descriptor leak in redirection Steve Haslam Lots of stuff, including diff --git a/src/src/readconf.c b/src/src/readconf.c index 220438ada..3ceece489 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/readconf.c,v 1.12 2005/08/08 10:48:27 ph10 Exp $ */ +/* $Cambridge: exim/src/src/readconf.c,v 1.13 2005/09/19 11:56:11 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -3554,6 +3554,7 @@ while ((p = get_config_line()) != NULL) break; case 'G': /* Geometrically increasing intervals */ + case 'H': /* Ditto, but with randomness */ rule->p1 = retry_arg(&p, 0); rule->p2 = retry_arg(&p, 1); break; @@ -3564,7 +3565,7 @@ while ((p = get_config_line()) != NULL) } if (rule->timeout <= 0 || rule->p1 <= 0 || - (rule->rule == 'G' && rule->p2 < 1000)) + (rule->rule != 'F' && rule->p2 < 1000)) log_write(0, LOG_PANIC_DIE|LOG_CONFIG_IN, "bad parameters for retry rule"); diff --git a/src/src/retry.c b/src/src/retry.c index 2e743a793..5126e5344 100644 --- a/src/src/retry.c +++ b/src/src/retry.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/retry.c,v 1.3 2005/06/29 14:17:01 ph10 Exp $ */ +/* $Cambridge: exim/src/src/retry.c,v 1.4 2005/09/19 11:56:11 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -739,15 +739,24 @@ for (i = 0; i < 3; i++) if (rule == NULL) next_try = now; else { if (rule->rule == 'F') next_try = now + rule->p1; - else /* assume rule = 'G' */ + else /* rule = 'G' or 'H' */ { int last_predicted_gap = retry_record->next_try - retry_record->last_try; int last_actual_gap = now - retry_record->last_try; int lastgap = (last_predicted_gap < last_actual_gap)? last_predicted_gap : last_actual_gap; - next_try = now + ((lastgap < rule->p1)? rule->p1 : - (lastgap * rule->p2)/1000); + int next_gap = (lastgap * rule->p2)/1000; + if (rule->rule == 'G') + { + next_try = now + ((lastgap < rule->p1)? rule->p1 : next_gap); + } + else /* The 'H' rule */ + { + next_try = now + rule->p1; + if (next_gap > rule->p1) + next_try += random_number(next_gap - rule->p1); + } } } -- 2.25.1