-*- 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>]
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.
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
#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"
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)
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);
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);
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;