proxy_info("Creating new server in HG %d : %s:%d , weight=%d, status=%d\n",atoi(r->fields[0]),r->fields[1],atoi(r->fields[2]),atoi(r->fields[3]),(MySerStatus)atoi(r->fields[4]));
}
PgSQL_SrvC*mysrvc=newPgSQL_SrvC(r->fields[1],atoi(r->fields[2]),atoi(r->fields[3]),(MySerStatus)atoi(r->fields[4]),atoi(r->fields[5]),atoi(r->fields[6]),atoi(r->fields[7]),atoi(r->fields[8]),atoi(r->fields[9]),r->fields[10]);// add new fields here if adding more columns in pgsql_servers
// carefully increase the 2nd index by 1 for every new column added
if(atoi(r->fields[3])!=atoi(r->fields[12])){
if(GloMTH->variables.hostgroup_manager_verbose)
if(GloPTH->variables.hostgroup_manager_verbose)
proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL,5,"Changing weight for server %d:%s:%d (%s:%d) from %d (%ld) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[3]),mysrvc->weight,atoi(r->fields[12]));
mysrvc->weight=atoi(r->fields[12]);
}
if(atoi(r->fields[4])!=atoi(r->fields[13])){
if(GloMTH->variables.hostgroup_manager_verbose)
if(GloPTH->variables.hostgroup_manager_verbose)
proxy_info("Changing status for server %d:%s:%d (%s:%d) from %d (%d) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[4]),mysrvc->status,atoi(r->fields[13]));
proxy_info("Changing compression for server %d:%s:%d (%s:%d) from %d (%d) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[5]),mysrvc->compression,atoi(r->fields[14]));
mysrvc->compression=atoi(r->fields[14]);
}
if(atoi(r->fields[6])!=atoi(r->fields[15])){
if(GloMTH->variables.hostgroup_manager_verbose)
if(GloPTH->variables.hostgroup_manager_verbose)
proxy_info("Changing max_connections for server %d:%s:%d (%s:%d) from %d (%ld) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[6]),mysrvc->max_connections,atoi(r->fields[15]));
mysrvc->max_connections=atoi(r->fields[15]);
}
if(atoi(r->fields[7])!=atoi(r->fields[16])){
if(GloMTH->variables.hostgroup_manager_verbose)
if(GloPTH->variables.hostgroup_manager_verbose)
proxy_info("Changing max_replication_lag for server %u:%s:%d (%s:%d) from %d (%d) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[7]),mysrvc->max_replication_lag,atoi(r->fields[16]));
mysrvc->max_replication_lag=atoi(r->fields[16]);
if(mysrvc->max_replication_lag==0){// we just changed it to 0
proxy_info("Changing use_ssl for server %d:%s:%d (%s:%d) from %d (%d) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[8]),mysrvc->use_ssl,atoi(r->fields[17]));
mysrvc->use_ssl=atoi(r->fields[17]);
}
if(atoi(r->fields[9])!=atoi(r->fields[18])){
if(GloMTH->variables.hostgroup_manager_verbose)
if(GloPTH->variables.hostgroup_manager_verbose)
proxy_info("Changing max_latency_ms for server %d:%s:%d (%s:%d) from %d (%d) to %d\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),atoi(r->fields[9]),mysrvc->max_latency_us/1000,atoi(r->fields[18]));
mysrvc->max_latency_us=1000*atoi(r->fields[18]);
}
if(strcmp(r->fields[10],r->fields[19])){
if(GloMTH->variables.hostgroup_manager_verbose)
if(GloPTH->variables.hostgroup_manager_verbose)
proxy_info("Changing comment for server %d:%s:%d (%s:%d) from '%s' to '%s'\n",mysrvc->myhgc->hid,mysrvc->address,mysrvc->port,r->fields[1],atoi(r->fields[2]),r->fields[10],r->fields[19]);
proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL,7,"Returning PgSQL_Connection %p, server %s:%d with status %d\n",c,mysrvc->address,mysrvc->port,mysrvc->status);
proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL,7,"Destroying PgSQL_Connection %p, server %s:%d with status %d . largest_query_length = %lu\n",c,mysrvc->address,mysrvc->port,mysrvc->status,c->largest_query_length);
proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL,7,"Destroying PgSQL_Connection %p, server %s:%d with status %d because has too many prepared statements\n",c,mysrvc->address,mysrvc->port,mysrvc->status);
if(c->local_stmts->get_num_backend_stmts()>(unsignedint)GloPTH->variables.max_stmts_per_connection){// Check if the connection has too many prepared statements
// Log debug information about destroying the connection due to too many prepared statements
proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL,7,"Destroying PgSQL_Connection %p, server %s:%d with status %d because has too many prepared statements\n",c,mysrvc->address,mysrvc->port,(int)mysrvc->status);
mysrvc->ConnectionsUsed->add(c);// Add the connection back to the list of used connections
destroy_MyConn_from_pool(c,false);// Destroy the connection from the pool
}else{*/
mysrvc->ConnectionsFree->add(c);
//}
}else{
mysrvc->ConnectionsFree->add(c);// Add the connection to the list of free connections
}
}else{
proxy_debug(PROXY_DEBUG_MYSQL_CONNPOOL,7,"Destroying PgSQL_Connection %p, server %s:%d with status %d\n",c,mysrvc->address,mysrvc->port,mysrvc->status);
(mysrvc->shunned_and_kill_all_connections==true&&mysrvc->ConnectionsUsed->conns_length()==0&&mysrvc->ConnectionsFree->conns_length()==0)// if shunned_and_kill_all_connections is set, ensure all connections are already dropped
(mysrvc->shunned_and_kill_all_connections==true&&mysrvc->ConnectionsUsed->conns_length()==0&&mysrvc->ConnectionsFree->conns_length()==0)// if shunned_and_kill_all_connections is set, ensure all connections are already dropped