proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR,5,"query rule %d has no matching pattern\n",qr->rule_id);
continue;
}
}
// if we arrived here, we have a match
if(ret==NULL){
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR,5,"this is the first time we find a match\n");
// create struct
ret=(QP_out_t*)l_alloc(sizeof(QP_out_t));
ret->cache_ttl=qr->cache_ttl;
// initalized all values
ret->ptr=NULL;
ret->size=0;
ret->destination_hostgroup=-1;
ret->cache_ttl=-1;
ret->new_query=NULL;
}
//__sync_fetch_and _add(&qr->hits,1);
qr->hits++;// this is done without atomic function because it updates only the local variables
//ret=(QP_out_t *)malloc(sizeof(QP_out_t));
if(qr->flagOUT>=0){
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR,5,"query rule %d has changed flagOUT\n",qr->rule_id);
flagIN=qr->flagOUT;
//sess->query_info.flagOUT=flagIN;
}
if(qr->cache_ttl>=0){
// Note: negative TTL means this rule doesn't change
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR,5,"query rule %d has set cache_ttl: %d. Query will%s hit the cache\n",qr->rule_id,qr->cache_ttl,(qr->cache_ttl==0?" NOT":""));
ret->cache_ttl=qr->cache_ttl;
}
if(qr->destination_hostgroup>=0){
// Note: negative TTL means this rule doesn't change
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR,5,"query rule %d has set destination hostgroup: %d\n",qr->rule_id,qr->destination_hostgroup);
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR,5,"query rule %d on match_pattern \"%s\" has a replace_pattern \"%s\" to apply\n",qr->rule_id,qr->match_pattern,qr->replace_pattern);