Commit 2ee6c616 authored by Nick Kew's avatar Nick Kew
Browse files

mod_dbd backports:

  (1) Key connection pools to virtualhosts (niq, minfrin; reviewed us + wrowe)
  (2) share per-request database handles across subrequests (chrisd; reviewed
      niq + rpluem).  Including fixing compiler warning (rpluem).

More to come on mod_dbd


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@485053 13f79535-47bb-0310-9956-ffa450edef68
parent 51071782
Loading
Loading
Loading
Loading
+6 −0
Changes for CHANGES: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
                                                        -*- coding: utf-8 -*-
Changes with Apache 2.2.4
  *) mod_dbd: share per-request database handles across subrequests
     and internal redirects [Chris Darroch]
  *) mod_dbd: key connection pools correctly to virtual hosts
     [Graham Leggett, Nick Kew]
  *) Better detection and clean up of ldap connection that has been
     terminated by the ldap server.  PR 40878.
     [Rob Baily <rbaily servicebench com>]
+0 −25
Changes for STATUS: 0 added lines, 25 removed lines.
Original line number Diff line number Diff line
@@ -78,18 +78,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

   * mod_dbd: Key the storage of prepared statements on the hex string
     value of server_rec, rather than the server name, as the server name
     may change (eg when the server name is set) at any time, causing
     weird behaviour in modules dependent on mod_dbd.
     Trunk: http://svn.apache.org/viewvc?view=rev&revision=466641
     niq: This is actually cumulative with R432562, R432560, 424798
          which were not yet backported.  They fix a nasty bug,
          and minfrin's fix is better than mine.
     Cumulative patch: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/database/mod_dbd.c?r1=466641&r2=420983&pathrev=466641
     +1: minfrin, niq, wrowe
     jim asks: Are the +1's on the Cumulative patch?

PATCHES PROPOSED TO BACKPORT FROM TRUNK:

    * mpm_winnt: Fix return values from wait_for_many_objects.
@@ -241,19 +229,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
                  don't you think?  grow the error text pad to a sane
                  width before backporting, please.

   * mod_dbd: Stash DBD connections in request_config of initial request
     only, or else sub-requests and internal redirections may cause
     entire DBD pool to be stashed in a single HTTP request.
     Trunk version of patch:
       http://svn.apache.org/viewvc?view=rev&revision=481509
     2.2.x version of patch:
       Trunk version works
     +1: chrisd, niq
     rpluem says: Please add r483630
                  (http://svn.apache.org/viewvc?view=rev&rev=483630) to this
                  proposal as it fixes a compiler warning. Once this is added
                  to the proposal I am +1.

   * mod_proxy_balancer: Have the find_best_worker() function
    increment the elected counter, rather than requiring each
    ind lb method to do it, isolating what each lb method
+30 −7
Changes for modules/database/mod_dbd.c: 30 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include "http_protocol.h"
#include "http_config.h"
#include "http_log.h"
#include "http_request.h"
#include "apr_reslist.h"
#include "apr_strings.h"
#include "apr_dbd.h"
@@ -147,12 +148,11 @@ DBD_DECLARE_NONSTD(void) ap_dbd_prepare(server_rec *s, const char *query,
                                        const char *label)
{
    dbd_prepared *prepared = apr_pcalloc(s->process->pool, sizeof(dbd_prepared));
    const char *key = apr_psprintf(s->process->pool, "%pp", s);
    prepared->label = label;
    prepared->query = query;
    prepared->next = apr_hash_get(dbd_prepared_defns, s->server_hostname,
                                  APR_HASH_KEY_STRING);
    apr_hash_set(dbd_prepared_defns, s->server_hostname, APR_HASH_KEY_STRING,
                 prepared);
    prepared->next = apr_hash_get(dbd_prepared_defns, key, APR_HASH_KEY_STRING);
    apr_hash_set(dbd_prepared_defns, key, APR_HASH_KEY_STRING, prepared);
}
static const char *dbd_prepare(cmd_parms *cmd, void *cfg, const char *query,
                               const char *label)
@@ -525,7 +525,18 @@ static apr_status_t dbd_release(void *REQ)
DBD_DECLARE_NONSTD(ap_dbd_t *) ap_dbd_acquire(request_rec *r)
{
    svr_cfg *svr;
    dbd_pool_rec *req = ap_get_module_config(r->request_config, &dbd_module);
    dbd_pool_rec *req;

    while (!ap_is_initial_req(r)) {
        if (r->prev) {
            r = r->prev;
        }
        else if (r->main) {
            r = r->main;
        }
    }

    req = ap_get_module_config(r->request_config, &dbd_module);
    if (!req) {
        req = apr_palloc(r->pool, sizeof(dbd_pool_rec));
        req->conn = ap_dbd_open(r->pool, r->server);
@@ -572,7 +583,18 @@ DBD_DECLARE_NONSTD(ap_dbd_t *) ap_dbd_cacquire(conn_rec *c)
DBD_DECLARE_NONSTD(ap_dbd_t *) ap_dbd_acquire(request_rec *r)
{
    svr_cfg *svr;
    ap_dbd_t *ret = ap_get_module_config(r->request_config, &dbd_module);
    ap_dbd_t *ret;

    while (!ap_is_initial_req(r)) {
        if (r->prev) {
            r = r->prev;
        }
        else if (r->main) {
            r = r->main;
        }
    }

    ret = ap_get_module_config(r->request_config, &dbd_module);
    if (!ret) {
        svr = ap_get_module_config(r->server->module_config, &dbd_module);
        ret = ap_dbd_open(r->pool, r->server);
@@ -618,8 +640,9 @@ static int dbd_post_config(apr_pool_t *pconf, apr_pool_t *plog,
    svr_cfg *svr;
    server_rec *sp;
    for (sp = s; sp; sp = sp->next) {
        const char *key = apr_psprintf(s->process->pool, "%pp", s);
        svr = ap_get_module_config(sp->module_config, &dbd_module);
        svr->prepared = apr_hash_get(dbd_prepared_defns, sp->server_hostname,
        svr->prepared = apr_hash_get(dbd_prepared_defns, key,
                                     APR_HASH_KEY_STRING);
    }
    return OK;