Allow query classifier to initialize itself

The process and thread initialization/finalization of the query
classifier plugins is handled using the process and thread
initialization/finalization functions in the module object.

However, the top-level query classifier will also need to perform
process and thread initialization when transaction boundaries are
detected using regular expressions.
This commit is contained in:
Johan Wikman
2017-03-10 14:01:36 +02:00
parent 669d6e95f4
commit a58f944f23
8 changed files with 68 additions and 25 deletions

View File

@ -127,7 +127,7 @@ int main(int argc, char* argv[])
{
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
if (qc_setup(NULL, NULL) && qc_process_init())
if (qc_setup(NULL, NULL) && qc_process_init(QC_INIT_BOTH))
{
const char* zModule = argv[1];
@ -158,7 +158,7 @@ int main(int argc, char* argv[])
cerr << "error: Could not initialize factory." << endl;
}
qc_process_end();
qc_process_end(QC_INIT_BOTH);
}
else
{

View File

@ -237,12 +237,12 @@ int main()
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
set_libdir(MXS_STRDUP_A("../../../../../query_classifier/qc_sqlite/"));
if (qc_setup("qc_sqlite", "") && qc_process_init())
if (qc_setup("qc_sqlite", "") && qc_process_init(QC_INIT_BOTH))
{
set_libdir(MXS_STRDUP_A("../"));
rc = test();
qc_process_end();
qc_process_end(QC_INIT_BOTH);
}
else
{

View File

@ -50,7 +50,7 @@ int TestStorage::run(int argc, char** argv)
{
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
if (qc_setup(NULL, NULL) && qc_process_init())
if (qc_setup(NULL, NULL) && qc_process_init(QC_INIT_BOTH))
{
const char* zModule = NULL;
size_t threads = m_threads;
@ -113,6 +113,8 @@ int TestStorage::run(int argc, char** argv)
{
cerr << "error: Could not initialize factory " << zModule << "." << endl;
}
qc_process_end(QC_INIT_BOTH);
}
else
{