Permalink
Browse files

now we make the has_set_names flag persistent in the connection pool …

…(if available) and also fixed a invalid read bug in send_query.
  • Loading branch information...
1 parent 68dcfef commit f027fa90e29eb23a7e57ff0670b14e12023adb32 @agentzh agentzh committed Oct 19, 2010
@@ -179,6 +179,7 @@ ngx_http_drizzle_keepalive_get_peer_single(ngx_peer_connection_t *pc,
dp->name = &item->name;
dp->drizzle_con = item->drizzle_con;
+ dp->has_set_names = item->has_set_names;
return NGX_DONE;
}
@@ -226,6 +227,7 @@ ngx_http_drizzle_keepalive_get_peer_multi(ngx_peer_connection_t *pc,
dp->name = &item->name;
dp->drizzle_con = item->drizzle_con;
+ dp->has_set_names = item->has_set_names;
return NGX_DONE;
}
@@ -314,6 +316,7 @@ ngx_http_drizzle_keepalive_free_peer(ngx_peer_connection_t *pc,
ngx_memcpy(&item->sockaddr, pc->sockaddr, pc->socklen);
item->drizzle_con = dp->drizzle_con;
+ item->has_set_names = dp->has_set_names;
}
}
@@ -17,6 +17,7 @@ typedef struct {
struct sockaddr_storage sockaddr;
drizzle_con_st *drizzle_con;
ngx_str_t name;
+ ngx_flag_t has_set_names;
} ngx_http_drizzle_keepalive_cache_t;
@@ -164,6 +164,7 @@ ngx_http_upstream_drizzle_send_query(ngx_http_request_t *r,
ngx_int_t rc;
char *query_data;
size_t query_len;
+ ngx_flag_t has_set_names;
if (! dp->has_set_names) {
query_data = "set names 'utf8'";
@@ -241,6 +242,7 @@ ngx_http_upstream_drizzle_send_query(ngx_http_request_t *r,
dd("after drizzle restult");
+ has_set_names = dp->has_set_names;
rc = ngx_http_drizzle_output_result_header(r, &dp->drizzle_res);
dd("after output result header YYY");
@@ -252,7 +254,7 @@ ngx_http_upstream_drizzle_send_query(ngx_http_request_t *r,
}
if (rc == NGX_DONE) {
- if (! dp->has_set_names) {
+ if (! has_set_names) {
c->log->action = "connecting to drizzle upstream";
dp->has_set_names = 1;
@@ -215,3 +215,20 @@
fun:main
}
+{
+ <insert_a_suppression_name_here>
+ Memcheck:Leak
+ fun:malloc
+ fun:ngx_alloc
+ fun:ngx_palloc_large
+ fun:ngx_palloc
+ fun:ngx_array_push
+ fun:ngx_hash_add_key
+ fun:ngx_http_add_variable
+ fun:ngx_http_ssi_preconfiguration
+ fun:ngx_http_block
+ fun:ngx_conf_parse
+ fun:ngx_init_cycle
+ fun:main
+}
+

0 comments on commit f027fa9

Please sign in to comment.