httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r485053 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/database/mod_dbd.c
Date Sat, 09 Dec 2006 19:56:08 GMT
Author: niq
Date: Sat Dec  9 11:56:07 2006
New Revision: 485053

URL: http://svn.apache.org/viewvc?view=rev&rev=485053
Log:
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

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/database/mod_dbd.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?view=diff&rev=485053&r1=485052&r2=485053
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Dec  9 11:56:07 2006
@@ -1,6 +1,12 @@
                                                         -*- 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>]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?view=diff&rev=485053&r1=485052&r2=485053
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Dec  9 11:56:07 2006
@@ -78,18 +78,6 @@
 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.
@@ -240,19 +228,6 @@
      wrowe notes: 26 bytes is absurdly posix-unix and english specific,
                   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

Modified: httpd/httpd/branches/2.2.x/modules/database/mod_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/database/mod_dbd.c?view=diff&rev=485053&r1=485052&r2=485053
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/database/mod_dbd.c (original)
+++ httpd/httpd/branches/2.2.x/modules/database/mod_dbd.c Sat Dec  9 11:56:07 2006
@@ -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 @@
                                         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 @@
 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_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 @@
     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;



Mime
View raw message