]> granicus.if.org Git - apache/commitdiff
* Add the forcerecovery balancer parameter that determines if recovery for
authorRuediger Pluem <rpluem@apache.org>
Wed, 28 Mar 2012 15:22:40 +0000 (15:22 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 28 Mar 2012 15:22:40 +0000 (15:22 +0000)
  balancer workers without considering the retry value of workers is enforced.
  There might be cases where an already overloaded backend can get into deeper
  trouble if the recovery of all workers is enforced without considering the
  retry parameter of each worker

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1306409 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy.xml
include/ap_mmn.h
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_balancer.c
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index 4314ffeb4ff4701ae7474b0d58de3280b9876144..67d80e0b674a16b8e3784820e38a91a542f168d6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy: Add the forcerecovery balancer parameter that determines if
+     recovery for balancer workers is enforced. [Ruediger Pluem]
+
   *) mod_proxy: Correctly set up reverse proxy worker. PR 52935.
      [Petter Berntsen <petterb gmail.com>]
 
index de26f3645d718162e1081bd1dccdbf845bfc1958..0be2c0bd1d339b78ce46f81719dc50379e49fa43 100644 (file)
@@ -1104,6 +1104,15 @@ expressions</description>
         <td>Number of additional BalancerMembers to allow to be added
         to this balancer in addition to those defined at configuration.
     </td></tr>
+    <tr><td>forcerecovery</td>
+        <td>On</td>
+        <td>Force the immediate recovery of all workers without considering the
+        retry parameter of the workers if all workers of a balancer are
+        in error state. There might be cases where an already overloaded backend
+        can get into deeper trouble if the recovery of all workers is enforced
+        without considering the retry parameter of each worker. In this case
+        set to <code>Off</code>.
+    </td></tr>
 
     </table>
     <p>A sample balancer setup</p>
index 00572da2be926029b456700f490dff55ab01ba62..da2fc7c61fccaa99b033e3eb8dfeb8773ef27bb9 100644 (file)
  * 20120211.0 (2.5.0-dev)  Change re_nsub in ap_regex_t from apr_size_t to int.
  * 20120211.1 (2.5.0-dev)  Add ap_palloc_debug, ap_pcalloc_debug
  * 20120211.2 (2.5.0-dev)  Add ap_runtime_dir_relative
+ * 20120211.3 (2.5.0-dev)  Add forcerecovery to proxy_balancer_shared struct
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20120211
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 2                   /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 3                   /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index 8d289552d3442edc88a14aed6d5b2bcb09ee915b..f9a800907a219bda6860e02691de9800eb79b8c9 100644 (file)
@@ -387,6 +387,14 @@ static const char *set_balancer_param(proxy_server_conf *conf,
             return "growth must be between 1 and 100";
         balancer->growth = ival;
     }
+    else if (!strcasecmp(key, "forcerecovery")) {
+        if (!strcasecmp(val, "on"))
+            balancer->s->forcerecovery = 1;
+        else if (!strcasecmp(val, "off"))
+            balancer->s->forcerecovery = 0;
+        else
+            return "forcerecovery must be On|Off";
+    }
     else {
         return "unknown Balancer parameter";
     }
index 5348d02a1f4f9ccc4089d34a6ad2048e25af26db..5ad91fb595d120cf71b84ae4b60017617eac5ba9 100644 (file)
@@ -424,6 +424,7 @@ typedef struct {
     unsigned int    need_reset:1;
     unsigned int    vhosted:1;
     unsigned int    inactive:1;
+    unsigned int    forcerecovery:1;
 } proxy_balancer_shared;
 
 #define ALIGNED_PROXY_BALANCER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_balancer_shared)))
index 28eb176884a9b1f5197e4cd6c298716580f799fb..e3db4883f1f70bf4d831e4909d4708a8df9f63fb 100644 (file)
@@ -423,7 +423,7 @@ static void force_recovery(proxy_balancer *balancer, server_rec *s)
             }
         }
     }
-    if (!ok) {
+    if (!ok && balancer->s->forcerecovery) {
         /* If all workers are in error state force the recovery.
          */
         worker = (proxy_worker **)balancer->workers->elts;
index 5821aa93007f7a7fa2172979ddc5a34488bb0c2c..fe2ac43e20a54490a69ef8c3e50099961fcaf462 100644 (file)
@@ -1164,6 +1164,8 @@ PROXY_DECLARE(char *) ap_proxy_define_balancer(apr_pool_t *p,
     bshared->hash.fnv = ap_proxy_hashfunc(bshared->name, PROXY_HASHFUNC_FNV);
     (*balancer)->hash = bshared->hash;
 
+    bshared->forcerecovery = 1;
+
     /* Retrieve a UUID and store the nonce for the lifetime of
      * the process. */
     apr_uuid_get(&uuid);