tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1820195 - in /tomcat/jk/trunk: native/common/jk_lb_worker.c native/common/jk_lb_worker.h native/common/jk_status.c xdocs/miscellaneous/changelog.xml
Date Thu, 04 Jan 2018 20:12:12 GMT
Author: rjung
Date: Thu Jan  4 20:12:12 2018
New Revision: 1820195

URL: http://svn.apache.org/viewvc?rev=1820195&view=rev
Log:
BZ 61733: LB: Propagate load factor changes applied
by the status worker to a load balancer sub worker
correctly to all processes.
Based on a patch provided by Jonathan Oddy.

Modified:
    tomcat/jk/trunk/native/common/jk_lb_worker.c
    tomcat/jk/trunk/native/common/jk_lb_worker.h
    tomcat/jk/trunk/native/common/jk_status.c
    tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1820195&r1=1820194&r2=1820195&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Thu Jan  4 20:12:12 2018
@@ -369,7 +369,7 @@ void jk_lb_pull(lb_worker_t *p, int lock
 }
 
 /* Syncing config values to shm */
-void jk_lb_push(lb_worker_t *p, int locked, jk_logger_t *l)
+void jk_lb_push(lb_worker_t *p, int locked, int push_all_members, jk_logger_t *l)
 {
     unsigned int i = 0;
 
@@ -394,7 +394,7 @@ void jk_lb_push(lb_worker_t *p, int lock
 
     for (i = 0; i < p->num_of_workers; i++) {
         lb_sub_worker_t *w = &p->lb_workers[i];
-        if (w->sequence != w->s->h.sequence) {
+        if (push_all_members == JK_TRUE || w->sequence != w->s->h.sequence) {
             jk_worker_t *jw = w->worker;
             ajp_worker_t *aw = (ajp_worker_t *)jw->worker_private;
 
@@ -1959,7 +1959,7 @@ static int JK_METHOD init(jk_worker_t *p
     if (p->s->h.sequence == 0) {
         /* Set configuration data to shared memory
          */
-        jk_lb_push(p, JK_TRUE, log);
+        jk_lb_push(p, JK_TRUE, JK_FALSE, log);
     }
     else {
         /* Shared memory for this worker is already configured.

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.h?rev=1820195&r1=1820194&r2=1820195&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_lb_worker.h (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.h Thu Jan  4 20:12:12 2018
@@ -219,7 +219,7 @@ const char *jk_lb_get_activation(lb_sub_
 int jk_lb_get_activation_code(const char *v);
 void reset_lb_values(lb_worker_t *p, jk_logger_t *l);
 void jk_lb_pull(lb_worker_t * p, int locked, jk_logger_t *l);
-void jk_lb_push(lb_worker_t * p, int locked, jk_logger_t *l);
+void jk_lb_push(lb_worker_t * p, int locked, int push_all_members, jk_logger_t *l);
 void update_mult(lb_worker_t * p, jk_logger_t *l);
 
 #ifdef __cplusplus

Modified: tomcat/jk/trunk/native/common/jk_status.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_status.c?rev=1820195&r1=1820194&r2=1820195&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_status.c (original)
+++ tomcat/jk/trunk/native/common/jk_status.c Thu Jan  4 20:12:12 2018
@@ -3350,7 +3350,7 @@ static void commit_worker(jk_ws_service_
     }
     if (sync_needed == JK_TRUE) {
         lb->sequence = -1;
-        jk_lb_push(lb, JK_TRUE, l);
+        jk_lb_push(lb, JK_TRUE, JK_FALSE, l);
     }
 }
 
@@ -3640,6 +3640,7 @@ static void commit_all_members(jk_ws_ser
     int i;
     int rc = 0;
     unsigned int j;
+    int push_all_members = JK_FALSE;
 
     JK_TRACE_ENTER(l);
     if (!attribute) {
@@ -3887,12 +3888,14 @@ static void commit_all_members(jk_ws_ser
         }
         if (rc == 1)
             reset_lb_values(lb, l);
-        else if (rc == 2)
+        else if (rc == 2) {
             /* Recalculate the load multiplicators wrt. lb_factor */
             update_mult(lb, l);
+            push_all_members = JK_TRUE;
+        }
         if (rc) {
             lb->sequence = -1;
-            jk_lb_push(lb, JK_TRUE, l);
+            jk_lb_push(lb, JK_TRUE, push_all_members, l);
         }
     }
     JK_TRACE_EXIT(l);
@@ -4395,16 +4398,16 @@ static int update_worker(jk_ws_service_t
                 if (rv & JK_STATUS_NEEDS_ADDR_PUSH) {
                     aw->addr_sequence = -1;
                 }
-                if (rv & (JK_STATUS_NEEDS_PUSH | JK_STATUS_NEEDS_ADDR_PUSH)) {
-                    wr->sequence = -1;
-                    lb->sequence = -1;
-                    jk_lb_push(lb, JK_TRUE, l);
-                }
                 if (rv & JK_STATUS_NEEDS_RESET_LB_VALUES)
                     reset_lb_values(lb, l);
                 if (rv & JK_STATUS_NEEDS_UPDATE_MULT)
                     /* Recalculate the load multiplicators wrt. lb_factor */
                     update_mult(lb, l);
+                if (rv & (JK_STATUS_NEEDS_PUSH | JK_STATUS_NEEDS_ADDR_PUSH)) {
+                    wr->sequence = -1;
+                    lb->sequence = -1;
+                    jk_lb_push(lb, JK_TRUE, rv & JK_STATUS_NEEDS_UPDATE_MULT ? JK_TRUE:
JK_FALSE, l);
+                }
                 if (rc == JK_FALSE) {
                     jk_log(l, JK_LOG_ERROR,
                            "Status worker '%s' failed updating sub worker '%s' (at least
partially).%s",

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1820195&r1=1820194&r2=1820195&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Thu Jan  4 20:12:12 2018
@@ -45,6 +45,11 @@
   <subsection name="Native">
     <changelog>
       <fix>
+        <bug>61733</bug>: LB: Propagate load factor changes applied by the status
worker
+        to a load balancer sub worker correctly to all processes.
+        Based on a patch provided by Jonathan Oddy. (rjung)
+      </fix>
+      <fix>
         ISAPI: Align the make files for 32-bit and 64-bit builds. (markt)
       </fix>
       <update>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message