LOGIFs removed from schemarouters.
This commit is contained in:
@ -372,7 +372,7 @@ showdb_response_t parse_showdb_response(ROUTER_CLIENT_SES* rses, backend_ref_t*
|
||||
|
||||
if (PTR_IS_ERR(ptr))
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE, "schemarouter: SHOW DATABASES returned an error.");
|
||||
MXS_INFO("schemarouter: SHOW DATABASES returned an error.");
|
||||
gwbuf_free(buf);
|
||||
return SHOWDB_FATAL_ERROR;
|
||||
}
|
||||
@ -387,7 +387,7 @@ showdb_response_t parse_showdb_response(ROUTER_CLIENT_SES* rses, backend_ref_t*
|
||||
|
||||
if (ptr >= (unsigned char*) buf->end)
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE, "schemarouter: Malformed packet for SHOW DATABASES.");
|
||||
MXS_INFO("schemarouter: Malformed packet for SHOW DATABASES.");
|
||||
*buffer = gwbuf_append(buf, *buffer);
|
||||
return SHOWDB_FATAL_ERROR;
|
||||
}
|
||||
@ -408,7 +408,7 @@ showdb_response_t parse_showdb_response(ROUTER_CLIENT_SES* rses, backend_ref_t*
|
||||
{
|
||||
if (hashtable_add(rses->shardmap->hash, data, target))
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE, "schemarouter: <%s, %s>", target, data);
|
||||
MXS_INFO("schemarouter: <%s, %s>", target, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -419,7 +419,7 @@ showdb_response_t parse_showdb_response(ROUTER_CLIENT_SES* rses, backend_ref_t*
|
||||
rses->router->ignore_match_data, NULL) >= 0)))
|
||||
{
|
||||
duplicate_found = true;
|
||||
skygw_log_write(LE, "Error: Database '%s' found on servers '%s' and '%s' for user %s@%s.",
|
||||
MXS_ERROR("Database '%s' found on servers '%s' and '%s' for user %s@%s.",
|
||||
data, target,
|
||||
(char*)hashtable_fetch(rses->shardmap->hash, data),
|
||||
rses->rses_client_dcb->user,
|
||||
@ -436,12 +436,12 @@ showdb_response_t parse_showdb_response(ROUTER_CLIENT_SES* rses, backend_ref_t*
|
||||
bref->n_mapping_eof == 1)
|
||||
{
|
||||
atomic_add(&bref->n_mapping_eof, 1);
|
||||
skygw_log_write(LOGFILE_TRACE, "schemarouter: SHOW DATABASES fully received from %s.",
|
||||
MXS_INFO("schemarouter: SHOW DATABASES fully received from %s.",
|
||||
bref->bref_backend->backend_server->unique_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE, "schemarouter: SHOW DATABASES partially received from %s.",
|
||||
MXS_INFO("schemarouter: SHOW DATABASES partially received from %s.",
|
||||
bref->bref_backend->backend_server->unique_name);
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ int gen_databaselist(ROUTER_INSTANCE* inst, ROUTER_CLIENT_SES* session)
|
||||
clone = gwbuf_clone(buffer);
|
||||
dcb = session->rses_backend_ref[i].bref_dcb;
|
||||
rval |= !dcb->func.write(dcb,clone);
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Wrote SHOW DATABASES to %s for session %p: returned %d",
|
||||
MXS_DEBUG("schemarouter: Wrote SHOW DATABASES to %s for session %p: returned %d",
|
||||
session->rses_backend_ref[i].bref_backend->backend_server->unique_name,
|
||||
session->rses_client_dcb->session,
|
||||
rval);
|
||||
@ -544,7 +544,7 @@ char* get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client,
|
||||
/** Warn about improper usage of the router */
|
||||
if(rval && strcmp(name,rval) != 0)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"Error : Schemarouter: Query targets databases on servers '%s' and '%s'. "
|
||||
MXS_ERROR("Schemarouter: Query targets databases on servers '%s' and '%s'. "
|
||||
"Cross database queries across servers are not supported."
|
||||
,rval,name);
|
||||
}
|
||||
@ -552,7 +552,7 @@ char* get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client,
|
||||
{
|
||||
rval = name;
|
||||
has_dbs = true;
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Query targets database '%s' on server '%s'",dbnms[i],rval);
|
||||
MXS_INFO("schemarouter: Query targets database '%s' on server '%s'",dbnms[i],rval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -575,14 +575,14 @@ char* get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client,
|
||||
tmp = (char*) hashtable_fetch(ht, tok);
|
||||
|
||||
if(tmp)
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: SHOW TABLES with specific database '%s' on server '%s'", tok, tmp);
|
||||
MXS_INFO("schemarouter: SHOW TABLES with specific database '%s' on server '%s'", tok, tmp);
|
||||
}
|
||||
free(query);
|
||||
|
||||
if(tmp == NULL)
|
||||
{
|
||||
rval = (char*) hashtable_fetch(ht, client->current_db);
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: SHOW TABLES query, current database '%s' on server '%s'",
|
||||
MXS_INFO("schemarouter: SHOW TABLES query, current database '%s' on server '%s'",
|
||||
client->current_db,rval);
|
||||
}
|
||||
else
|
||||
@ -602,7 +602,7 @@ char* get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client,
|
||||
if(strcmp(srvnm,buffer->hint->data) == 0)
|
||||
{
|
||||
rval = srvnm;
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Routing hint found (%s)",srvnm);
|
||||
MXS_INFO("schemarouter: Routing hint found (%s)",srvnm);
|
||||
|
||||
}
|
||||
}
|
||||
@ -618,7 +618,7 @@ char* get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client,
|
||||
rval = (char*) hashtable_fetch(ht, client->current_db);
|
||||
if(rval)
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Using active database '%s'",client->current_db);
|
||||
MXS_INFO("schemarouter: Using active database '%s'",client->current_db);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -679,10 +679,8 @@ char** tokenize_string(char* str)
|
||||
if(tmp == NULL)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : realloc returned NULL: %s.",
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)))));
|
||||
MXS_ERROR("realloc returned NULL: %s.",
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
free(list);
|
||||
return NULL;
|
||||
}
|
||||
@ -750,9 +748,7 @@ version()
|
||||
void
|
||||
ModuleInit()
|
||||
{
|
||||
LOGIF(LM, (skygw_log_write_flush(
|
||||
LOGFILE_MESSAGE,
|
||||
"Initializing Schema Sharding Router.")));
|
||||
MXS_NOTICE("Initializing Schema Sharding Router.");
|
||||
spinlock_init(&instlock);
|
||||
instances = NULL;
|
||||
}
|
||||
@ -794,7 +790,7 @@ createInstance(SERVICE *service, char **options)
|
||||
}
|
||||
if((router->ignored_dbs = hashtable_alloc(SCHEMAROUTER_HASHSIZE, hashkeyfun, hashcmpfun)) == NULL)
|
||||
{
|
||||
skygw_log_write(LE,"Error: Memory allocation failed when allocating schemarouter database ignore list.");
|
||||
MXS_ERROR("Memory allocation failed when allocating schemarouter database ignore list.");
|
||||
free(router);
|
||||
return NULL;
|
||||
}
|
||||
@ -805,7 +801,7 @@ createInstance(SERVICE *service, char **options)
|
||||
|
||||
if ((router->shard_maps = hashtable_alloc(SCHEMAROUTER_USERHASH_SIZE, hashkeyfun, hashcmpfun)) == NULL)
|
||||
{
|
||||
skygw_log_write(LE, "Error: Memory allocation failed when allocating schemarouter database ignore list.");
|
||||
MXS_ERROR("Memory allocation failed when allocating schemarouter database ignore list.");
|
||||
hashtable_free(router->ignored_dbs);
|
||||
free(router);
|
||||
return NULL;
|
||||
@ -838,7 +834,7 @@ createInstance(SERVICE *service, char **options)
|
||||
conf = service->svc_config_param;
|
||||
if((config_get_param(conf,"auth_all_servers")) == NULL)
|
||||
{
|
||||
skygw_log_write(LOGFILE_MESSAGE,"Schemarouter: Authentication data is fetched from all servers. To disable this "
|
||||
MXS_NOTICE("Schemarouter: Authentication data is fetched from all servers. To disable this "
|
||||
"add 'auth_all_servers=0' to the service.");
|
||||
service->users_from_all = true;
|
||||
}
|
||||
@ -854,7 +850,7 @@ createInstance(SERVICE *service, char **options)
|
||||
{
|
||||
PCRE2_UCHAR errbuf[512];
|
||||
pcre2_get_error_message(errcode, errbuf, sizeof(errbuf));
|
||||
skygw_log_write(LE, "Error: Regex compilation failed at %d for regex '%s': %s",
|
||||
MXS_ERROR("Regex compilation failed at %d for regex '%s': %s",
|
||||
(int)erroffset, param->value, errbuf);
|
||||
hashtable_free(router->ignored_dbs);
|
||||
free(router);
|
||||
@ -865,7 +861,7 @@ createInstance(SERVICE *service, char **options)
|
||||
|
||||
if (match_data == NULL)
|
||||
{
|
||||
skygw_log_write(LE, "Error: PCRE2 match data creation failed. This"
|
||||
MXS_ERROR("PCRE2 match data creation failed. This"
|
||||
" is most likely caused by a lack of available memory.");
|
||||
pcre2_code_free(re);
|
||||
hashtable_free(router->ignored_dbs);
|
||||
@ -897,7 +893,7 @@ createInstance(SERVICE *service, char **options)
|
||||
char* value;
|
||||
if((value = strchr(options[i],'=')) == NULL)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"Error: Unknown router options for Schemarouter: %s",options[i]);
|
||||
MXS_ERROR("Unknown router options for Schemarouter: %s",options[i]);
|
||||
failure = true;
|
||||
break;
|
||||
}
|
||||
@ -925,7 +921,7 @@ createInstance(SERVICE *service, char **options)
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"Error: Unknown router options for Schemarouter: %s",options[i]);
|
||||
MXS_ERROR("Unknown router options for Schemarouter: %s",options[i]);
|
||||
failure = true;
|
||||
break;
|
||||
}
|
||||
@ -1087,13 +1083,13 @@ static void* newSession(
|
||||
strncpy(db,data->db,MYSQL_DATABASE_MAXLEN);
|
||||
memset(data->db,0,MYSQL_DATABASE_MAXLEN+1);
|
||||
using_db = true;
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Client logging in directly to a database '%s', "
|
||||
MXS_INFO("schemarouter: Client logging in directly to a database '%s', "
|
||||
"postponing until databases have been mapped.",db);
|
||||
}
|
||||
|
||||
if(!have_db)
|
||||
{
|
||||
LOGIF(LT,(skygw_log_write(LT,"schemarouter: Client'%s' connecting with empty database.",data->user)));
|
||||
MXS_INFO("schemarouter: Client'%s' connecting with empty database.",data->user);
|
||||
}
|
||||
|
||||
spinlock_release(&session->ses_lock);
|
||||
@ -1130,7 +1126,7 @@ static void* newSession(
|
||||
{
|
||||
if ((map = shard_map_alloc()) == NULL)
|
||||
{
|
||||
skygw_log_write(LE, "Error: Failed to allocate enough memory to create"
|
||||
MXS_ERROR("Failed to allocate enough memory to create"
|
||||
"new shard mapping. Session will be closed.");
|
||||
free(client_rses);
|
||||
return NULL;
|
||||
@ -1306,9 +1302,7 @@ static void closeSession(
|
||||
ROUTER_INSTANCE* inst;
|
||||
backend_ref_t* backend_ref;
|
||||
|
||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||
"%lu [schemarouter:closeSession]",
|
||||
pthread_self())));
|
||||
MXS_DEBUG("%lu [schemarouter:closeSession]", pthread_self());
|
||||
|
||||
/**
|
||||
* router session can be NULL if newSession failed and it is discarding
|
||||
@ -1560,10 +1554,7 @@ static route_target_t get_shard_route_target (
|
||||
target = TARGET_ANY;
|
||||
}
|
||||
#if defined(SS_DEBUG)
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Selected target type \"%s\"",
|
||||
STRTARGET(target))));
|
||||
MXS_INFO("Selected target type \"%s\"", STRTARGET(target));
|
||||
#endif
|
||||
return target;
|
||||
}
|
||||
@ -1611,8 +1602,7 @@ ROUTER* instance,
|
||||
if (hashtable_delete(rses_prop_tmp->rses_prop_data.temp_tables,
|
||||
(void *)hkey))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||
"Temporary table dropped: %s",hkey)));
|
||||
MXS_INFO("Temporary table dropped: %s",hkey);
|
||||
}
|
||||
}
|
||||
free(tbl[i]);
|
||||
@ -1679,9 +1669,7 @@ ROUTER* instance,
|
||||
{
|
||||
/**Query target is a temporary table*/
|
||||
qtype = QUERY_TYPE_READ_TMP_TABLE;
|
||||
LOGIF(LT,
|
||||
(skygw_log_write(LOGFILE_TRACE,
|
||||
"Query targets a temporary table: %s",hkey)));
|
||||
MXS_INFO("Query targets a temporary table: %s",hkey);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1768,7 +1756,7 @@ void check_create_tmp_table(
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error : Call to malloc() failed.")));
|
||||
MXS_ERROR("Call to malloc() failed.");
|
||||
}
|
||||
}
|
||||
if(rses_prop_tmp){
|
||||
@ -1780,7 +1768,7 @@ void check_create_tmp_table(
|
||||
{
|
||||
rses_prop_tmp->rses_prop_data.temp_tables = h;
|
||||
}else{
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,"Error : Failed to allocate a new hashtable.")));
|
||||
MXS_ERROR("Failed to allocate a new hashtable.");
|
||||
}
|
||||
|
||||
}
|
||||
@ -1790,10 +1778,7 @@ void check_create_tmp_table(
|
||||
(void *)hkey,
|
||||
(void *)is_temp) == 0) /*< Conflict in hash table */
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Temporary table conflict in hashtable: %s",
|
||||
hkey)));
|
||||
MXS_INFO("Temporary table conflict in hashtable: %s", hkey);
|
||||
}
|
||||
#if defined(SS_DEBUG)
|
||||
{
|
||||
@ -1803,10 +1788,7 @@ void check_create_tmp_table(
|
||||
hkey);
|
||||
if (retkey)
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Temporary table added: %s",
|
||||
hkey)));
|
||||
MXS_INFO("Temporary table added: %s", hkey);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1958,9 +1940,7 @@ static int routeQuery(
|
||||
|
||||
if (!rses_begin_locked_router_action(router_cli_ses))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query aborted! Routing session is closed <")));
|
||||
MXS_INFO("Route query aborted! Routing session is closed <");
|
||||
ret = 0;
|
||||
goto retblock;
|
||||
}
|
||||
@ -1984,7 +1964,7 @@ static int routeQuery(
|
||||
{
|
||||
int init_rval = 1;
|
||||
char* querystr = modutil_get_SQL(querybuf);
|
||||
skygw_log_write(LOGFILE_DEBUG|LOGFILE_TRACE,"schemarouter: Storing query for session %p: %s",
|
||||
MXS_INFO("schemarouter: Storing query for session %p: %s",
|
||||
router_cli_ses->rses_client_dcb->session,
|
||||
querystr);
|
||||
free(querystr);
|
||||
@ -2038,14 +2018,11 @@ static int routeQuery(
|
||||
{
|
||||
char* query_str = modutil_get_query(querybuf);
|
||||
|
||||
LOGIF(LE,
|
||||
(skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Can't route %s:%s:\"%s\" to "
|
||||
MXS_ERROR("Can't route %s:%s:\"%s\" to "
|
||||
"backend server. Router is closed.",
|
||||
STRPACKETTYPE(packet_type),
|
||||
STRQTYPE(qtype),
|
||||
(query_str == NULL ? "(empty)" : query_str))));
|
||||
(query_str == NULL ? "(empty)" : query_str));
|
||||
free(query_str);
|
||||
}
|
||||
ret = 0;
|
||||
@ -2120,11 +2097,8 @@ static int routeQuery(
|
||||
char* contentstr = strndup(data, len);
|
||||
char* qtypestr = skygw_get_qtype_str(qtype);
|
||||
|
||||
skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"> Cmd: %s, type: %s, "
|
||||
MXS_INFO("> Cmd: %s, type: %s, "
|
||||
"stmt: %s%s %s",
|
||||
|
||||
STRPACKETTYPE(ptype),
|
||||
(qtypestr==NULL ? "N/A" : qtypestr),
|
||||
contentstr,
|
||||
@ -2189,9 +2163,7 @@ static int routeQuery(
|
||||
SCHEMA_ERRSTR_DBNOTFOUND,
|
||||
errbuf);
|
||||
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Changing database failed.")));
|
||||
MXS_ERROR("Changing database failed.");
|
||||
ret = 1;
|
||||
goto retblock;
|
||||
}
|
||||
@ -2222,14 +2194,14 @@ static int routeQuery(
|
||||
|
||||
if(tname)
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: INIT_DB for database '%s' on server '%s'",
|
||||
MXS_INFO("schemarouter: INIT_DB for database '%s' on server '%s'",
|
||||
router_cli_ses->current_db,tname);
|
||||
route_target = TARGET_NAMED_SERVER;
|
||||
targetserver = strdup(tname);
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: INIT_DB with unknown database");
|
||||
MXS_INFO("schemarouter: INIT_DB with unknown database");
|
||||
}
|
||||
spinlock_release(&router_cli_ses->shardmap->lock);
|
||||
}
|
||||
@ -2252,7 +2224,7 @@ static int routeQuery(
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Backend server '%s' is not in a viable state",tname);
|
||||
MXS_INFO("schemarouter: Backend server '%s' is not in a viable state",tname);
|
||||
|
||||
/**
|
||||
* Shard is not a viable target right now so we check
|
||||
@ -2281,7 +2253,7 @@ static int routeQuery(
|
||||
*/
|
||||
|
||||
route_target = TARGET_ANY;
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: Routing query to first available backend.");
|
||||
MXS_INFO("schemarouter: Routing query to first available backend.");
|
||||
|
||||
}
|
||||
else
|
||||
@ -2301,7 +2273,7 @@ static int routeQuery(
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR, "Error : Router internal failure (schemarouter)");
|
||||
MXS_ERROR("Error : Router internal failure (schemarouter)");
|
||||
/** Something else went wrong, terminate connection */
|
||||
ret = 0;
|
||||
}
|
||||
@ -2337,9 +2309,7 @@ static int routeQuery(
|
||||
/** Lock router session */
|
||||
if (!rses_begin_locked_router_action(router_cli_ses))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query aborted! Routing session is closed <")));
|
||||
MXS_INFO("Route query aborted! Routing session is closed <");
|
||||
ret = 0;
|
||||
goto retblock;
|
||||
}
|
||||
@ -2362,9 +2332,8 @@ static int routeQuery(
|
||||
{
|
||||
|
||||
/**No valid backends alive*/
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: No backends are running");
|
||||
skygw_log_write(LOGFILE_ERROR,
|
||||
"Error: Schemarouter: Failed to route query, "
|
||||
MXS_INFO("schemarouter: No backends are running");
|
||||
MXS_ERROR("Schemarouter: Failed to route query, "
|
||||
"no backends are available.");
|
||||
rses_end_locked_router_action(router_cli_ses);
|
||||
ret = 0;
|
||||
@ -2387,12 +2356,9 @@ static int routeQuery(
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Was supposed to route to named server "
|
||||
MXS_INFO("Was supposed to route to named server "
|
||||
"%s but couldn't find the server in a "
|
||||
"suitable state.",
|
||||
targetserver)));
|
||||
"suitable state.", targetserver);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2405,11 +2371,9 @@ static int routeQuery(
|
||||
bref = get_bref_from_dcb(router_cli_ses, target_dcb);
|
||||
scur = &bref->bref_sescmd_cur;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query to \t%s:%d <",
|
||||
MXS_INFO("Route query to \t%s:%d <",
|
||||
bref->bref_backend->backend_server->name,
|
||||
bref->bref_backend->backend_server->port)));
|
||||
bref->bref_backend->backend_server->port);
|
||||
/**
|
||||
* Store current stmt if execution of previous session command
|
||||
* haven't completed yet. Note that according to MySQL protocol
|
||||
@ -2442,9 +2406,7 @@ static int routeQuery(
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Routing query failed.")));
|
||||
MXS_ERROR("Routing query failed.");
|
||||
}
|
||||
}
|
||||
rses_end_locked_router_action(router_cli_ses);
|
||||
@ -2644,7 +2606,7 @@ static void clientReply(ROUTER* instance,
|
||||
return;
|
||||
}
|
||||
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: Reply from [%s] session [%p]"
|
||||
MXS_DEBUG("schemarouter: Reply from [%s] session [%p]"
|
||||
" mapping [%s] queries queued [%s]",
|
||||
bref->bref_backend->backend_server->unique_name,
|
||||
router_cli_ses->rses_client_dcb->session,
|
||||
@ -2700,8 +2662,7 @@ static void clientReply(ROUTER* instance,
|
||||
ss_dassert(router_cli_ses->init == INIT_READY);
|
||||
route_queued_query(router_cli_ses);
|
||||
}
|
||||
skygw_log_write_flush(LOGFILE_DEBUG,
|
||||
"session [%p] database map finished.",
|
||||
MXS_DEBUG("session [%p] database map finished.",
|
||||
router_cli_ses);
|
||||
}
|
||||
|
||||
@ -2716,7 +2677,7 @@ static void clientReply(ROUTER* instance,
|
||||
|
||||
if (router_cli_ses->init & INIT_USE_DB)
|
||||
{
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: Reply to USE '%s' received for session %p",
|
||||
MXS_DEBUG("schemarouter: Reply to USE '%s' received for session %p",
|
||||
router_cli_ses->connect_db,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
router_cli_ses->init &= ~INIT_USE_DB;
|
||||
@ -2767,14 +2728,12 @@ static void clientReply(ROUTER* instance,
|
||||
|
||||
ss_dassert(len + 4 == GWBUF_LENGTH(scur->scmd_cur_cmd->my_sescmd_buf));
|
||||
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Failed to execute %s in %s:%d. %s %s",
|
||||
MXS_ERROR("Failed to execute %s in %s:%d. %s %s",
|
||||
cmdstr,
|
||||
bref->bref_backend->backend_server->name,
|
||||
bref->bref_backend->backend_server->port,
|
||||
err,
|
||||
replystr)));
|
||||
replystr);
|
||||
|
||||
free(cmdstr);
|
||||
free(err);
|
||||
@ -2817,7 +2776,7 @@ static void clientReply(ROUTER* instance,
|
||||
unsigned char* cmd = (unsigned char*) writebuf->start;
|
||||
int state = router_cli_ses->init;
|
||||
/** Write reply to client DCB */
|
||||
skygw_log_write(LOGFILE_TRACE, "schemarouter: returning reply [%s] "
|
||||
MXS_INFO("schemarouter: returning reply [%s] "
|
||||
"state [%s] session [%p]",
|
||||
PTR_IS_ERR(cmd) ? "ERR" : PTR_IS_OK(cmd) ? "OK" : "RSET",
|
||||
state & INIT_UNINT ? "UNINIT" : state & INIT_MAPPING ? "MAPPING" : "READY",
|
||||
@ -2837,12 +2796,10 @@ static void clientReply(ROUTER* instance,
|
||||
if (sescmd_cursor_is_active(scur))
|
||||
{
|
||||
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Backend %s:%d processed reply and starts to execute "
|
||||
MXS_INFO("Backend %s:%d processed reply and starts to execute "
|
||||
"active cursor.",
|
||||
bref->bref_backend->backend_server->name,
|
||||
bref->bref_backend->backend_server->port)));
|
||||
bref->bref_backend->backend_server->port);
|
||||
|
||||
execute_sescmd_in_backend(bref);
|
||||
}
|
||||
@ -2869,16 +2826,12 @@ static void clientReply(ROUTER* instance,
|
||||
|
||||
if (sql)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Routing query \"%s\" failed.", sql)));
|
||||
MXS_ERROR("Routing query \"%s\" failed.", sql);
|
||||
free(sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Routing query failed.")));
|
||||
MXS_ERROR("Routing query failed.");
|
||||
}
|
||||
}
|
||||
gwbuf_free(bref->bref_pending_cmd);
|
||||
@ -2947,7 +2900,7 @@ static void bref_clear_state(
|
||||
{
|
||||
if(bref == NULL)
|
||||
{
|
||||
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__);
|
||||
MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
if (state != BREF_WAITING_RESULT)
|
||||
@ -2973,7 +2926,7 @@ static void bref_clear_state(
|
||||
ss_dassert(prev2 > 0);
|
||||
if(prev2 <= 0)
|
||||
{
|
||||
skygw_log_write(LE,"[%s] Error: negative current operation count in backend %s:%u",
|
||||
MXS_ERROR("[%s] Error: negative current operation count in backend %s:%u",
|
||||
__FUNCTION__,
|
||||
bref->bref_backend->backend_server->name,
|
||||
bref->bref_backend->backend_server->port);
|
||||
@ -2988,7 +2941,7 @@ static void bref_set_state(
|
||||
{
|
||||
if(bref == NULL)
|
||||
{
|
||||
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__);
|
||||
MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
if (state != BREF_WAITING_RESULT)
|
||||
@ -3005,7 +2958,7 @@ static void bref_set_state(
|
||||
ss_dassert(prev1 >= 0);
|
||||
if(prev1 < 0)
|
||||
{
|
||||
skygw_log_write(LE,"[%s] Error: negative number of connections waiting "
|
||||
MXS_ERROR("[%s] Error: negative number of connections waiting "
|
||||
"for results in backend %s:%u",
|
||||
__FUNCTION__,
|
||||
bref->bref_backend->backend_server->name,
|
||||
@ -3017,7 +2970,7 @@ static void bref_set_state(
|
||||
ss_dassert(prev2 >= 0);
|
||||
if(prev2 < 0)
|
||||
{
|
||||
skygw_log_write(LE,"[%s] Error: negative current operation count in backend %s:%u",
|
||||
MXS_ERROR("[%s] Error: negative current operation count in backend %s:%u",
|
||||
__FUNCTION__,
|
||||
bref->bref_backend->backend_server->name,
|
||||
bref->bref_backend->backend_server->port);
|
||||
@ -3071,38 +3024,35 @@ static bool connect_backend_servers(
|
||||
|
||||
|
||||
#if defined(EXTRA_SS_DEBUG)
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "Servers and conns before ordering:")));
|
||||
MXS_INFO("Servers and conns before ordering:");
|
||||
|
||||
for (i=0; i<router_nservers; i++)
|
||||
{
|
||||
BACKEND* b = backend_ref[i].bref_backend;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||
"bref %p %d %s %d:%d",
|
||||
MXS_INFO("bref %p %d %s %d:%d",
|
||||
&backend_ref[i],
|
||||
backend_ref[i].bref_state,
|
||||
b->backend_server->name,
|
||||
b->backend_server->port,
|
||||
b->backend_conn_count)));
|
||||
b->backend_conn_count);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (LOG_IS_ENABLED(LOGFILE_TRACE))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||
"Servers and connection counts:")));
|
||||
MXS_INFO("Servers and connection counts:");
|
||||
|
||||
for (i=0; i<router_nservers; i++)
|
||||
{
|
||||
BACKEND* b = backend_ref[i].bref_backend;
|
||||
|
||||
LOGIF(LT, (skygw_log_write_flush(LOGFILE_TRACE,
|
||||
"MaxScale connections : %d (%d) in \t%s:%d %s",
|
||||
MXS_INFO("MaxScale connections : %d (%d) in \t%s:%d %s",
|
||||
b->backend_conn_count,
|
||||
b->backend_server->stats.n_current,
|
||||
b->backend_server->name,
|
||||
b->backend_server->port,
|
||||
STRSRVSTATUS(b->backend_server))));
|
||||
STRSRVSTATUS(b->backend_server));
|
||||
}
|
||||
} /*< log only */
|
||||
/**
|
||||
@ -3168,12 +3118,10 @@ static bool connect_backend_servers(
|
||||
else
|
||||
{
|
||||
succp = false;
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Unable to establish "
|
||||
MXS_ERROR("Unable to establish "
|
||||
"connection with slave %s:%d",
|
||||
b->backend_server->name,
|
||||
b->backend_server->port)));
|
||||
b->backend_server->port);
|
||||
/* handle connect error */
|
||||
break;
|
||||
}
|
||||
@ -3182,19 +3130,18 @@ static bool connect_backend_servers(
|
||||
} /*< for */
|
||||
|
||||
#if defined(EXTRA_SS_DEBUG)
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, "Servers and conns after ordering:")));
|
||||
MXS_INFO("Servers and conns after ordering:");
|
||||
|
||||
for (i=0; i<router_nservers; i++)
|
||||
{
|
||||
BACKEND* b = backend_ref[i].bref_backend;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||
"bref %p %d %s %d:%d",
|
||||
MXS_INFO("bref %p %d %s %d:%d",
|
||||
&backend_ref[i],
|
||||
backend_ref[i].bref_state,
|
||||
b->backend_server->name,
|
||||
b->backend_server->port,
|
||||
b->backend_conn_count)));
|
||||
b->backend_conn_count);
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
@ -3212,12 +3159,10 @@ static bool connect_backend_servers(
|
||||
|
||||
if (BREF_IS_IN_USE((&backend_ref[i])))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Connected %s in \t%s:%d",
|
||||
MXS_INFO("Connected %s in \t%s:%d",
|
||||
STRSRVSTATUS(b->backend_server),
|
||||
b->backend_server->name,
|
||||
b->backend_server->port)));
|
||||
b->backend_server->port);
|
||||
}
|
||||
} /* for */
|
||||
}
|
||||
@ -3269,13 +3214,11 @@ static void rses_property_done(
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [rses_property_done] Unknown property type %d "
|
||||
MXS_DEBUG("%lu [rses_property_done] Unknown property type %d "
|
||||
"in property %p",
|
||||
pthread_self(),
|
||||
prop->rses_prop_type,
|
||||
prop)));
|
||||
prop);
|
||||
|
||||
ss_dassert(false);
|
||||
break;
|
||||
@ -3610,9 +3553,7 @@ static bool execute_sescmd_in_backend(
|
||||
if (sescmd_cursor_get_command(scur) == NULL)
|
||||
{
|
||||
succp = false;
|
||||
LOGIF(LT, (skygw_log_write_flush(
|
||||
LOGFILE_TRACE,
|
||||
"Cursor had no pending session commands.")));
|
||||
MXS_INFO("Cursor had no pending session commands.");
|
||||
|
||||
goto return_succp;
|
||||
}
|
||||
@ -3623,23 +3564,24 @@ static bool execute_sescmd_in_backend(
|
||||
sescmd_cursor_set_active(scur, true);
|
||||
}
|
||||
#if defined(SS_DEBUG)
|
||||
LOGIF(LT, tracelog_routed_query(scur->scmd_cur_rses,
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
||||
{
|
||||
tracelog_routed_query(scur->scmd_cur_rses,
|
||||
"execute_sescmd_in_backend",
|
||||
backend_ref,
|
||||
sescmd_cursor_clone_querybuf(scur)));
|
||||
sescmd_cursor_clone_querybuf(scur));
|
||||
}
|
||||
|
||||
{
|
||||
GWBUF* tmpbuf = sescmd_cursor_clone_querybuf(scur);
|
||||
uint8_t* ptr = GWBUF_DATA(tmpbuf);
|
||||
unsigned char cmd = MYSQL_GET_COMMAND(ptr);
|
||||
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [execute_sescmd_in_backend] Just before write, fd "
|
||||
MXS_DEBUG("%lu [execute_sescmd_in_backend] Just before write, fd "
|
||||
"%d : cmd %s.",
|
||||
pthread_self(),
|
||||
dcb->fd,
|
||||
STRPACKETTYPE(cmd))));
|
||||
STRPACKETTYPE(cmd));
|
||||
gwbuf_free(tmpbuf);
|
||||
}
|
||||
#endif /*< SS_DEBUG */
|
||||
@ -3792,9 +3734,7 @@ static void tracelog_routed_query(
|
||||
querystr = (char *)malloc(len);
|
||||
memcpy(querystr, startpos, len-1);
|
||||
querystr[len-1] = '\0';
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
|
||||
MXS_DEBUG("%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
|
||||
pthread_self(),
|
||||
funcname,
|
||||
(int)buflen,
|
||||
@ -3802,7 +3742,7 @@ static void tracelog_routed_query(
|
||||
b->backend_server->name,
|
||||
b->backend_server->port,
|
||||
STRBETYPE(be_type),
|
||||
dcb)));
|
||||
dcb);
|
||||
free(querystr);
|
||||
}
|
||||
else if (packet_type == '\x22' ||
|
||||
@ -3814,9 +3754,7 @@ static void tracelog_routed_query(
|
||||
querystr = (char *)malloc(len);
|
||||
memcpy(querystr, startpos, len-1);
|
||||
querystr[len-1] = '\0';
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
|
||||
MXS_DEBUG("%lu [%s] %d bytes long buf, \"%s\" -> %s:%d %s dcb %p",
|
||||
pthread_self(),
|
||||
funcname,
|
||||
(int)buflen,
|
||||
@ -3824,7 +3762,7 @@ static void tracelog_routed_query(
|
||||
b->backend_server->name,
|
||||
b->backend_server->port,
|
||||
STRBETYPE(be_type),
|
||||
dcb)));
|
||||
dcb);
|
||||
free(querystr);
|
||||
}
|
||||
}
|
||||
@ -3864,9 +3802,7 @@ static bool route_session_write(
|
||||
backend_ref_t* backend_ref;
|
||||
int i;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Session write, routing to all servers.")));
|
||||
MXS_INFO("Session write, routing to all servers.");
|
||||
|
||||
backend_ref = router_cli_ses->rses_backend_ref;
|
||||
|
||||
@ -3897,14 +3833,12 @@ static bool route_session_write(
|
||||
|
||||
if (LOG_IS_ENABLED(LOGFILE_TRACE))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query to %s\t%s:%d%s",
|
||||
MXS_INFO("Route query to %s\t%s:%d%s",
|
||||
(SERVER_IS_MASTER(backend_ref[i].bref_backend->backend_server) ?
|
||||
"master" : "slave"),
|
||||
backend_ref[i].bref_backend->backend_server->name,
|
||||
backend_ref[i].bref_backend->backend_server->port,
|
||||
(i+1==router_cli_ses->rses_nbackends ? " <" : ""))));
|
||||
(i+1==router_cli_ses->rses_nbackends ? " <" : ""));
|
||||
}
|
||||
|
||||
if (BREF_IS_IN_USE((&backend_ref[i])))
|
||||
@ -3937,11 +3871,9 @@ static bool route_session_write(
|
||||
if(router_cli_ses->rses_config.max_sescmd_hist > 0 &&
|
||||
router_cli_ses->n_sescmd >= router_cli_ses->rses_config.max_sescmd_hist)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write(
|
||||
LOGFILE_ERROR|LOGFILE_TRACE,
|
||||
"Router session exceeded session command history limit of %d. "
|
||||
MXS_ERROR("Router session exceeded session command history limit of %d. "
|
||||
"Closing router session.",
|
||||
router_cli_ses->rses_config.max_sescmd_hist)));
|
||||
router_cli_ses->rses_config.max_sescmd_hist);
|
||||
gwbuf_free(querybuf);
|
||||
atomic_add(&router_cli_ses->router->stats.n_hist_exceeded,1);
|
||||
rses_end_locked_router_action(router_cli_ses);
|
||||
@ -4009,14 +3941,12 @@ static bool route_session_write(
|
||||
|
||||
if (LOG_IS_ENABLED(LOGFILE_TRACE))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query to %s\t%s:%d%s",
|
||||
MXS_INFO("Route query to %s\t%s:%d%s",
|
||||
(SERVER_IS_MASTER(backend_ref[i].bref_backend->backend_server) ?
|
||||
"master" : "slave"),
|
||||
backend_ref[i].bref_backend->backend_server->name,
|
||||
backend_ref[i].bref_backend->backend_server->port,
|
||||
(i+1==router_cli_ses->rses_nbackends ? " <" : ""))));
|
||||
(i+1==router_cli_ses->rses_nbackends ? " <" : ""));
|
||||
}
|
||||
|
||||
scur = backend_ref_get_sescmd_cursor(&backend_ref[i]);
|
||||
@ -4036,11 +3966,9 @@ static bool route_session_write(
|
||||
{
|
||||
succp = true;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Backend %s:%d already executing sescmd.",
|
||||
MXS_INFO("Backend %s:%d already executing sescmd.",
|
||||
backend_ref[i].bref_backend->backend_server->name,
|
||||
backend_ref[i].bref_backend->backend_server->port)));
|
||||
backend_ref[i].bref_backend->backend_server->port);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4048,12 +3976,10 @@ static bool route_session_write(
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Failed to execute session "
|
||||
MXS_ERROR("Failed to execute session "
|
||||
"command in %s:%d",
|
||||
backend_ref[i].bref_backend->backend_server->name,
|
||||
backend_ref[i].bref_backend->backend_server->port)));
|
||||
backend_ref[i].bref_backend->backend_server->port);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4307,7 +4233,7 @@ static bool handle_error_new_connection(
|
||||
|
||||
if(!have_servers(rses))
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"Error : No more valid servers, closing session");
|
||||
MXS_ERROR("No more valid servers, closing session");
|
||||
succp = false;
|
||||
goto return_succp;
|
||||
}
|
||||
@ -4410,7 +4336,7 @@ router_handle_state_switch(
|
||||
{
|
||||
case DCB_REASON_NOT_RESPONDING:
|
||||
atomic_add(&bref->bref_backend->backend_conn_count, -1);
|
||||
skygw_log_write(LOGFILE_TRACE,"schemarouter: server %s not responding",srv->unique_name);
|
||||
MXS_INFO("schemarouter: server %s not responding",srv->unique_name);
|
||||
dcb->func.hangup(dcb);
|
||||
break;
|
||||
|
||||
@ -4447,7 +4373,7 @@ bool detect_show_shards(GWBUF* query)
|
||||
|
||||
if(query == NULL)
|
||||
{
|
||||
skygw_log_write(LE,"Fatal Error: NULL value passed at %s:%d",__FILE__,__LINE__);
|
||||
MXS_ERROR("NULL value passed at %s:%d",__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4458,7 +4384,7 @@ bool detect_show_shards(GWBUF* query)
|
||||
|
||||
if((querystr = modutil_get_SQL(query)) == NULL)
|
||||
{
|
||||
skygw_log_write(LE,"Fatal Error: failure to parse SQL at %s:%d",__FILE__,__LINE__);
|
||||
MXS_ERROR("Failure to parse SQL at %s:%d",__FILE__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4521,7 +4447,7 @@ int process_show_shards(ROUTER_CLIENT_SES* rses)
|
||||
sl.rses = rses;
|
||||
if ((sl.rset = resultset_create(shard_list_cb, &sl)) == NULL)
|
||||
{
|
||||
skygw_log_write(LE, "[%s] Error: Failed to create resultset.", __FUNCTION__);
|
||||
MXS_ERROR("[%s] Error: Failed to create resultset.", __FUNCTION__);
|
||||
rval = -1;
|
||||
}
|
||||
else
|
||||
@ -4535,7 +4461,7 @@ int process_show_shards(ROUTER_CLIENT_SES* rses)
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LE, "Error: hashtable_iterator creation failed. "
|
||||
MXS_ERROR("hashtable_iterator creation failed. "
|
||||
"This is caused by a memory allocation failure.");
|
||||
rval = -1;
|
||||
}
|
||||
@ -4558,12 +4484,12 @@ void write_error_to_client(DCB* dcb, int errnum, const char* mysqlstate, const c
|
||||
{
|
||||
if (dcb->func.write(dcb, errbuff) != 1)
|
||||
{
|
||||
skygw_log_write(LE, "Error: Failed to write error packet to client.");
|
||||
MXS_ERROR("Failed to write error packet to client.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LE, "Error: Memory allocation failed when creating error packet.");
|
||||
MXS_ERROR("Memory allocation failed when creating error packet.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -4604,7 +4530,7 @@ bool handle_default_db(ROUTER_CLIENT_SES *router_cli_ses)
|
||||
if (get_shard_dcb(&dcb, router_cli_ses, target))
|
||||
{
|
||||
dcb->func.write(dcb, buffer);
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: USE '%s' sent to %s for session %p",
|
||||
MXS_DEBUG("schemarouter: USE '%s' sent to %s for session %p",
|
||||
router_cli_ses->connect_db,
|
||||
target,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
@ -4612,18 +4538,18 @@ bool handle_default_db(ROUTER_CLIENT_SES *router_cli_ses)
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write_flush(LOGFILE_TRACE, "schemarouter: Couldn't find target DCB for '%s'.", target);
|
||||
MXS_INFO("schemarouter: Couldn't find target DCB for '%s'.", target);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write_flush(LOGFILE_ERROR, "Error : Buffer allocation failed.");
|
||||
MXS_ERROR("Buffer allocation failed.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/** Unknown database, hang up on the client*/
|
||||
skygw_log_write_flush(LOGFILE_TRACE, "schemarouter: Connecting to a non-existent database '%s'",
|
||||
MXS_INFO("schemarouter: Connecting to a non-existent database '%s'",
|
||||
router_cli_ses->connect_db);
|
||||
char errmsg[128 + MYSQL_DATABASE_MAXLEN + 1];
|
||||
sprintf(errmsg, "Unknown database '%s'", router_cli_ses->connect_db);
|
||||
@ -4648,7 +4574,7 @@ void route_queued_query(ROUTER_CLIENT_SES *router_cli_ses)
|
||||
tmp->next = NULL;
|
||||
#ifdef SS_DEBUG
|
||||
char* querystr = modutil_get_SQL(tmp);
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: Sending queued buffer for session %p: %s",
|
||||
MXS_DEBUG("schemarouter: Sending queued buffer for session %p: %s",
|
||||
router_cli_ses->rses_client_dcb->session,
|
||||
querystr);
|
||||
free(querystr);
|
||||
@ -4684,7 +4610,7 @@ int inspect_backend_mapping_states(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
if (rc == SHOWDB_FULL_RESPONSE)
|
||||
{
|
||||
router_cli_ses->rses_backend_ref[i].bref_mapped = true;
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: Received SHOW DATABASES reply from %s for session %p",
|
||||
MXS_DEBUG("schemarouter: Received SHOW DATABASES reply from %s for session %p",
|
||||
router_cli_ses->rses_backend_ref[i].bref_backend->backend_server->unique_name,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
}
|
||||
@ -4692,7 +4618,7 @@ int inspect_backend_mapping_states(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
{
|
||||
bref->map_queue = writebuf;
|
||||
writebuf = NULL;
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: Received partial SHOW DATABASES reply from %s for session %p",
|
||||
MXS_DEBUG("schemarouter: Received partial SHOW DATABASES reply from %s for session %p",
|
||||
router_cli_ses->rses_backend_ref[i].bref_backend->backend_server->unique_name,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
}
|
||||
@ -4704,11 +4630,11 @@ int inspect_backend_mapping_states(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
{
|
||||
if (rc == SHOWDB_DUPLICATE_DATABASES)
|
||||
{
|
||||
skygw_log_write(LE, "Error: Duplicate databases found, closing session.");
|
||||
MXS_ERROR("Duplicate databases found, closing session.");
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LE, "Error: Fatal error when processing SHOW DATABASES response, closing session.");
|
||||
MXS_ERROR("Fatal error when processing SHOW DATABASES response, closing session.");
|
||||
}
|
||||
client_dcb = router_cli_ses->rses_client_dcb;
|
||||
|
||||
@ -4731,8 +4657,7 @@ int inspect_backend_mapping_states(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"Error : Creating buffer for error message failed.")));
|
||||
MXS_ERROR("Creating buffer for error message failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4745,7 +4670,7 @@ int inspect_backend_mapping_states(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
!BREF_IS_MAPPED(&bkrf[i]))
|
||||
{
|
||||
mapped = false;
|
||||
skygw_log_write(LOGFILE_DEBUG, "schemarouter: Still waiting for reply to SHOW DATABASES from %s for session %p",
|
||||
MXS_DEBUG("schemarouter: Still waiting for reply to SHOW DATABASES from %s for session %p",
|
||||
bkrf[i].bref_backend->backend_server->unique_name,
|
||||
router_cli_ses->rses_client_dcb->session);
|
||||
}
|
||||
@ -4800,7 +4725,7 @@ void synchronize_shard_map(ROUTER_CLIENT_SES *client)
|
||||
}
|
||||
else if (map->state != SHMAP_READY)
|
||||
{
|
||||
skygw_log_write(LE, "Warning: Shard map state is not ready but"
|
||||
MXS_WARNING("Shard map state is not ready but"
|
||||
"it is in use. Replacing it with a newer one.");
|
||||
replace_shard_map(&map, &client->shardmap);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ bool extract_database(GWBUF* buf, char* str)
|
||||
tok = strtok_r(query," ;",&saved);
|
||||
if(tok == NULL || strcasecmp(tok,"use") != 0)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"extract_database: Malformed chage database packet.");
|
||||
MXS_ERROR("extract_database: Malformed chage database packet.");
|
||||
succp = false;
|
||||
goto retblock;
|
||||
}
|
||||
@ -49,7 +49,7 @@ bool extract_database(GWBUF* buf, char* str)
|
||||
tok = strtok_r(NULL," ;",&saved);
|
||||
if(tok == NULL)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"extract_database: Malformed chage database packet.");
|
||||
MXS_ERROR("extract_database: Malformed chage database packet.");
|
||||
succp = false;
|
||||
goto retblock;
|
||||
}
|
||||
@ -73,16 +73,12 @@ bool extract_database(GWBUF* buf, char* str)
|
||||
*/
|
||||
void create_error_reply(char* fail_str,DCB* dcb)
|
||||
{
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_TRACE,
|
||||
"change_current_db: failed to change database: %s", fail_str);
|
||||
MXS_INFO("change_current_db: failed to change database: %s", fail_str);
|
||||
GWBUF* errbuf = modutil_create_mysql_err_msg(1, 0, 1049, "42000", fail_str);
|
||||
|
||||
if (errbuf == NULL)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Creating buffer for error message failed.")));
|
||||
MXS_ERROR("Creating buffer for error message failed.");
|
||||
return;
|
||||
}
|
||||
/** Set flags that help router to identify session commands reply */
|
||||
@ -120,8 +116,7 @@ bool change_current_db(char* dest,
|
||||
succp = false;
|
||||
goto retblock;
|
||||
}
|
||||
skygw_log_write(LOGFILE_TRACE,"change_current_db: INIT_DB with database '%s'",
|
||||
db);
|
||||
MXS_INFO("change_current_db: INIT_DB with database '%s'", db);
|
||||
/**
|
||||
* Update the session's active database only if it's in the hashtable.
|
||||
* If it isn't found, send a custom error packet to the client.
|
||||
@ -135,7 +130,7 @@ bool change_current_db(char* dest,
|
||||
else
|
||||
{
|
||||
strcpy(dest,db);
|
||||
skygw_log_write(LOGFILE_TRACE,"change_current_db: database is on server: '%s'.",target);
|
||||
MXS_INFO("change_current_db: database is on server: '%s'.",target);
|
||||
succp = true;
|
||||
goto retblock;
|
||||
}
|
||||
@ -143,10 +138,8 @@ bool change_current_db(char* dest,
|
||||
else
|
||||
{
|
||||
/** Create error message */
|
||||
skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"change_current_db: failed to change database: Query buffer too large");
|
||||
skygw_log_write_flush(LOGFILE_TRACE,
|
||||
"change_current_db: failed to change database: "
|
||||
MXS_ERROR("change_current_db: failed to change database: Query buffer too large");
|
||||
MXS_INFO("change_current_db: failed to change database: "
|
||||
"Query buffer too large [%ld bytes]", GWBUF_LENGTH(buf));
|
||||
succp = false;
|
||||
goto retblock;
|
||||
|
@ -343,7 +343,7 @@ parse_mapping_response(ROUTER_CLIENT_SES* rses, char* target, GWBUF* buf)
|
||||
{
|
||||
if(hashtable_add(rses->dbhash,data,target))
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"shardrouter: <%s, %s>",target,data);
|
||||
MXS_INFO("shardrouter: <%s, %s>",target,data);
|
||||
}
|
||||
free(data);
|
||||
}
|
||||
@ -468,7 +468,7 @@ get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client, GWBUF*
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"shardrouter: Query targets database '%s' on server '%s",dbnms[i],rval);
|
||||
MXS_INFO("shardrouter: Query targets database '%s' on server '%s",dbnms[i],rval);
|
||||
has_dbs = true;
|
||||
}
|
||||
}
|
||||
@ -487,14 +487,14 @@ get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client, GWBUF*
|
||||
ss_dassert(tok != NULL);
|
||||
tmp = (char*) hashtable_fetch(ht, tok);
|
||||
if(tmp)
|
||||
skygw_log_write(LOGFILE_TRACE,"shardrouter: SHOW TABLES with specific database '%s' on server '%s'", tok, tmp);
|
||||
MXS_INFO("shardrouter: SHOW TABLES with specific database '%s' on server '%s'", tok, tmp);
|
||||
}
|
||||
free(query);
|
||||
|
||||
if(tmp == NULL)
|
||||
{
|
||||
rval = (char*) hashtable_fetch(ht, client->rses_mysql_session->db);
|
||||
skygw_log_write(LOGFILE_TRACE,"shardrouter: SHOW TABLES query, current database '%s' on server '%s'",
|
||||
MXS_INFO("shardrouter: SHOW TABLES query, current database '%s' on server '%s'",
|
||||
client->rses_mysql_session->db,rval);
|
||||
}
|
||||
else
|
||||
@ -516,7 +516,7 @@ get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client, GWBUF*
|
||||
if(strcmp(srvrf->server->unique_name,buffer->hint->data) == 0)
|
||||
{
|
||||
rval = srvrf->server->unique_name;
|
||||
skygw_log_write(LOGFILE_TRACE,"shardrouter: Routing hint found (%s)",rval);
|
||||
MXS_INFO("shardrouter: Routing hint found (%s)",rval);
|
||||
|
||||
}
|
||||
srvrf = srvrf->next;
|
||||
@ -535,7 +535,7 @@ get_shard_target_name(ROUTER_INSTANCE* router, ROUTER_CLIENT_SES* client, GWBUF*
|
||||
rval = (char*) hashtable_fetch(ht, client->rses_mysql_session->db);
|
||||
if(rval)
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"shardrouter: Using active database '%s'",client->rses_mysql_session->db);
|
||||
MXS_INFO("shardrouter: Using active database '%s'",client->rses_mysql_session->db);
|
||||
}
|
||||
}
|
||||
|
||||
@ -564,10 +564,8 @@ tokenize_string(char* str)
|
||||
if(tmp == NULL)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : realloc returned NULL: %s.",
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)))));
|
||||
MXS_ERROR("realloc returned NULL: %s.",
|
||||
strerror_r(errno, errbuf, sizeof(errbuf)));
|
||||
free(list);
|
||||
return NULL;
|
||||
}
|
||||
@ -634,7 +632,7 @@ filterReply(FILTER* instance, void *session, GWBUF *reply)
|
||||
if(!logged)
|
||||
{
|
||||
/*
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Still waiting for reply to SHOW DATABASES from %s for session %p",
|
||||
MXS_DEBUG("schemarouter: Still waiting for reply to SHOW DATABASES from %s for session %p",
|
||||
bkrf[i].bref_backend->backend_server->unique_name,
|
||||
rses->rses_client_dcb->session);
|
||||
*/
|
||||
@ -660,7 +658,7 @@ filterReply(FILTER* instance, void *session, GWBUF *reply)
|
||||
if((target = hashtable_fetch(rses->dbhash,
|
||||
rses->connect_db)) == NULL)
|
||||
{
|
||||
skygw_log_write_flush(LOGFILE_TRACE,"schemarouter: Connecting to a non-existent database '%s'",
|
||||
MXS_INFO("schemarouter: Connecting to a non-existent database '%s'",
|
||||
rses->connect_db);
|
||||
rses->rses_closed = true;
|
||||
if(rses->queue)
|
||||
@ -682,7 +680,7 @@ filterReply(FILTER* instance, void *session, GWBUF *reply)
|
||||
buffer = gwbuf_alloc(qlen + 5);
|
||||
if(buffer == NULL)
|
||||
{
|
||||
skygw_log_write_flush(LOGFILE_ERROR,"Error : Buffer allocation failed.");
|
||||
MXS_ERROR("Buffer allocation failed.");
|
||||
rses->rses_closed = true;
|
||||
if(rses->queue)
|
||||
gwbuf_free(rses->queue);
|
||||
@ -707,15 +705,14 @@ filterReply(FILTER* instance, void *session, GWBUF *reply)
|
||||
rses->queue = rses->queue->next;
|
||||
tmp->next = NULL;
|
||||
char* querystr = modutil_get_SQL(tmp);
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Sending queued buffer for session %p: %s",
|
||||
MXS_DEBUG("schemarouter: Sending queued buffer for session %p: %s",
|
||||
rses->rses_client_dcb->session,
|
||||
querystr);
|
||||
poll_add_epollin_event_to_dcb(rses->routedcb,tmp);
|
||||
free(querystr);
|
||||
|
||||
}
|
||||
skygw_log_write_flush(LOGFILE_DEBUG,"session [%p] database map finished.",
|
||||
rses);
|
||||
MXS_DEBUG("session [%p] database map finished.", rses);
|
||||
}
|
||||
|
||||
goto retblock;
|
||||
@ -727,7 +724,7 @@ filterReply(FILTER* instance, void *session, GWBUF *reply)
|
||||
rses->queue = rses->queue->next;
|
||||
tmp->next = NULL;
|
||||
char* querystr = modutil_get_SQL(tmp);
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Sending queued buffer for session %p: %s",
|
||||
MXS_DEBUG("schemarouter: Sending queued buffer for session %p: %s",
|
||||
rses->rses_client_dcb->session,
|
||||
querystr);
|
||||
poll_add_epollin_event_to_dcb(rses->routedcb,tmp);
|
||||
@ -737,7 +734,7 @@ filterReply(FILTER* instance, void *session, GWBUF *reply)
|
||||
|
||||
if(rses->init & INIT_USE_DB)
|
||||
{
|
||||
skygw_log_write(LOGFILE_DEBUG,"schemarouter: Reply to USE '%s' received for session %p",
|
||||
MXS_DEBUG("schemarouter: Reply to USE '%s' received for session %p",
|
||||
rses->connect_db,
|
||||
rses->rses_client_dcb->session);
|
||||
rses->init &= ~INIT_USE_DB;
|
||||
@ -831,9 +828,7 @@ version()
|
||||
void
|
||||
ModuleInit()
|
||||
{
|
||||
LOGIF(LM, (skygw_log_write_flush(
|
||||
LOGFILE_MESSAGE,
|
||||
"Initializing statemend-based read/write split router module.")));
|
||||
MXS_NOTICE("Initializing statemend-based read/write split router module.");
|
||||
spinlock_init(&instlock);
|
||||
instances = NULL;
|
||||
}
|
||||
@ -938,7 +933,7 @@ createInstance(SERVICE *service, char **options)
|
||||
|
||||
if(conf == NULL)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR, "Error : no 'subservices' confguration parameter found. "
|
||||
MXS_ERROR("No 'subservices' confguration parameter found. "
|
||||
" Expected a list of service names.");
|
||||
free(router);
|
||||
return NULL;
|
||||
@ -951,7 +946,7 @@ createInstance(SERVICE *service, char **options)
|
||||
{
|
||||
free(router);
|
||||
free(services);
|
||||
skygw_log_write(LOGFILE_ERROR,"Error: Memory allocation failed.");
|
||||
MXS_ERROR("Memory allocation failed.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -966,10 +961,10 @@ createInstance(SERVICE *service, char **options)
|
||||
temp = realloc(res_svc, sizeof(SERVICE*)*(sz * 2));
|
||||
if(temp == NULL)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR, "Error : Memory reallocation failed.");
|
||||
LOGIF(LD,(skygw_log_write(LOGFILE_DEBUG, "shardrouter.c: realloc returned NULL. "
|
||||
MXS_ERROR("Memory reallocation failed.");
|
||||
MXS_DEBUG("shardrouter.c: realloc returned NULL. "
|
||||
"service count[%d] buffer size [%lu] tried to allocate [%lu]",
|
||||
sz, sizeof(SERVICE*) * (sz), sizeof(SERVICE*) * (sz * 2))));
|
||||
sz, sizeof(SERVICE*) * (sz), sizeof(SERVICE*) * (sz * 2));
|
||||
free(res_svc);
|
||||
free(router);
|
||||
return NULL;
|
||||
@ -983,7 +978,7 @@ createInstance(SERVICE *service, char **options)
|
||||
{
|
||||
free(res_svc);
|
||||
free(router);
|
||||
skygw_log_write(LOGFILE_ERROR, "Error : No service named '%s' found.", options[i]);
|
||||
MXS_ERROR("No service named '%s' found.", options[i]);
|
||||
return NULL;
|
||||
}
|
||||
i++;
|
||||
@ -998,7 +993,7 @@ createInstance(SERVICE *service, char **options)
|
||||
|
||||
if(i < min_nsvc)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR, "Error : Not enough parameters for 'subservice' router option. Shardrouter requires at least %d "
|
||||
MXS_ERROR("Not enough parameters for 'subservice' router option. Shardrouter requires at least %d "
|
||||
"configured services to work.", min_nsvc);
|
||||
free(router->services);
|
||||
free(router);
|
||||
@ -1107,7 +1102,7 @@ newSession(
|
||||
if(subsvc->scur == NULL)
|
||||
{
|
||||
subsvc_set_state(subsvc,SUBSVC_FAILED);
|
||||
skygw_log_write_flush(LOGFILE_ERROR,"Error : Memory allocation failed in shardrouter.");
|
||||
MXS_ERROR("Memory allocation failed in shardrouter.");
|
||||
continue;
|
||||
}
|
||||
subsvc->scur->scmd_cur_rses = client_rses;
|
||||
@ -1117,7 +1112,7 @@ newSession(
|
||||
|
||||
if(subsvc->dcb == NULL){
|
||||
subsvc_set_state(subsvc,SUBSVC_FAILED);
|
||||
skygw_log_write_flush(LOGFILE_ERROR,"Error : Failed to clone client DCB in shardrouter.");
|
||||
MXS_ERROR("Failed to clone client DCB in shardrouter.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1127,7 +1122,7 @@ newSession(
|
||||
dcb_close(subsvc->dcb);
|
||||
subsvc->dcb = NULL;
|
||||
subsvc_set_state(subsvc,SUBSVC_FAILED);
|
||||
skygw_log_write_flush(LOGFILE_ERROR,"Error : Failed to create subsession for service %s in shardrouter.",subsvc->service->name);
|
||||
MXS_ERROR("Failed to create subsession for service %s in shardrouter.",subsvc->service->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1136,7 +1131,7 @@ newSession(
|
||||
if(dummy_filterdef == NULL)
|
||||
{
|
||||
subsvc_set_state(subsvc,SUBSVC_FAILED);
|
||||
skygw_log_write_flush(LOGFILE_ERROR,"Error : Failed to allocate filter definition in shardrouter.");
|
||||
MXS_ERROR("Failed to allocate filter definition in shardrouter.");
|
||||
continue;
|
||||
}
|
||||
dummy_filterdef->obj = &dummyObject;
|
||||
@ -1146,7 +1141,7 @@ newSession(
|
||||
if(dummy_upstream == NULL)
|
||||
{
|
||||
subsvc_set_state(subsvc,SUBSVC_FAILED);
|
||||
skygw_log_write_flush(LOGFILE_ERROR,"Error : Failed to set filterUpstream in shardrouter.");
|
||||
MXS_ERROR("Failed to set filterUpstream in shardrouter.");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1217,9 +1212,7 @@ closeSession(
|
||||
{
|
||||
ROUTER_CLIENT_SES* router_cli_ses;
|
||||
int i;
|
||||
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
|
||||
"%lu [RWSplit:closeSession]",
|
||||
pthread_self())));
|
||||
MXS_DEBUG("%lu [RWSplit:closeSession]", pthread_self());
|
||||
|
||||
/**
|
||||
* router session can be NULL if newSession failed and it is discarding
|
||||
@ -1351,10 +1344,7 @@ get_shard_route_target(skygw_query_type_t qtype,
|
||||
target = TARGET_ANY;
|
||||
}
|
||||
#if defined(SS_DEBUG)
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Selected target \"%s\"",
|
||||
STRTARGET(target))));
|
||||
MXS_INFO("Selected target \"%s\"", STRTARGET(target));
|
||||
#endif
|
||||
return target;
|
||||
}
|
||||
@ -1551,7 +1541,7 @@ routeQuery(ROUTER* instance,
|
||||
char db[MYSQL_DATABASE_MAXLEN + 1];
|
||||
char errbuf[26+MYSQL_DATABASE_MAXLEN];
|
||||
|
||||
skygw_log_write_flush(LOGFILE_DEBUG,"shardrouter: routeQuery");
|
||||
MXS_DEBUG("shardrouter: routeQuery");
|
||||
CHK_CLIENT_RSES(router_cli_ses);
|
||||
|
||||
/** Dirty read for quick check if router is closed. */
|
||||
@ -1564,9 +1554,7 @@ routeQuery(ROUTER* instance,
|
||||
/** Lock router session */
|
||||
if(!rses_begin_locked_router_action(router_cli_ses))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query aborted! Routing session is closed <")));
|
||||
MXS_INFO("Route query aborted! Routing session is closed <");
|
||||
ret = 0;
|
||||
goto retblock;
|
||||
}
|
||||
@ -1583,7 +1571,7 @@ routeQuery(ROUTER* instance,
|
||||
{
|
||||
|
||||
char* querystr = modutil_get_SQL(querybuf);
|
||||
skygw_log_write(LOGFILE_DEBUG,"shardrouter: Storing query for session %p: %s",
|
||||
MXS_DEBUG("shardrouter: Storing query for session %p: %s",
|
||||
router_cli_ses->rses_client_dcb->session,
|
||||
querystr);
|
||||
free(querystr);
|
||||
@ -1625,14 +1613,11 @@ routeQuery(ROUTER* instance,
|
||||
{
|
||||
char* query_str = modutil_get_query(querybuf);
|
||||
|
||||
LOGIF(LE,
|
||||
(skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Can't route %s:%s:\"%s\" to "
|
||||
MXS_ERROR("Can't route %s:%s:\"%s\" to "
|
||||
"backend server. Router is closed.",
|
||||
STRPACKETTYPE(packet_type),
|
||||
STRQTYPE(qtype),
|
||||
(query_str == NULL ? "(empty)" : query_str))));
|
||||
(query_str == NULL ? "(empty)" : query_str));
|
||||
free(query_str);
|
||||
}
|
||||
ret = 0;
|
||||
@ -1699,9 +1684,7 @@ routeQuery(ROUTER* instance,
|
||||
extract_database(querybuf,db);
|
||||
snprintf(errbuf,25+MYSQL_DATABASE_MAXLEN,"Unknown database: %s",db);
|
||||
create_error_reply(errbuf,router_cli_ses->replydcb);
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Changing database failed.")));
|
||||
MXS_ERROR("Changing database failed.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1801,9 +1784,7 @@ routeQuery(ROUTER* instance,
|
||||
/** Lock router session */
|
||||
if(!rses_begin_locked_router_action(router_cli_ses))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query aborted! Routing session is closed <")));
|
||||
MXS_INFO("Route query aborted! Routing session is closed <");
|
||||
ret = 0;
|
||||
goto retblock;
|
||||
}
|
||||
@ -1847,12 +1828,10 @@ routeQuery(ROUTER* instance,
|
||||
|
||||
if(!succp)
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Was supposed to route to named server "
|
||||
MXS_INFO("Was supposed to route to named server "
|
||||
"%s but couldn't find the server in a "
|
||||
"suitable state.",
|
||||
tname)));
|
||||
tname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1888,9 +1867,7 @@ routeQuery(ROUTER* instance,
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Routing query failed.")));
|
||||
MXS_ERROR("Routing query failed.");
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
@ -2094,13 +2071,11 @@ rses_property_done(
|
||||
break;
|
||||
|
||||
default:
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [rses_property_done] Unknown property type %d "
|
||||
MXS_DEBUG("%lu [rses_property_done] Unknown property type %d "
|
||||
"in property %p",
|
||||
pthread_self(),
|
||||
prop->rses_prop_type,
|
||||
prop)));
|
||||
prop);
|
||||
|
||||
ss_dassert(false);
|
||||
break;
|
||||
@ -2444,9 +2419,7 @@ execute_sescmd_in_backend(SUBSERVICE* subsvc)
|
||||
if(sescmd_cursor_get_command(scur) == NULL)
|
||||
{
|
||||
succp = false;
|
||||
LOGIF(LT, (skygw_log_write_flush(
|
||||
LOGFILE_TRACE,
|
||||
"Cursor had no pending session commands.")));
|
||||
MXS_INFO("Cursor had no pending session commands.");
|
||||
|
||||
goto return_succp;
|
||||
}
|
||||
@ -2601,9 +2574,7 @@ route_session_write(
|
||||
SUBSERVICE* subsvc;
|
||||
int i;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Session write, routing to all servers.")));
|
||||
MXS_INFO("Session write, routing to all servers.");
|
||||
|
||||
/**
|
||||
* These are one-way messages and server doesn't respond to them.
|
||||
@ -2632,12 +2603,10 @@ route_session_write(
|
||||
|
||||
if(LOG_IS_ENABLED(LOGFILE_TRACE))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query to %s%s%s",
|
||||
MXS_INFO("Route query to %s%s%s",
|
||||
i == 0 ? ">":"",
|
||||
subsvc->service->name,
|
||||
i+1 >= router_cli_ses->n_subservice ? "<" : "")));
|
||||
i+1 >= router_cli_ses->n_subservice ? "<" : "");
|
||||
}
|
||||
|
||||
if(!SUBSVC_IS_CLOSED(subsvc) && SUBSVC_IS_OK(subsvc))
|
||||
@ -2687,12 +2656,10 @@ route_session_write(
|
||||
|
||||
if(LOG_IS_ENABLED(LOGFILE_TRACE))
|
||||
{
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Route query to %s%s%s",
|
||||
MXS_INFO("Route query to %s%s%s",
|
||||
i == 0 ? ">":"",
|
||||
subsvc->service->name,
|
||||
i+1 >= router_cli_ses->n_subservice ? "<" : "")));
|
||||
i+1 >= router_cli_ses->n_subservice ? "<" : "");
|
||||
}
|
||||
|
||||
|
||||
@ -2715,10 +2682,8 @@ route_session_write(
|
||||
{
|
||||
succp = true;
|
||||
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Service %s already executing sescmd.",
|
||||
subsvc->service->name)));
|
||||
MXS_INFO("Service %s already executing sescmd.",
|
||||
subsvc->service->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2726,11 +2691,9 @@ route_session_write(
|
||||
|
||||
if(!succp)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Failed to execute session "
|
||||
MXS_ERROR("Failed to execute session "
|
||||
"command in %s",
|
||||
subsvc->service->name)));
|
||||
subsvc->service->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user