]> granicus.if.org Git - apache/commitdiff
Merge r1306409:
authorStefan Fritsch <sf@apache.org>
Sat, 31 Mar 2012 15:40:36 +0000 (15:40 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 31 Mar 2012 15:40:36 +0000 (15:40 +0000)
* Add the forcerecovery balancer parameter that determines if recovery for
  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

Committed by: rpluem
Reviewed by: rpluem, covener, sf

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1307835 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
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 bb5254295aabb8c8bdba45e980d2534e24fee99a..91bda27346f9f76afbe87ffa8a654b89df169dc7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ Changes with Apache 2.4.2
      envvars: Fix insecure handling of LD_LIBRARY_PATH that could lead to the
      current working directory to be searched for DSOs. [Stefan Fritsch]
 
+  *) mod_proxy: Add the forcerecovery balancer parameter that determines if
+     recovery for balancer workers is enforced. [Ruediger Pluem]
+
   *) Fix MPM DSO load failure on AIX.  [Jeff Trawick]
 
   *) mod_proxy: Correctly set up reverse proxy worker. PR 52935.
diff --git a/STATUS b/STATUS
index 4565ba86e2523a3aaec4595f369b1681fc6d2ed6..d7f822bbccfaf384be278403fb06eab67a83ce86 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -88,14 +88,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_proxy: Add the forcerecovery balancer parameter that determines if
-     recovery for balancer workers is enforced.
-    Trunk version of patch:
-       http://svn.apache.org/viewvc?rev=1306409&view=rev
-    Backport version for 2.2.x of patch:
-       http://people.apache.org/~rpluem/patches/forcerecovery_2.4.diff
-    +1: rpluem, covener, sf
-
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
 
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 a1ee4fd17ee06b87af946ac046a27494d7a79884..3487067dc24135e677f440b2646712c4cae7c1b8 100644 (file)
  * 20120211.0 (2.4.1-dev)  Change re_nsub in ap_regex_t from apr_size_t to int.
  * 20120211.1 (2.4.2-dev)  Add AP_HAVE_C99
  * 20120211.2 (2.4.2-dev)  Add ap_runtime_dir_relative
+ * 20120211.3 (2.4.2-dev)  Add forcerecovery to proxy_balancer_shared struct
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
 #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 dbbf8bd17b14b84a87256f8b58a23e31dd9e08f5..96e0901e8a28376e3afe23626a656e0e2c56d311 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);