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

@ -397,13 +397,14 @@ int main()
pConfig->n_threads = 1;
set_libdir(MXS_STRDUP_A("../../../../../query_classifier/qc_sqlite/"));
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", "") &&
qc_process_init(QC_INIT_BOTH) &&
qc_thread_init(QC_INIT_BOTH))
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", "")
&& qc_process_init(QC_INIT_BOTH)
&& qc_thread_init(QC_INIT_BOTH))
{
set_libdir(MXS_STRDUP_A("../"));
rc = test();
qc_thread_end(QC_INIT_BOTH);
qc_process_end(QC_INIT_BOTH);
}
else