Commit ed528b88 authored by Yann Ylavic's avatar Yann Ylavic
Browse files

2.2.x only.

mod_proxy: Reuse proxy/balancer workers' parameters and scores across
graceful restarts, even if new workers are added, old ones removed, or
the order changes.

Proposed by: jkaluza
Reviewed by: ylavic, jkaluza, wrowe
Backported by: ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1680920 13f79535-47bb-0310-9956-ffa450edef68
parent b3eaa012
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.2.30

  *) mod_proxy: Reuse proxy/balancer workers' parameters and scores across
     graceful restarts, even if new workers are added, old ones removed, or
     the order changes.  [Jan Kaluza, Yann Ylavic]

  *) mod_ssl: 'SSLProtocol ALL' was being ignored in virtual host context. 
     PR 57100.  [Michael Kaufmann <apache-bugzilla michael-kaufmann.ch>,
     Yann Ylavic]
+0 −7
Original line number Diff line number Diff line
@@ -101,13 +101,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

   * mod_proxy: Reuse proxy workers' parameters and scores across graceful
     restarts, even if new workers added, old ones removed, or the order
     changes. PR 44736.  [Jan Kaluza]
     2.2.x patch: http://people.apache.org/~ylavic/httpd-2.2.x-graceful_share_full-v7.patch
     ylavic: trunk/2.4.x not concerned, 2.2.x only.
     +1: ylavic, jkaluza, wrowe

   * mod_ssl: Propose a more modern Cipher and Protocol list, honor server cipher
     priority and add explanations relative to RFC 7525 guidance.
                  http://svn.apache.org/r1679428
+2 −1
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@
 * 20051115.35 (2.2.28) Add SSL reusable SNI to mod_proxy.h's proxy_conn_rec
 * 20051115.36 (2.2.28) Add r->trailers_{in,out}
 * 20051115.37 (2.2.30) Add ap_get_server_name_for_url()
 * 20051115.38 (2.2.30) Add ap_proxy_set_scoreboard_lb() in mod_proxy.h
 */

#define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
@@ -162,7 +163,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20051115
#endif
#define MODULE_MAGIC_NUMBER_MINOR 37                    /* 0...n */
#define MODULE_MAGIC_NUMBER_MINOR 38                    /* 0...n */

/**
 * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
+16 −7
Original line number Diff line number Diff line
@@ -293,6 +293,13 @@ PROXY_WORKER_DISABLED | PROXY_WORKER_STOPPED | PROXY_WORKER_IN_ERROR )
#define PROXY_WORKER_DEFAULT_RETRY  60
#define PROXY_WORKER_MAX_ROUTE_SIZ  63

/* Scoreboard */
#if MODULE_MAGIC_NUMBER_MAJOR > 20020903
#define PROXY_HAS_SCOREBOARD 1
#else
#define PROXY_HAS_SCOREBOARD 0
#endif

/* Runtime worker status informations. Shared in scoreboard */
typedef struct {
    int             status;
@@ -308,6 +315,9 @@ typedef struct {
    void            *context;   /* general purpose storage */
    apr_size_t      busy;       /* busyness factor */
    int             lbset;      /* load balancer cluster set */
#if PROXY_HAS_SCOREBOARD
    unsigned char   digest[APR_MD5_DIGESTSIZE]; /* hash of the worker->name */
#endif
} proxy_worker_stat;

/* Worker configuration */
@@ -742,13 +752,6 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
PROXY_DECLARE(void) ap_proxy_backend_broke(request_rec *r,
                                           apr_bucket_brigade *brigade);

/* Scoreboard */
#if MODULE_MAGIC_NUMBER_MAJOR > 20020903
#define PROXY_HAS_SCOREBOARD 1
#else
#define PROXY_HAS_SCOREBOARD 0
#endif

/**
 * Transform buckets from one bucket allocator to another one by creating a
 * transient bucket for each data bucket and let it use the data read from
@@ -772,6 +775,12 @@ PROXY_DECLARE(apr_status_t)
ap_proxy_buckets_lifetime_transform(request_rec *r, apr_bucket_brigade *from,
                                        apr_bucket_brigade *to);

#if PROXY_HAS_SCOREBOARD
void *ap_proxy_set_scoreboard_lb(proxy_worker *worker,
                                 proxy_balancer *balancer,
                                 server_rec *server);
#endif

#define PROXY_LBMETHOD "proxylbmethod"

/* The number of dynamic workers that can be added when reconfiguring.
+10 −12
Original line number Diff line number Diff line
@@ -83,25 +83,23 @@ static int init_balancer_members(proxy_server_conf *conf, server_rec *s,
    int i;
    proxy_worker *workers;
    int worker_is_initialized;
    proxy_worker_stat *slot;

    workers = (proxy_worker *)balancer->workers->elts;

    for (i = 0; i < balancer->workers->nelts; i++) {
        worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(workers);
        if (!worker_is_initialized) {
#if PROXY_HAS_SCOREBOARD
        /*
             * If the worker is not initialized check whether its scoreboard
             * slot is already initialized.
         * If the worker is not initialized but has a scoreboard
         * slot, check whether it was already initialized in a
         * previous generation to avoid resetting the shared lb
         * parameters below.
         */
            slot = (proxy_worker_stat *) ap_get_scoreboard_lb(workers->id);
            if (slot) {
                worker_is_initialized = slot->status & PROXY_WORKER_INITIALIZED;
            }
            else {
                worker_is_initialized = 0;
            }
        if (!worker_is_initialized) {
            ap_proxy_set_scoreboard_lb(workers, balancer, s);
            worker_is_initialized = PROXY_WORKER_IS_INITIALIZED(workers);
        }
#endif
        ap_proxy_initialize_worker_share(conf, workers, s);
        ap_proxy_initialize_worker(workers, s);
        if (!worker_is_initialized) {
Loading