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

@ -317,9 +317,9 @@ int main(int argc, char** argv)
if (mxs_log_init(NULL, ".", MXS_LOG_TARGET_DEFAULT))
{
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, lib, NULL) &&
qc_process_init(QC_INIT_BOTH) &&
qc_thread_init(QC_INIT_BOTH))
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, lib, NULL)
&& qc_process_init(QC_INIT_BOTH)
&& qc_thread_init(QC_INIT_BOTH))
{
// Version encoded as MariaDB encodes the version, i.e.:
// version = major * 10000 + minor * 100 + patch
@ -327,6 +327,8 @@ int main(int argc, char** argv)
qc_set_server_version(version);
rc = run(input_name, expected_name);
qc_thread_end(QC_INIT_BOTH);
qc_process_end(QC_INIT_BOTH);
}
else