Make query classifier self-contained.
Only the query classifier needs the functionality of the embedded server, while the rest of MaxScale is content with the client library or Connector/C. This have now been rearranged so that query-classifier links with the embedded static library and then explicitly exports its own functions using the query_classifier.map linker script. That way query classifier will use the embedded library, while the rest of maxscale use the client library, and this without conflicts. Currently, query_classifier is not linked to maxscale-common, but executables must link to maxscale-common and query_classifier.
This commit is contained in:
@ -79,8 +79,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
# include <skygw_utils.h>
|
||||
# include <log_manager.h>
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
#include <query_classifier.h>
|
||||
|
||||
#include <execinfo.h>
|
||||
|
||||
@ -990,17 +991,26 @@ static void usage(void)
|
||||
*/
|
||||
void worker_thread_main(void* arg)
|
||||
{
|
||||
/** Init mysql thread context for use with a mysql handle and a parser */
|
||||
if (mysql_thread_init() == 0)
|
||||
if (qc_thread_init())
|
||||
{
|
||||
poll_waitevents(arg);
|
||||
/** Init mysql thread context for use with a mysql handle and a parser */
|
||||
if (mysql_thread_init() == 0)
|
||||
{
|
||||
poll_waitevents(arg);
|
||||
|
||||
/** Release mysql thread context */
|
||||
mysql_thread_end();
|
||||
/** Release mysql thread context */
|
||||
mysql_thread_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not perform thread initialization for MySQL. Exiting thread.");
|
||||
}
|
||||
|
||||
qc_thread_end();
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Could not perform thread initialization for MySQL. Exiting thread.");
|
||||
MXS_ERROR("Could not perform thread initialization for query classifier. Exiting thread.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1818,6 +1828,14 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (!qc_init(num_elements, server_options, server_groups))
|
||||
{
|
||||
char* logerr = "Failed to initialise query classifier library.";
|
||||
print_log_n_stderr(true, true, logerr, logerr, eno);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
|
||||
if (mysql_library_init(num_elements, server_options, server_groups))
|
||||
{
|
||||
if (!daemon_mode)
|
||||
|
Reference in New Issue
Block a user