query_classifier: LOGIF and skygw_log_write replaced.
The use of LOgIF and skygw_log_write replaced with the equivalent MXS_[ERROR|WARNING|NOTICE|INFO|DEBUG] macros.
This commit is contained in:
@ -256,10 +256,7 @@ static THD* get_or_create_thd_for_parsing(
|
|||||||
thd = (THD *)create_embedded_thd(client_flags);
|
thd = (THD *)create_embedded_thd(client_flags);
|
||||||
|
|
||||||
if (thd == NULL) {
|
if (thd == NULL) {
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Failed to create thread context for parsing.");
|
||||||
LOGFILE_ERROR,
|
|
||||||
"Error : Failed to create thread context for parsing. "
|
|
||||||
"Exiting.")));
|
|
||||||
goto return_thd;
|
goto return_thd;
|
||||||
}
|
}
|
||||||
mysql->thd = thd;
|
mysql->thd = thd;
|
||||||
@ -267,10 +264,7 @@ static THD* get_or_create_thd_for_parsing(
|
|||||||
failp = check_embedded_connection(mysql, db);
|
failp = check_embedded_connection(mysql, db);
|
||||||
|
|
||||||
if (failp) {
|
if (failp) {
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Call to check_embedded_connection failed.");
|
||||||
LOGFILE_ERROR,
|
|
||||||
"Error : Call to check_embedded_connection failed. "
|
|
||||||
"Exiting.")));
|
|
||||||
goto return_err_with_thd;
|
goto return_err_with_thd;
|
||||||
}
|
}
|
||||||
thd->clear_data_list();
|
thd->clear_data_list();
|
||||||
@ -278,10 +272,8 @@ static THD* get_or_create_thd_for_parsing(
|
|||||||
/** Check that we are calling the client functions in right order */
|
/** Check that we are calling the client functions in right order */
|
||||||
if (mysql->status != MYSQL_STATUS_READY) {
|
if (mysql->status != MYSQL_STATUS_READY) {
|
||||||
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Invalid status %d in embedded server.",
|
||||||
LOGFILE_ERROR,
|
mysql->status);
|
||||||
"Error : Invalid status %d in embedded server. "
|
|
||||||
"Exiting.", mysql->status)));
|
|
||||||
goto return_err_with_thd;
|
goto return_err_with_thd;
|
||||||
}
|
}
|
||||||
/** Clear result variables */
|
/** Clear result variables */
|
||||||
@ -369,19 +361,15 @@ static bool create_parse_tree(
|
|||||||
failp = thd->set_db(virtual_db, strlen(virtual_db));
|
failp = thd->set_db(virtual_db, strlen(virtual_db));
|
||||||
if (failp)
|
if (failp)
|
||||||
{
|
{
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Failed to set database in thread context.");
|
||||||
LOGFILE_ERROR,
|
|
||||||
"Error : Failed to set database in thread context.")));
|
|
||||||
}
|
}
|
||||||
failp = parse_sql(thd, &parser_state, NULL);
|
failp = parse_sql(thd, &parser_state, NULL);
|
||||||
|
|
||||||
if (failp)
|
if (failp)
|
||||||
{
|
{
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [readwritesplit:create_parse_tree] failed to "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [readwritesplit:create_parse_tree] failed to "
|
|
||||||
"create parse tree.",
|
"create parse tree.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
}
|
}
|
||||||
return_here:
|
return_here:
|
||||||
return failp;
|
return failp;
|
||||||
@ -440,18 +428,12 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
if (sql_command_flags[lex->sql_command] &
|
if (sql_command_flags[lex->sql_command] &
|
||||||
CF_IMPLICT_COMMIT_BEGIN)
|
CF_IMPLICT_COMMIT_BEGIN)
|
||||||
{
|
{
|
||||||
skygw_log_write(
|
MXS_INFO("Implicit COMMIT before executing the next command.");
|
||||||
LOGFILE_TRACE,
|
|
||||||
"Implicit COMMIT before executing the "
|
|
||||||
"next command.");
|
|
||||||
}
|
}
|
||||||
else if (sql_command_flags[lex->sql_command] &
|
else if (sql_command_flags[lex->sql_command] &
|
||||||
CF_IMPLICIT_COMMIT_END)
|
CF_IMPLICIT_COMMIT_END)
|
||||||
{
|
{
|
||||||
skygw_log_write(
|
MXS_INFO("Implicit COMMIT after executing the next command.");
|
||||||
LOGFILE_TRACE,
|
|
||||||
"Implicit COMMIT after executing the "
|
|
||||||
"next command.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,9 +448,7 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
{
|
{
|
||||||
if (LOG_IS_ENABLED(LOGFILE_TRACE))
|
if (LOG_IS_ENABLED(LOGFILE_TRACE))
|
||||||
{
|
{
|
||||||
skygw_log_write(
|
MXS_INFO("Disable autocommit : implicit START TRANSACTION"
|
||||||
LOGFILE_TRACE,
|
|
||||||
"Disable autocommit : implicit START TRANSACTION"
|
|
||||||
" before executing the next command.");
|
" before executing the next command.");
|
||||||
}
|
}
|
||||||
type |= QUERY_TYPE_DISABLE_AUTOCOMMIT;
|
type |= QUERY_TYPE_DISABLE_AUTOCOMMIT;
|
||||||
@ -641,12 +621,10 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
Item::Type itype;
|
Item::Type itype;
|
||||||
|
|
||||||
itype = item->type();
|
itype = item->type();
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] Item %s:%s",
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] Item %s:%s",
|
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
item->name,
|
item->name,
|
||||||
STRITEMTYPE(itype))));
|
STRITEMTYPE(itype));
|
||||||
|
|
||||||
if (itype == Item::SUBSELECT_ITEM) {
|
if (itype == Item::SUBSELECT_ITEM) {
|
||||||
continue;
|
continue;
|
||||||
@ -707,50 +685,40 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
* belongs to this category.
|
* belongs to this category.
|
||||||
*/
|
*/
|
||||||
func_qtype |= QUERY_TYPE_WRITE;
|
func_qtype |= QUERY_TYPE_WRITE;
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype FUNC_SP, stored proc "
|
"functype FUNC_SP, stored proc "
|
||||||
"or unknown function.",
|
"or unknown function.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
case Item_func::UDF_FUNC:
|
case Item_func::UDF_FUNC:
|
||||||
func_qtype |= QUERY_TYPE_WRITE;
|
func_qtype |= QUERY_TYPE_WRITE;
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype UDF_FUNC, user-defined "
|
"functype UDF_FUNC, user-defined "
|
||||||
"function.",
|
"function.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
case Item_func::NOW_FUNC:
|
case Item_func::NOW_FUNC:
|
||||||
func_qtype |= QUERY_TYPE_LOCAL_READ;
|
func_qtype |= QUERY_TYPE_LOCAL_READ;
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype NOW_FUNC, could be "
|
"functype NOW_FUNC, could be "
|
||||||
"executed in MaxScale.",
|
"executed in MaxScale.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
/** System session variable */
|
/** System session variable */
|
||||||
case Item_func::GSYSVAR_FUNC:
|
case Item_func::GSYSVAR_FUNC:
|
||||||
func_qtype |= QUERY_TYPE_SYSVAR_READ;
|
func_qtype |= QUERY_TYPE_SYSVAR_READ;
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype GSYSVAR_FUNC, system "
|
"functype GSYSVAR_FUNC, system "
|
||||||
"variable read.",
|
"variable read.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
/** User-defined variable read */
|
/** User-defined variable read */
|
||||||
case Item_func::GUSERVAR_FUNC:
|
case Item_func::GUSERVAR_FUNC:
|
||||||
func_qtype |= QUERY_TYPE_USERVAR_READ;
|
func_qtype |= QUERY_TYPE_USERVAR_READ;
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype GUSERVAR_FUNC, user "
|
"functype GUSERVAR_FUNC, user "
|
||||||
"variable read.",
|
"variable read.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
/** User-defined variable modification */
|
/** User-defined variable modification */
|
||||||
case Item_func::SUSERVAR_FUNC:
|
case Item_func::SUSERVAR_FUNC:
|
||||||
@ -760,12 +728,10 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
* 15.9.14
|
* 15.9.14
|
||||||
*/
|
*/
|
||||||
func_qtype |= QUERY_TYPE_GSYSVAR_WRITE;
|
func_qtype |= QUERY_TYPE_GSYSVAR_WRITE;
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype SUSERVAR_FUNC, user "
|
"functype SUSERVAR_FUNC, user "
|
||||||
"variable write.",
|
"variable write.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
case Item_func::UNKNOWN_FUNC:
|
case Item_func::UNKNOWN_FUNC:
|
||||||
|
|
||||||
@ -783,20 +749,16 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
* type, for example, rand(), soundex(),
|
* type, for example, rand(), soundex(),
|
||||||
* repeat() .
|
* repeat() .
|
||||||
*/
|
*/
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"functype UNKNOWN_FUNC, "
|
"functype UNKNOWN_FUNC, "
|
||||||
"typically some system function.",
|
"typically some system function.",
|
||||||
pthread_self())));
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOGIF(LD, (skygw_log_write(
|
MXS_DEBUG("%lu [resolve_query_type] "
|
||||||
LOGFILE_DEBUG,
|
|
||||||
"%lu [resolve_query_type] "
|
|
||||||
"Functype %d.",
|
"Functype %d.",
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
ftype)));
|
ftype);
|
||||||
break;
|
break;
|
||||||
} /**< switch */
|
} /**< switch */
|
||||||
/**< Set new query type */
|
/**< Set new query type */
|
||||||
@ -1204,7 +1166,7 @@ inline void add_str(char** buf, int* buflen, int* bufsize, char* str)
|
|||||||
*bufsize = (*bufsize) * 2 + isize;
|
*bufsize = (*bufsize) * 2 + isize;
|
||||||
char *tmp = (char*)realloc(*buf,(*bufsize)* sizeof(char));
|
char *tmp = (char*)realloc(*buf,(*bufsize)* sizeof(char));
|
||||||
if(tmp == NULL){
|
if(tmp == NULL){
|
||||||
skygw_log_write_flush (LE,"Error: memory reallocation failed");
|
MXS_ERROR("Error: memory reallocation failed.");
|
||||||
free(*buf);
|
free(*buf);
|
||||||
*buf = NULL;
|
*buf = NULL;
|
||||||
*bufsize = 0;
|
*bufsize = 0;
|
||||||
@ -1247,7 +1209,7 @@ char* skygw_get_affected_fields(GWBUF* buf)
|
|||||||
lex->current_select = lex->all_selects_list;
|
lex->current_select = lex->all_selects_list;
|
||||||
if((where = (char*)malloc(sizeof(char)*1)) == NULL)
|
if((where = (char*)malloc(sizeof(char)*1)) == NULL)
|
||||||
{
|
{
|
||||||
skygw_log_write_flush(LE,"Error: Memory allocation failed.");
|
MXS_ERROR("Memory allocation failed.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*where = '\0';
|
*where = '\0';
|
||||||
@ -1445,11 +1407,9 @@ parsing_info_t* parsing_info_init(
|
|||||||
ss_dassert(mysql != NULL);
|
ss_dassert(mysql != NULL);
|
||||||
|
|
||||||
if (mysql == NULL) {
|
if (mysql == NULL) {
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
MXS_ERROR("Call to mysql_real_connect failed due %d, %s.",
|
||||||
LOGFILE_ERROR,
|
|
||||||
"Error : call to mysql_real_connect failed due %d, %s.",
|
|
||||||
mysql_errno(mysql),
|
mysql_errno(mysql),
|
||||||
mysql_error(mysql))));
|
mysql_error(mysql));
|
||||||
|
|
||||||
goto retblock;
|
goto retblock;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user