MXS-2026 Separate QC process and thread initialization

qc_thread_init() must now explicitly be called in every thread
and not just in other threads but the one where qc_process_init()
is called.

This change was caused by QC_INIT_SELF initialization actually
being performed in query_classifier.cc. Before this change, there
actually was a leak in the routing worker running in the main
thread, the query classification cache was created twice.
This commit is contained in:
Johan Wikman
2018-08-27 15:39:38 +03:00
parent 9a6f1b2044
commit 5c1a1c2700
6 changed files with 48 additions and 43 deletions

View File

@ -423,9 +423,9 @@ int main(int argc, char* argv[])
set_libdir(strdup("../../../query_classifier/qc_sqlite"));
// We have to setup something in order for the regexes to be compiled.
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", NULL) &&
qc_process_init(QC_INIT_BOTH) &&
qc_thread_init(QC_INIT_BOTH))
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", NULL)
&& qc_process_init(QC_INIT_BOTH)
&& qc_thread_init(QC_INIT_BOTH))
{
rc = EXIT_SUCCESS;
@ -451,6 +451,7 @@ int main(int argc, char* argv[])
cout << endl;
}
qc_thread_end(QC_INIT_BOTH);
qc_process_end(QC_INIT_BOTH);
}
else