ASF Bugzilla – Attachment 18244 Details for
Bug 39329
mod_dbd reconnection and prepared statements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to retry a problem connection
dbd-retries-patch (text/plain), 2.24 KB, created by
Nick Kew
on 2006-05-08 00:09:04 UTC
(
hide
)
Description:
Patch to retry a problem connection
Filename:
MIME Type:
Creator:
Nick Kew
Created:
2006-05-08 00:09:04 UTC
Size:
2.24 KB
patch
obsolete
>Index: modules/database/mod_dbd.c >=================================================================== >--- modules/database/mod_dbd.c (revision 404858) >+++ modules/database/mod_dbd.c (working copy) >@@ -433,6 +433,7 @@ > svr_cfg *svr = ap_get_module_config(s->module_config, &dbd_module); > apr_status_t rv = APR_SUCCESS; > const char *errmsg; >+ int tries; > > if (!svr->persist) { > /* Return a once-only connection */ >@@ -445,14 +446,28 @@ > return NULL; > } > } >- rv = apr_reslist_acquire(svr->dbpool, &rec); >- if (rv != APR_SUCCESS) { >- ap_log_perror(APLOG_MARK, APLOG_ERR, rv, pool, >- "Failed to acquire DBD connection from pool!"); >- return NULL; >- } >- rv = apr_dbd_check_conn(arec->driver, pool, arec->handle); >- if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) { >+ /* PR#39329: implement retries here >+ * How many times to retry? Well, svr->nkeep is an absolute max >+ * for the number of connections that could've gone stale while >+ * the backend remains up. I guess it could go above that in >+ * some edge case (the database gets restarted?) >+ * We need 1 try for nkeep = 0 or 1. Hence the dodgy loop logic. >+ * >+ * This effect of nkeep needs documenting in TFM. >+ */ >+ >+ tries = svr->nkeep; >+ do { >+ rv = apr_reslist_acquire(svr->dbpool, &rec); >+ if (rv != APR_SUCCESS) { >+ ap_log_perror(APLOG_MARK, APLOG_ERR, rv, pool, >+ "Failed to acquire DBD connection from pool!"); >+ break; >+ } >+ rv = apr_dbd_check_conn(arec->driver, pool, arec->handle); >+ if ((rv == APR_SUCCESS) || (rv == APR_ENOTIMPL)) { >+ break; >+ } > errmsg = apr_dbd_error(arec->driver, arec->handle, rv); > if (!errmsg) { > errmsg = "(unknown)"; >@@ -460,9 +475,9 @@ > ap_log_perror(APLOG_MARK, APLOG_ERR, rv, pool, > "DBD[%s] Error: %s", svr->name, errmsg ); > apr_reslist_invalidate(svr->dbpool, rec); >- return NULL; >- } >- return arec; >+ } while (--tries > 0); >+ >+ return ((rv == APR_SUCCESS) || (rv == APR_ENOTIMPL)) ? arec : NULL; > } > #else > DBD_DECLARE_NONSTD(ap_dbd_t*) ap_dbd_open(apr_pool_t *pool, server_rec *s)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39329
:
18116
| 18244 |
18318
|
18989
|
20794