Author: poeml Date: Wed Jul 29 12:41:48 2009 New Revision: 7719 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?view=revision&revision=7719 Log: mod_mirrorbrain: - if retrieving a prepared statement fails, log additional information that might be useful for debugging. Log the label of the statement, and dump the existing prepared statements to the log. - log a hint which says that connection strings defined with DBDParams must be unique, and identical strings cannot be used in two virtual hosts. Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c ============================================================================== --- trunk/mod_mirrorbrain/mod_mirrorbrain.c Wed Jul 29 11:37:05 2009 (r7718) +++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Wed Jul 29 12:41:48 2009 (r7719) _at_@ -249,6 +249,12 @@ /* make a label */ cfg->query_prep = apr_psprintf(pconf, "mirrorbrain_dbd_%d", ++label_num); mb_dbd_prepare_fn(sp, cfg->query, cfg->query_prep); + + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, + "[mod_mirrorbrain] prepared: server %s, label_num %d, query_prep %s", + s->server_hostname, + label_num, + cfg->query_prep); } return OK; _at_@ -995,8 +1001,31 @@ debugLog(r, cfg, "Successfully acquired database connection."); statement = apr_hash_get(dbd->prepared, scfg->query_prep, APR_HASH_KEY_STRING); + if (statement == NULL) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "[mod_mirrorbrain] Could not get prepared statement!"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "[mod_mirrorbrain] Could not get prepared statement labelled '%s'", + scfg->query_prep); + + /* log existing prepared statements. It might help with figuring out + * misconfigurations */ + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "[mod_mirrorbrain] dbd->prepared hash contains %d key/value pairs", + apr_hash_count(dbd->prepared)); + + apr_hash_index_t *hi; + const char *label, *query; + for (hi = apr_hash_first(r->pool, dbd->prepared); hi; hi = apr_hash_next(hi)) { + apr_hash_this(hi, (void*) &label, NULL, (void*) &query); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "[mod_mirrorbrain] dbd->prepared dump: key %s, value 0x%08lx", label, (long)query); + } + + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "[mod_mirrorbrain] Hint: connection strings defined with " + "DBDParams must be unique. The same string cannot be used " + "in two vhosts."); + return DECLINED; } _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Wed Jul 29 2009 - 10:41:49 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT