readwritesplit: skygw_log_writes replaced.

This commit is contained in:
Johan Wikman
2015-11-18 10:34:50 +02:00
parent eb0cf745ca
commit d59c6a3570

View File

@ -1555,14 +1555,14 @@ void check_drop_tmp_table(
if(router_cli_ses == NULL || querybuf == NULL) if(router_cli_ses == NULL || querybuf == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameters passed: %p %p", MXS_ERROR("[%s] Error: NULL parameters passed: %p %p",
__FUNCTION__,router_cli_ses,querybuf); __FUNCTION__,router_cli_ses,querybuf);
return; return;
} }
if(router_cli_ses->rses_master_ref == NULL) if(router_cli_ses->rses_master_ref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: Master server reference is NULL.", MXS_ERROR("[%s] Error: Master server reference is NULL.",
__FUNCTION__); __FUNCTION__);
return; return;
} }
@ -1572,7 +1572,7 @@ void check_drop_tmp_table(
if(master_dcb == NULL || master_dcb->session == NULL) if(master_dcb == NULL || master_dcb->session == NULL)
{ {
skygw_log_write(LE,"[%s] Error: Master server DBC is NULL. " MXS_ERROR("[%s] Error: Master server DBC is NULL. "
"This means that the connection to the master server is already " "This means that the connection to the master server is already "
"closed while a query is still being routed.",__FUNCTION__); "closed while a query is still being routed.",__FUNCTION__);
return; return;
@ -1584,7 +1584,7 @@ void check_drop_tmp_table(
if(data == NULL) if(data == NULL)
{ {
skygw_log_write(LE,"[%s] Error: User data in master server DBC is NULL.",__FUNCTION__); MXS_ERROR("[%s] Error: User data in master server DBC is NULL.",__FUNCTION__);
return; return;
} }
@ -1646,14 +1646,14 @@ static skygw_query_type_t is_read_tmp_table(
if(router_cli_ses == NULL || querybuf == NULL) if(router_cli_ses == NULL || querybuf == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameters passed: %p %p", MXS_ERROR("[%s] Error: NULL parameters passed: %p %p",
__FUNCTION__,router_cli_ses,querybuf); __FUNCTION__,router_cli_ses,querybuf);
return type; return type;
} }
if(router_cli_ses->rses_master_ref == NULL) if(router_cli_ses->rses_master_ref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: Master server reference is NULL.", MXS_ERROR("[%s] Error: Master server reference is NULL.",
__FUNCTION__); __FUNCTION__);
return type; return type;
} }
@ -1663,7 +1663,7 @@ static skygw_query_type_t is_read_tmp_table(
if(master_dcb == NULL || master_dcb->session == NULL) if(master_dcb == NULL || master_dcb->session == NULL)
{ {
skygw_log_write(LE,"[%s] Error: Master server DBC is NULL. " MXS_ERROR("[%s] Error: Master server DBC is NULL. "
"This means that the connection to the master server is already " "This means that the connection to the master server is already "
"closed while a query is still being routed.",__FUNCTION__); "closed while a query is still being routed.",__FUNCTION__);
return qtype; return qtype;
@ -1674,7 +1674,7 @@ static skygw_query_type_t is_read_tmp_table(
if(data == NULL) if(data == NULL)
{ {
skygw_log_write(LE,"[%s] Error: User data in master server DBC is NULL.",__FUNCTION__); MXS_ERROR("[%s] Error: User data in master server DBC is NULL.",__FUNCTION__);
return qtype; return qtype;
} }
@ -1746,14 +1746,14 @@ static void check_create_tmp_table(
if(router_cli_ses == NULL || querybuf == NULL) if(router_cli_ses == NULL || querybuf == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameters passed: %p %p", MXS_ERROR("[%s] Error: NULL parameters passed: %p %p",
__FUNCTION__,router_cli_ses,querybuf); __FUNCTION__,router_cli_ses,querybuf);
return; return;
} }
if(router_cli_ses->rses_master_ref == NULL) if(router_cli_ses->rses_master_ref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: Master server reference is NULL.", MXS_ERROR("[%s] Error: Master server reference is NULL.",
__FUNCTION__); __FUNCTION__);
return; return;
} }
@ -1763,7 +1763,7 @@ static void check_create_tmp_table(
if(master_dcb == NULL || master_dcb->session == NULL) if(master_dcb == NULL || master_dcb->session == NULL)
{ {
skygw_log_write(LE,"[%s] Error: Master server DCB is NULL. " MXS_ERROR("[%s] Error: Master server DCB is NULL. "
"This means that the connection to the master server is already " "This means that the connection to the master server is already "
"closed while a query is still being routed.",__FUNCTION__); "closed while a query is still being routed.",__FUNCTION__);
return; return;
@ -1775,7 +1775,7 @@ static void check_create_tmp_table(
if(data == NULL) if(data == NULL)
{ {
skygw_log_write(LE,"[%s] Error: User data in master server DBC is NULL.",__FUNCTION__); MXS_ERROR("[%s] Error: User data in master server DBC is NULL.",__FUNCTION__);
return; return;
} }
@ -2099,7 +2099,7 @@ static bool route_single_stmt(
packet_type = MYSQL_COM_UNDEFINED; packet_type = MYSQL_COM_UNDEFINED;
rses->rses_load_active = false; rses->rses_load_active = false;
route_target = TARGET_MASTER; route_target = TARGET_MASTER;
skygw_log_write_flush(LT, "> LOAD DATA LOCAL INFILE finished: " MXS_INFO("> LOAD DATA LOCAL INFILE finished: "
"%lu bytes sent.", rses->rses_load_data_sent + gwbuf_length(querybuf)); "%lu bytes sent.", rses->rses_load_data_sent + gwbuf_length(querybuf));
} }
else else
@ -2230,8 +2230,7 @@ static bool route_single_stmt(
char* contentstr = strndup(data, MIN(len, RWSPLIT_TRACE_MSG_LEN)); char* contentstr = strndup(data, MIN(len, RWSPLIT_TRACE_MSG_LEN));
char* qtypestr = skygw_get_qtype_str(qtype); char* qtypestr = skygw_get_qtype_str(qtype);
skygw_log_write(LOGFILE_TRACE, MXS_INFO("> Autocommit: %s, trx is %s, cmd: %s, type: %s, "
"> Autocommit: %s, trx is %s, cmd: %s, type: %s, "
"stmt: %s%s %s", "stmt: %s%s %s",
(rses->rses_autocommit_enabled ? "[enabled]" : "[disabled]"), (rses->rses_autocommit_enabled ? "[enabled]" : "[disabled]"),
(rses->rses_transaction_active ? "[open]" : "[not open]"), (rses->rses_transaction_active ? "[open]" : "[not open]"),
@ -2246,7 +2245,7 @@ static bool route_single_stmt(
} }
else else
{ {
skygw_log_write(LT, "> Processing LOAD DATA LOCAL INFILE: " MXS_INFO("> Processing LOAD DATA LOCAL INFILE: "
"%lu bytes sent.", rses->rses_load_data_sent); "%lu bytes sent.", rses->rses_load_data_sent);
} }
} }
@ -3014,7 +3013,7 @@ static void bref_clear_state(
{ {
if(bref == NULL) if(bref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return; return;
} }
if (state != BREF_WAITING_RESULT) if (state != BREF_WAITING_RESULT)
@ -3040,7 +3039,7 @@ static void bref_clear_state(
ss_dassert(prev2 > 0); ss_dassert(prev2 > 0);
if(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__, __FUNCTION__,
bref->bref_backend->backend_server->name, bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port); bref->bref_backend->backend_server->port);
@ -3055,7 +3054,7 @@ static void bref_set_state(
{ {
if(bref == NULL) if(bref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return; return;
} }
if (state != BREF_WAITING_RESULT) if (state != BREF_WAITING_RESULT)
@ -3072,7 +3071,7 @@ static void bref_set_state(
ss_dassert(prev1 >= 0); ss_dassert(prev1 >= 0);
if(prev1 < 0) if(prev1 < 0)
{ {
skygw_log_write(LE,"[%s] Error: negative number of connections waiting for " MXS_ERROR("[%s] Error: negative number of connections waiting for "
"results in backend %s:%u", "results in backend %s:%u",
__FUNCTION__, __FUNCTION__,
bref->bref_backend->backend_server->name, bref->bref_backend->backend_server->name,
@ -3084,7 +3083,7 @@ static void bref_set_state(
ss_dassert(prev2 >= 0); ss_dassert(prev2 >= 0);
if(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__, __FUNCTION__,
bref->bref_backend->backend_server->name, bref->bref_backend->backend_server->name,
bref->bref_backend->backend_server->port); bref->bref_backend->backend_server->port);
@ -3561,7 +3560,7 @@ static rses_property_t* rses_property_init(
prop = (rses_property_t*)calloc(1, sizeof(rses_property_t)); prop = (rses_property_t*)calloc(1, sizeof(rses_property_t));
if (prop == NULL) if (prop == NULL)
{ {
skygw_log_write(LE,"Error: Malloc returned NULL. (%s:%d)",__FILE__,__LINE__); MXS_ERROR("Error: Malloc returned NULL. (%s:%d)",__FILE__,__LINE__);
return NULL; return NULL;
} }
prop->rses_prop_type = prop_type; prop->rses_prop_type = prop_type;
@ -3582,7 +3581,7 @@ static void rses_property_done(
{ {
if(prop == NULL) if(prop == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return; return;
} }
CHK_RSES_PROP(prop); CHK_RSES_PROP(prop);
@ -3622,12 +3621,12 @@ static int rses_property_add(
{ {
if(rses == NULL) if(rses == NULL)
{ {
skygw_log_write(LE,"Error: Router client session is NULL. (%s:%d)",__FILE__,__LINE__); MXS_ERROR("Router client session is NULL. (%s:%d)",__FILE__,__LINE__);
return -1; return -1;
} }
if(prop == NULL) if(prop == NULL)
{ {
skygw_log_write(LE,"Error: Router client session property is NULL. (%s:%d)",__FILE__,__LINE__); MXS_ERROR("Router client session property is NULL. (%s:%d)",__FILE__,__LINE__);
return -1; return -1;
} }
rses_property_t* p; rses_property_t* p;
@ -3665,7 +3664,7 @@ static mysql_sescmd_t* rses_property_get_sescmd(
if(prop == NULL) if(prop == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return NULL; return NULL;
} }
@ -3715,7 +3714,7 @@ static void mysql_sescmd_done(
{ {
if(sescmd == NULL) if(sescmd == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return; return;
} }
CHK_RSES_PROP(sescmd->my_sescmd_prop); CHK_RSES_PROP(sescmd->my_sescmd_prop);
@ -3787,8 +3786,7 @@ static GWBUF* sescmd_cursor_process_replies(
if(bref->reply_cmd != scmd->reply_cmd) if(bref->reply_cmd != scmd->reply_cmd)
{ {
skygw_log_write(LOGFILE_TRACE,"Backend " MXS_INFO("Backend server '%s' response differs from master's response. "
"server '%s' response differs from master's response. "
"Closing connection.", "Closing connection.",
bref->bref_backend->backend_server->unique_name); bref->bref_backend->backend_server->unique_name);
sescmd_cursor_set_active(scur,false); sescmd_cursor_set_active(scur,false);
@ -3813,7 +3811,7 @@ static GWBUF* sescmd_cursor_process_replies(
/** Mark the rest session commands as replied */ /** Mark the rest session commands as replied */
scmd->my_sescmd_is_replied = true; scmd->my_sescmd_is_replied = true;
scmd->reply_cmd = *((unsigned char*)replybuf->start + 4); scmd->reply_cmd = *((unsigned char*)replybuf->start + 4);
skygw_log_write(LT,"Master '%s' responded to a session command.", MXS_INFO("Master '%s' responded to a session command.",
bref->bref_backend->backend_server->unique_name); bref->bref_backend->backend_server->unique_name);
int i; int i;
@ -3833,7 +3831,8 @@ static GWBUF* sescmd_cursor_process_replies(
if(ses->rses_backend_ref[i].bref_dcb) if(ses->rses_backend_ref[i].bref_dcb)
dcb_close(ses->rses_backend_ref[i].bref_dcb); dcb_close(ses->rses_backend_ref[i].bref_dcb);
*reconnect = true; *reconnect = true;
skygw_log_write(LT,"Disabling slave %s:%d, result differs from master's result. Master: %d Slave: %d", MXS_INFO("Disabling slave %s:%d, result differs from "
"master's result. Master: %d Slave: %d",
ses->rses_backend_ref[i].bref_backend->backend_server->name, ses->rses_backend_ref[i].bref_backend->backend_server->name,
ses->rses_backend_ref[i].bref_backend->backend_server->port, ses->rses_backend_ref[i].bref_backend->backend_server->port,
bref->reply_cmd, bref->reply_cmd,
@ -3845,13 +3844,13 @@ static GWBUF* sescmd_cursor_process_replies(
} }
else else
{ {
skygw_log_write(LT,"Slave '%s' responded before master to a session command. Result: %d", MXS_INFO("Slave '%s' responded before master to a session command. Result: %d",
bref->bref_backend->backend_server->unique_name, bref->bref_backend->backend_server->unique_name,
(int)bref->reply_cmd); (int)bref->reply_cmd);
if(bref->reply_cmd == 0xff) if(bref->reply_cmd == 0xff)
{ {
SERVER* serv = bref->bref_backend->backend_server; SERVER* serv = bref->bref_backend->backend_server;
skygw_log_write(LE,"Error: Slave '%s' (%s:%u) failed to execute session command.", MXS_ERROR("Slave '%s' (%s:%u) failed to execute session command.",
serv->unique_name,serv->name,serv->port); serv->unique_name,serv->name,serv->port);
} }
if(replybuf) if(replybuf)
@ -3904,7 +3903,7 @@ static bool sescmd_cursor_is_active(
if(sescmd_cursor == NULL) if(sescmd_cursor == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return false; return false;
} }
ss_dassert(SPINLOCK_IS_LOCKED(&sescmd_cursor->scmd_cur_rses->rses_lock)); ss_dassert(SPINLOCK_IS_LOCKED(&sescmd_cursor->scmd_cur_rses->rses_lock));
@ -3934,7 +3933,7 @@ static GWBUF* sescmd_cursor_clone_querybuf(
GWBUF* buf; GWBUF* buf;
if(scur == NULL) if(scur == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return NULL; return NULL;
} }
ss_dassert(scur->scmd_cur_cmd != NULL); ss_dassert(scur->scmd_cur_cmd != NULL);
@ -3952,7 +3951,7 @@ static bool sescmd_cursor_history_empty(
if(scur == NULL) if(scur == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return true; return true;
} }
CHK_SESCMD_CUR(scur); CHK_SESCMD_CUR(scur);
@ -3976,7 +3975,7 @@ static void sescmd_cursor_reset(
ROUTER_CLIENT_SES* rses; ROUTER_CLIENT_SES* rses;
if(scur == NULL) if(scur == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return; return;
} }
CHK_SESCMD_CUR(scur); CHK_SESCMD_CUR(scur);
@ -3997,7 +3996,7 @@ static bool execute_sescmd_history(
sescmd_cursor_t* scur; sescmd_cursor_t* scur;
if(bref == NULL) if(bref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return false; return false;
} }
CHK_BACKEND_REF(bref); CHK_BACKEND_REF(bref);
@ -4038,7 +4037,7 @@ static bool execute_sescmd_in_backend(
GWBUF* buf; GWBUF* buf;
if(backend_ref == NULL) if(backend_ref == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return false; return false;
} }
if (BREF_IS_CLOSED(backend_ref)) if (BREF_IS_CLOSED(backend_ref))
@ -4144,7 +4143,7 @@ static bool sescmd_cursor_next(
if(scur == NULL) if(scur == NULL)
{ {
skygw_log_write(LE,"[%s] Error: NULL parameter.",__FUNCTION__); MXS_ERROR("[%s] Error: NULL parameter.",__FUNCTION__);
return false; return false;
} }
@ -4396,8 +4395,9 @@ static bool route_session_write(
if (router_cli_ses->rses_config.rw_max_sescmd_history_size > 0 && if (router_cli_ses->rses_config.rw_max_sescmd_history_size > 0 &&
router_cli_ses->rses_nsescmd >= router_cli_ses->rses_config.rw_max_sescmd_history_size) router_cli_ses->rses_nsescmd >= router_cli_ses->rses_config.rw_max_sescmd_history_size)
{ {
skygw_log_write(LM, "Warning: Router session exceeded session command history limit. " MXS_WARNING("Router session exceeded session command history limit. "
"Slave recovery is disabled and only slave servers with consistent session state are used " "Slave recovery is disabled and only slave servers with "
"consistent session state are used "
"for the duration of the session."); "for the duration of the session.");
router_cli_ses->rses_config.rw_disable_sescmd_hist = true; router_cli_ses->rses_config.rw_disable_sescmd_hist = true;
router_cli_ses->rses_config.rw_max_sescmd_history_size = 0; router_cli_ses->rses_config.rw_max_sescmd_history_size = 0;
@ -4447,7 +4447,7 @@ static bool route_session_write(
*/ */
if((prop = rses_property_init(RSES_PROP_TYPE_SESCMD)) == NULL) if((prop = rses_property_init(RSES_PROP_TYPE_SESCMD)) == NULL)
{ {
skygw_log_write(LE,"Error: Router session property initialization failed"); MXS_ERROR("Router session property initialization failed");
rses_end_locked_router_action(router_cli_ses); rses_end_locked_router_action(router_cli_ses);
return false; return false;
} }
@ -4456,7 +4456,7 @@ static bool route_session_write(
/** Add sescmd property to router client session */ /** Add sescmd property to router client session */
if(rses_property_add(router_cli_ses, prop) != 0) if(rses_property_add(router_cli_ses, prop) != 0)
{ {
skygw_log_write(LE,"Error: Session property addition failed."); MXS_ERROR("Session property addition failed.");
rses_end_locked_router_action(router_cli_ses); rses_end_locked_router_action(router_cli_ses);
return false; return false;
} }