MXS-1624 Update qc_setup() prototype

Now takes a structure that, if present, enables the query
classification caching and specifies the properties of the
cache.

For the time being no actual properties are yet available.
This commit is contained in:
Johan Wikman
2018-07-06 10:46:42 +03:00
parent b7c5abf73b
commit e7913cc022
15 changed files with 29 additions and 16 deletions

View File

@ -1975,7 +1975,7 @@ int main(int argc, char **argv)
goto return_main;
}
if (!qc_setup(cnf->qc_name, cnf->qc_sql_mode, cnf->qc_args))
if (!qc_setup(NULL, cnf->qc_sql_mode, cnf->qc_name, cnf->qc_args))
{
const char* logerr = "Failed to initialise query classifier library.";
print_log_n_stderr(true, true, logerr, logerr, eno);

View File

@ -255,7 +255,9 @@ private:
}
bool qc_setup(const char* plugin_name, qc_sql_mode_t sql_mode, const char* plugin_args)
bool qc_setup(const QC_CACHE_PROPERTIES* cache_properties,
qc_sql_mode_t sql_mode,
const char* plugin_name, const char* plugin_args)
{
QC_TRACE();
ss_dassert(!this_unit.classifier);
@ -276,6 +278,7 @@ bool qc_setup(const char* plugin_name, qc_sql_mode_t sql_mode, const char* plugi
if (rv == QC_RESULT_OK)
{
this_unit.qc_sql_mode = sql_mode;
this_unit.use_cached_result = (cache_properties ? true : false);
}
else
{

View File

@ -48,7 +48,7 @@ int main(int argc, char** argv)
set_langdir(strdup("."));
set_process_datadir(strdup("/tmp"));
qc_setup("qc_sqlite", QC_SQL_MODE_DEFAULT, NULL);
qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", NULL);
qc_process_init(QC_INIT_BOTH);
qc_thread_init(QC_INIT_BOTH);

View File

@ -186,7 +186,7 @@ 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("qc_sqlite", QC_SQL_MODE_DEFAULT, NULL) &&
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", NULL) &&
qc_process_init(QC_INIT_BOTH) &&
qc_thread_init(QC_INIT_BOTH))
{

View File

@ -423,7 +423,7 @@ 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("qc_sqlite", QC_SQL_MODE_DEFAULT, NULL) &&
if (qc_setup(NULL, QC_SQL_MODE_DEFAULT, "qc_sqlite", NULL) &&
qc_process_init(QC_INIT_BOTH) &&
qc_thread_init(QC_INIT_BOTH))
{

View File

@ -42,7 +42,7 @@ void init_test_env(char *path)
}
dcb_global_init();
set_libdir(MXS_STRDUP(TEST_DIR "/query_classifier/qc_sqlite/"));
qc_setup(NULL, QC_SQL_MODE_DEFAULT, NULL);
qc_setup(NULL, QC_SQL_MODE_DEFAULT, NULL, NULL);
qc_process_init(QC_INIT_BOTH);
poll_init();
maxscale::MessageQueue::init();