Included log_manager in query classifier's makefile, replaced fprintf's with log manager commands.
This commit is contained in:
@ -33,6 +33,7 @@ libcomp:
|
|||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
-I$(MARIADB_SRC_PATH)/include/ \
|
||||||
-I$(MARIADB_SRC_PATH)/sql \
|
-I$(MARIADB_SRC_PATH)/sql \
|
||||||
-I$(MARIADB_SRC_PATH)/regex/ \
|
-I$(MARIADB_SRC_PATH)/regex/ \
|
||||||
|
-I$(ROOT_PATH)/log_manager/ \
|
||||||
-I./ \
|
-I./ \
|
||||||
-fPIC ./query_classifier.cc -o query_classifier.o
|
-fPIC ./query_classifier.cc -o query_classifier.o
|
||||||
|
|
||||||
@ -58,6 +59,7 @@ depend:
|
|||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
-I$(MARIADB_SRC_PATH)/include/ \
|
||||||
-I$(MARIADB_SRC_PATH)/sql \
|
-I$(MARIADB_SRC_PATH)/sql \
|
||||||
-I$(MARIADB_SRC_PATH)/regex/ \
|
-I$(MARIADB_SRC_PATH)/regex/ \
|
||||||
|
-I$(ROOT_PATH)/log_manager/ \
|
||||||
-I./ \
|
-I./ \
|
||||||
$(SRCS) > depend
|
$(SRCS) > depend
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <query_classifier.h>
|
#include <query_classifier.h>
|
||||||
#include "../utils/skygw_types.h"
|
#include "../utils/skygw_types.h"
|
||||||
#include "../utils/skygw_debug.h"
|
#include "../utils/skygw_debug.h"
|
||||||
|
#include <log_manager.h>
|
||||||
|
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
@ -148,10 +149,6 @@ return_with_server_handle:
|
|||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
mysql_thread_end();
|
mysql_thread_end();
|
||||||
return_without_server:
|
return_without_server:
|
||||||
//ss_dfprintf(stderr,
|
|
||||||
// "<< skygw_query_classifier_get_type : %s\n",
|
|
||||||
// STRQTYPE(qtype));
|
|
||||||
//ss_dfflush(stderr);
|
|
||||||
return qtype;
|
return qtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +232,6 @@ return_err_with_thd:
|
|||||||
thd = 0;
|
thd = 0;
|
||||||
mysql->thd = 0;
|
mysql->thd = 0;
|
||||||
return_thd:
|
return_thd:
|
||||||
//ss_dfprintf(stderr, "< get_or_create_thd_for_parsing : %p\n", thd);
|
|
||||||
//ss_dfflush(stderr);
|
|
||||||
return thd;
|
return thd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +254,7 @@ static unsigned long set_client_flags(
|
|||||||
MYSQL* mysql)
|
MYSQL* mysql)
|
||||||
{
|
{
|
||||||
unsigned long f = 0;
|
unsigned long f = 0;
|
||||||
//ss_dfprintf(stderr, "> set_client_flags\n");
|
|
||||||
f |= mysql->options.client_flag;
|
f |= mysql->options.client_flag;
|
||||||
|
|
||||||
/* Send client information for access check */
|
/* Send client information for access check */
|
||||||
@ -277,8 +272,6 @@ static unsigned long set_client_flags(
|
|||||||
if (mysql->options.db != NULL) {
|
if (mysql->options.db != NULL) {
|
||||||
f |= CLIENT_CONNECT_WITH_DB;
|
f |= CLIENT_CONNECT_WITH_DB;
|
||||||
}
|
}
|
||||||
//ss_dfprintf(stderr, "< set_client_flags : %lu\n", f);
|
|
||||||
//ss_dfflush(stderr);
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,8 +443,10 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
Item::Type itype;
|
Item::Type itype;
|
||||||
|
|
||||||
itype = item->type();
|
itype = item->type();
|
||||||
fprintf(stderr,
|
skygw_log_write(
|
||||||
"Item %s:%s\n",
|
LOGFILE_DEBUG,
|
||||||
|
"%lu [resolve_query_type] Item %s:%s",
|
||||||
|
pthread_self(),
|
||||||
item->name,
|
item->name,
|
||||||
STRITEMTYPE(itype));
|
STRITEMTYPE(itype));
|
||||||
|
|
||||||
@ -513,21 +508,31 @@ 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;
|
||||||
fprintf(stderr,
|
skygw_log_write(
|
||||||
"FUNC_SP, Stored procedure "
|
LOGFILE_DEBUG,
|
||||||
"or unknown function\n");
|
"%lu [resolve_query_type] "
|
||||||
|
"functype FUNC_SP, stored proc "
|
||||||
|
"or unknown function.",
|
||||||
|
"%s:%s",
|
||||||
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
case Item_func::UDF_FUNC:
|
case Item_func::UDF_FUNC:
|
||||||
func_qtype = QUERY_TYPE_WRITE;
|
func_qtype = QUERY_TYPE_WRITE;
|
||||||
fprintf(stderr,
|
skygw_log_write(
|
||||||
"UDF_FUNC, User-defined "
|
LOGFILE_DEBUG,
|
||||||
"function\n");
|
"%lu [resolve_query_type] "
|
||||||
|
"functype UDF_FUNC, user-defined "
|
||||||
|
"function.",
|
||||||
|
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;
|
||||||
fprintf(stderr,
|
skygw_log_write(
|
||||||
"NOW_FUNC, can be executed in "
|
LOGFILE_DEBUG,
|
||||||
"maxscale\n");
|
"%lu [resolve_query_type] "
|
||||||
|
"functype NOW_FUNC, could be "
|
||||||
|
"executed in MaxScale.",
|
||||||
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
case Item_func::UNKNOWN_FUNC:
|
case Item_func::UNKNOWN_FUNC:
|
||||||
func_qtype = QUERY_TYPE_READ;
|
func_qtype = QUERY_TYPE_READ;
|
||||||
@ -536,21 +541,28 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
* type, for example, rand(), soundex(),
|
* type, for example, rand(), soundex(),
|
||||||
* repeat() .
|
* repeat() .
|
||||||
*/
|
*/
|
||||||
fprintf(stderr,
|
skygw_log_write(
|
||||||
"UNKNOWN_FUNC, system function, "
|
LOGFILE_DEBUG,
|
||||||
"perhaps. RO.\n");
|
"%lu [resolve_query_type] "
|
||||||
|
"functype UNKNOWN_FUNC, "
|
||||||
|
"typically some system function.",
|
||||||
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,
|
skygw_log_write(
|
||||||
"Unknown function type %d\n",
|
LOGFILE_DEBUG,
|
||||||
ftype);
|
"%lu [resolve_query_type] "
|
||||||
|
"Unknown functype. Something "
|
||||||
|
"has gone wrong.",
|
||||||
|
pthread_self());
|
||||||
break;
|
break;
|
||||||
} /**< switch */
|
} /**< switch */
|
||||||
/**< Set new query type */
|
/**< Set new query type */
|
||||||
qtype = set_query_type(&qtype, func_qtype);
|
qtype = set_query_type(&qtype, func_qtype);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Write goes to master and that won't change.
|
* Write is as restrictive as it gets due functions,
|
||||||
|
* so break.
|
||||||
*/
|
*/
|
||||||
if (qtype == QUERY_TYPE_WRITE) {
|
if (qtype == QUERY_TYPE_WRITE) {
|
||||||
break;
|
break;
|
||||||
@ -558,6 +570,5 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
} /**< for */
|
} /**< for */
|
||||||
} /**< if */
|
} /**< if */
|
||||||
return_here:
|
return_here:
|
||||||
//ss_dfprintf(stderr, "< resolve_query_type : %s\n", STRQTYPE(qtype));
|
|
||||||
return qtype;
|
return qtype;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user