Merge branch 'MXS-517' into develop

This commit is contained in:
Johan Wikman 2016-02-08 11:03:31 +02:00
commit 834d04ed6c
26 changed files with 483 additions and 1981 deletions

View File

@ -33,7 +33,7 @@ check_deps()
check_dirs()
find_package(OpenSSL)
find_package(Valgrind)
find_package(MySQLClient)
find_package(MariaDBConnector)
find_package(MySQL)
find_package(Pandoc)
find_package(TCMalloc)
@ -46,6 +46,12 @@ find_package(RabbitMQ)
# Read BuildPCRE2 for details about how to add pcre2 as a dependency to a target
include(cmake/BuildPCRE2.cmake)
# If the connector was not found, download and build it from source
if(NOT MARIADB_CONNECTOR_FOUND)
message(STATUS "Building MariaDB Connector-C from source.")
include(cmake/BuildMariaDBConnector.cmake)
endif()
# You can find the variables set by this in the FindCURL.cmake file
# which is a default module in CMake.
@ -157,12 +163,6 @@ set(CMAKE_CXX_FLAGS_DEBUG "${DEBUG_FLAGS} -DSS_DEBUG -DLOG_ASSERT")
set(CMAKE_CXX_FLAGS_RELEASE "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-ggdb")
subdirs(MYSQL_DIR_ALL ${MYSQL_DIR})
foreach(DIR ${MYSQL_DIR_ALL})
include_directories(${DIR})
endforeach()
include_directories(${MYSQL_DIR}/..)
include_directories(utils)
include_directories(log_manager)
include_directories(query_classifier)

View File

@ -0,0 +1,26 @@
# Build the MariaDB Connector-C
#
# If the MariaDB connector is not found, the last option is to download it
# and build it from source. This file downloads and builds the connector and
# sets the variables set by FindMariaDBConnector.cmake so that it appears that
# the system has the connector.
include(ExternalProject)
ExternalProject_Add(connector-c
GIT_REPOSITORY https://github.com/MariaDB/mariadb-connector-c.git
GIT_TAG v2.2.1
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/connector-c/install
BINARY_DIR ${CMAKE_BINARY_DIR}/connector-c
INSTALL_DIR ${CMAKE_BINARY_DIR}/connector-c/install)
set(MARIADB_CONNECTOR_FOUND TRUE CACHE INTERNAL "" FORCE)
set(MARIADB_CONNECTOR_STATIC_FOUND TRUE CACHE INTERNAL "" FORCE)
set(MARIADB_CONNECTOR_INCLUDE_DIR
${CMAKE_BINARY_DIR}/connector-c/install/include/mariadb CACHE INTERNAL "" FORCE)
set(MARIADB_CONNECTOR_STATIC_LIBRARIES
${CMAKE_BINARY_DIR}/connector-c/install/lib/mariadb/libmariadbclient.a
CACHE INTERNAL "" FORCE)
set(MARIADB_CONNECTOR_LIBRARIES
${CMAKE_BINARY_DIR}/connector-c/install/lib/mariadb/libmariadbclient.a
CACHE INTERNAL "" FORCE)

View File

@ -0,0 +1,42 @@
# This CMake file tries to find the the MariaDB Connector-C
# The following variables are set:
# MARIADB_CONNECTOR_FOUND - System has the connector
# MARIADB_CONNECTOR_STATIC_FOUND - System has static version of the connector library
# MARIADB_CONNECTOR_LIBRARIES - The dynamic connector libraries
# MARIADB_CONNECTOR_STATIC_LIBRARIES - The static connector libraries
# MARIADB_CONNECTOR_INCLUDE_DIR - The connector headers
find_library(MARIADB_CONNECTOR_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
if(${MARIADB_CONNECTOR_LIBRARIES} MATCHES "NOTFOUND")
set(MARIADB_CONNECTOR_FOUND FALSE CACHE INTERNAL "")
message(STATUS "Dynamic MySQL client library not found.")
unset(MARIADB_CONNECTOR_LIBRARIES)
else()
set(MARIADB_CONNECTOR_FOUND TRUE CACHE INTERNAL "")
message(STATUS "Found dynamic MySQL client library: ${MARIADB_CONNECTOR_LIBRARIES}")
endif()
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
find_library(MARIADB_CONNECTOR_STATIC_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
if(${MARIADB_CONNECTOR_STATIC_LIBRARIES} MATCHES "NOTFOUND")
set(MARIADB_CONNECTOR_STATIC_FOUND FALSE CACHE INTERNAL "")
message(STATUS "Static MySQL client library not found.")
unset(MARIADB_CONNECTOR_STATIC_LIBRARIES)
else()
set(MARIADB_CONNECTOR_STATIC_FOUND TRUE CACHE INTERNAL "")
message(STATUS "Found statc MySQL client library: ${MARIADB_CONNECTOR_STATIC_LIBRARIES}")
endif()
find_path(MARIADB_CONNECTOR_INCLUDE_DIR mysql.h PATH_SUFFIXES mysql mariadb)
include(CheckSymbolExists)
check_symbol_exists(LIBMARIADB ${MARIADB_CONNECTOR_INCLUDE_DIR}/mysql.h HAVE_MARIADB_CONNECTOR)
if(HAVE_MARIADB_CONNECTOR)
message(STATUS "Found MariaDB Connector-C")
else()
set(MARIADB_CONNECTOR_FOUND FALSE CACHE INTERNAL "" FORCE)
endif()

View File

@ -1,42 +1,43 @@
# This CMake file tries to find the the mysql_version.h header
# and to parse it for version and provider strings
# The following variables are set:
# MYSQL_VERSION - The MySQL version number
# MYSQL_PROVIDER - The MySQL provider e.g. MariaDB
# MYSQL_EMBEDDED_LIB - The MySQL embedded library
# MYSQL_EMBEDDED_VERSION - The MySQL version number
# MYSQL_EMBEDDED_PROVIDER - The MySQL provider e.g. MariaDB
# MYSQL_EMBEDDED_LIBRARIES - The MySQL embedded library
# MYSQL_EMBEDDED_INCLUDE_DIR - Path to MySQL headers
find_file(MYSQL_VERSION_H mysql_version.h PATH_SUFFIXES mysql)
if(MYSQL_VERSION_H MATCHES "MYSQL_VERSION_H-NOTFOUND")
find_file(MYSQL_EMBEDDED_VERSION_H mysql_version.h PATH_SUFFIXES mysql)
if(MYSQL_EMBEDDED_VERSION_H MATCHES "MYSQL_EMBEDDED_VERSION_H-NOTFOUND")
message(FATAL_ERROR "Cannot find the mysql_version.h header")
else()
message(STATUS "Found mysql_version.h: ${MYSQL_VERSION_H}")
message(STATUS "Found mysql_version.h: ${MYSQL_EMBEDDED_VERSION_H}")
endif()
file(READ ${MYSQL_VERSION_H} MYSQL_VERSION_CONTENTS)
string(REGEX REPLACE ".*MYSQL_SERVER_VERSION[^0-9.]+([0-9.]+).*" "\\1" MYSQL_VERSION ${MYSQL_VERSION_CONTENTS})
string(REGEX REPLACE ".*MYSQL_COMPILATION_COMMENT[[:space:]]+\"(.+)\".*" "\\1" MYSQL_PROVIDER ${MYSQL_VERSION_CONTENTS})
string(TOLOWER ${MYSQL_PROVIDER} MYSQL_PROVIDER)
if(MYSQL_PROVIDER MATCHES "[mM]aria[dD][bB]")
set(MYSQL_PROVIDER "MariaDB" CACHE INTERNAL "The MySQL provider")
elseif(MYSQL_PROVIDER MATCHES "mysql")
set(MYSQL_PROVIDER "MySQL" CACHE INTERNAL "The MySQL provider")
elseif(MYSQL_PROVIDER MATCHES "percona")
set(MYSQL_PROVIDER "Percona" CACHE INTERNAL "The MySQL provider")
file(READ ${MYSQL_EMBEDDED_VERSION_H} MYSQL_EMBEDDED_VERSION_CONTENTS)
string(REGEX REPLACE ".*MYSQL_SERVER_VERSION[^0-9.]+([0-9.]+).*" "\\1" MYSQL_EMBEDDED_VERSION ${MYSQL_EMBEDDED_VERSION_CONTENTS})
string(REGEX REPLACE ".*MYSQL_COMPILATION_COMMENT[[:space:]]+\"(.+)\".*" "\\1" MYSQL_EMBEDDED_PROVIDER ${MYSQL_EMBEDDED_VERSION_CONTENTS})
string(TOLOWER ${MYSQL_EMBEDDED_PROVIDER} MYSQL_EMBEDDED_PROVIDER)
if(MYSQL_EMBEDDED_PROVIDER MATCHES "[mM]aria[dD][bB]")
set(MYSQL_EMBEDDED_PROVIDER "MariaDB" CACHE INTERNAL "The MySQL provider")
elseif(MYSQL_EMBEDDED_PROVIDER MATCHES "mysql")
set(MYSQL_EMBEDDED_PROVIDER "MySQL" CACHE INTERNAL "The MySQL provider")
elseif(MYSQL_EMBEDDED_PROVIDER MATCHES "percona")
set(MYSQL_EMBEDDED_PROVIDER "Percona" CACHE INTERNAL "The MySQL provider")
else()
set(MYSQL_PROVIDER "Unknown" CACHE INTERNAL "The MySQL provider")
set(MYSQL_EMBEDDED_PROVIDER "Unknown" CACHE INTERNAL "The MySQL provider")
endif()
message(STATUS "MySQL version: ${MYSQL_VERSION}")
message(STATUS "MySQL provider: ${MYSQL_PROVIDER}")
message(STATUS "MySQL version: ${MYSQL_EMBEDDED_VERSION}")
message(STATUS "MySQL provider: ${MYSQL_EMBEDDED_PROVIDER}")
if(NOT MYSQL_PROVIDER STREQUAL "MariaDB")
message(WARNING "Not using a release version of MariaDB server. If this is intentional, please ignore this warning. Otherwise make sure the right libraries are installed and CMake finds the right libraries.")
if(NOT MYSQL_EMBEDDED_PROVIDER STREQUAL "MariaDB")
message(WARNING "Not using a release version of MariaDB server. If this is intentional, please ignore this warning. Otherwise make sure the right libraries are installed and CMake finds the right libraries.")
endif()
if(MYSQL_VERSION VERSION_LESS 5.5.41)
message(WARNING "MySQL version is ${MYSQL_VERSION}. Minimum supported version is 5.5.41.")
if(MYSQL_EMBEDDED_VERSION VERSION_LESS 5.5.41)
message(WARNING "MySQL version is ${MYSQL_EMBEDDED_VERSION}. Minimum supported version is 5.5.41.")
endif()
if(NOT (MYSQL_VERSION VERSION_LESS 10.1))
if(NOT (MYSQL_EMBEDDED_VERSION VERSION_LESS 10.1))
# 10.1 needs lzma
find_library(HAVE_LIBLZMA NAMES lzma)
@ -47,18 +48,18 @@ if(NOT (MYSQL_VERSION VERSION_LESS 10.1))
endif()
if (DEFINED MYSQL_EMBEDDED_LIB)
if( NOT (IS_DIRECTORY ${MYSQL_EMBEDDED_LIB}) )
debugmsg("MYSQL_EMBEDDED_LIB is not a directory: ${MYSQL_EMBEDDED_LIB}")
if (DEFINED MYSQL_EMBEDDED_LIBRARIES)
if( NOT (IS_DIRECTORY ${MYSQL_EMBEDDED_LIBRARIES}) )
debugmsg("MYSQL_EMBEDDED_LIBRARIES is not a directory: ${MYSQL_EMBEDDED_LIBRARIES}")
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
set(COMP_VAR PATH)
else()
set(COMP_VAR DIRECTORY)
endif()
get_filename_component(MYSQL_EMBEDDED_LIB ${MYSQL_EMBEDDED_LIB} ${COMP_VAR})
debugmsg("MYSQL_EMBEDDED_LIB directory component: ${MYSQL_EMBEDDED_LIB}")
get_filename_component(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES} ${COMP_VAR})
debugmsg("MYSQL_EMBEDDED_LIBRARIES directory component: ${MYSQL_EMBEDDED_LIBRARIES}")
endif()
debugmsg("Searching for the embedded library at: ${MYSQL_EMBEDDED_LIB}")
debugmsg("Searching for the embedded library at: ${MYSQL_EMBEDDED_LIBRARIES}")
endif()
if(STATIC_EMBEDDED)
@ -66,38 +67,38 @@ if(STATIC_EMBEDDED)
debugmsg("Using the static embedded library...")
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
if (DEFINED MYSQL_EMBEDDED_LIB)
debugmsg("Searching for libmysqld.a at: ${MYSQL_EMBEDDED_LIB}")
find_library(MYSQL_EMBEDDED_LIB_STATIC libmysqld.a PATHS ${MYSQL_EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
if (DEFINED MYSQL_EMBEDDED_LIBRARIES)
debugmsg("Searching for libmysqld.a at: ${MYSQL_EMBEDDED_LIBRARIES}")
find_library(MYSQL_EMBEDDED_LIBRARIES_STATIC libmysqld.a PATHS ${MYSQL_EMBEDDED_LIBRARIES} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
else()
find_library(MYSQL_EMBEDDED_LIB_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
find_library(MYSQL_EMBEDDED_LIBRARIES_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
endif()
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIB_STATIC}")
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIBRARIES_STATIC}")
set(MYSQL_EMBEDDED_LIB ${MYSQL_EMBEDDED_LIB_STATIC} CACHE FILEPATH "Path to libmysqld" FORCE)
set(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES_STATIC} CACHE FILEPATH "Path to libmysqld" FORCE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
else()
debugmsg("Using the dynamic embedded library...")
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so")
if (DEFINED MYSQL_EMBEDDED_LIB)
debugmsg("Searching for libmysqld.so at: ${MYSQL_EMBEDDED_LIB}")
find_library(MYSQL_EMBEDDED_LIB_DYNAMIC mysqld PATHS ${MYSQL_EMBEDDED_LIB} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
if (DEFINED MYSQL_EMBEDDED_LIBRARIES)
debugmsg("Searching for libmysqld.so at: ${MYSQL_EMBEDDED_LIBRARIES}")
find_library(MYSQL_EMBEDDED_LIBRARIES_DYNAMIC mysqld PATHS ${MYSQL_EMBEDDED_LIBRARIES} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
else()
find_library(MYSQL_EMBEDDED_LIB_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
find_library(MYSQL_EMBEDDED_LIBRARIES_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
endif()
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIB_DYNAMIC}")
set(MYSQL_EMBEDDED_LIB ${MYSQL_EMBEDDED_LIB_DYNAMIC} CACHE FILEPATH "Path to libmysqld" FORCE)
debugmsg("Search returned: ${MYSQL_EMBEDDED_LIBRARIES_DYNAMIC}")
set(MYSQL_EMBEDDED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES_DYNAMIC} CACHE FILEPATH "Path to libmysqld" FORCE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
endif()
unset(MYSQL_EMBEDDED_LIB_DYNAMIC)
unset(MYSQL_EMBEDDED_LIB_STATIC)
unset(MYSQL_EMBEDDED_LIBRARIES_DYNAMIC)
unset(MYSQL_EMBEDDED_LIBRARIES_STATIC)
unset(OLD_SUFFIXES)
check_library_exists(${MYSQL_EMBEDDED_LIB} pcre_stack_guard ${MYSQL_EMBEDDED_LIB} HAVE_EMBEDDED_PCRE)
check_library_exists(${MYSQL_EMBEDDED_LIBRARIES} pcre_stack_guard ${MYSQL_EMBEDDED_LIBRARIES} HAVE_EMBEDDED_PCRE)
if(HAVE_EMBEDDED_PCRE)
set(PCRE_LINK_FLAGS "" CACHE INTERNAL "pcre linker flags")
@ -110,8 +111,49 @@ else()
message(FATAL_ERROR "Could not find PCRE libraries.")
endif()
endif()
if( (${MYSQL_EMBEDDED_LIB} MATCHES "NOTFOUND") OR (${MYSQL_EMBEDDED_LIB} MATCHES "NOTFOUND"))
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DMYSQL_EMBEDDED_LIB=<path to library>")
if( (${MYSQL_EMBEDDED_LIBRARIES} MATCHES "NOTFOUND") OR (${MYSQL_EMBEDDED_LIBRARIES} MATCHES "NOTFOUND"))
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DMYSQL_EMBEDDED_LIBRARIES=<path to library>")
else()
message(STATUS "Using embedded library: ${MYSQL_EMBEDDED_LIB}")
message(STATUS "Using embedded library: ${MYSQL_EMBEDDED_LIBRARIES}")
endif()
# Find the MySQL headers if they were not defined
if(DEFINED MYSQL_EMBEDDED_INCLUDE_DIR)
list(APPEND CMAKE_INCLUDE_PATH ${MYSQL_EMBEDDED_INCLUDE_DIR})
find_path(MYSQL_EMBEDDED_INCLUDE_DIR_LOC mysql.h PATHS ${MYSQL_EMBEDDED_INCLUDE_DIR} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
else()
find_path(MYSQL_EMBEDDED_INCLUDE_DIR_LOC mysql.h PATH_SUFFIXES mysql mariadb)
endif()
if(${MYSQL_EMBEDDED_INCLUDE_DIR_LOC} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
else()
set(MYSQL_EMBEDDED_INCLUDE_DIR ${MYSQL_EMBEDDED_INCLUDE_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE)
message(STATUS "Using MySQL headers found at: ${MYSQL_EMBEDDED_INCLUDE_DIR}")
endif()
unset(MYSQL_EMBEDDED_INCLUDE_DIR_LOC)
# Find the errmsg.sys file if it was not defied
if( DEFINED ERRMSG )
debugmsg("Looking for errmsg.sys at: ${ERRMSG}")
if(NOT(IS_DIRECTORY ${ERRMSG}))
get_filename_component(ERRMSG ${ERRMSG} PATH)
debugmsg("Path to file is: ${ERRMSG}")
endif()
find_file(ERRMSG_FILE errmsg.sys PATHS ${ERRMSG} NO_DEFAULT_PATH)
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found at ${ERRMSG}")
else()
message(STATUS "Using custom errmsg.sys found at: ${ERRMSG_FILE}")
endif()
else()
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english)
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
endif()
endif()
set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE)
unset(ERRMSG_FILE)

View File

@ -1,33 +0,0 @@
# This CMake file tries to find the the MySQL client library
# The following variables are set:
# MYSQLCLIENT_FOUND - System has MySQL client
# MYSQLCLIENT_STATIC_FOUND - System has statically linked MySQL client
# MYSQLCLIENT_LIBRARIES - The MySQL client library
# MYSQLCLIENT_STATIC_LIBRARIES - The static MySQL client library
# MYSQLCLIENT_HEADERS - The MySQL client headers
find_library(MYSQLCLIENT_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
if(${MYSQLCLIENT_LIBRARIES} MATCHES "NOTFOUND")
set(MYSQLCLIENT_FOUND FALSE CACHE INTERNAL "")
message(STATUS "Dynamic MySQL client library not found.")
unset(MYSQLCLIENT_LIBRARIES)
else()
set(MYSQLCLIENT_FOUND TRUE CACHE INTERNAL "")
message(STATUS "Found dynamic MySQL client library: ${MYSQLCLIENT_LIBRARIES}")
endif()
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
find_library(MYSQLCLIENT_STATIC_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
if(${MYSQLCLIENT_STATIC_LIBRARIES} MATCHES "NOTFOUND")
set(MYSQLCLIENT_STATIC_FOUND FALSE CACHE INTERNAL "")
message(STATUS "Static MySQL client library not found.")
unset(MYSQLCLIENT_STATIC_LIBRARIES)
else()
set(MYSQLCLIENT_STATIC_FOUND TRUE CACHE INTERNAL "")
message(STATUS "Found statc MySQL client library: ${MYSQLCLIENT_STATIC_LIBRARIES}")
endif()
find_path(MYSQLCLIENT_HEADERS mysql.h PATH_SUFFIXES mysql mariadb)

View File

@ -144,60 +144,15 @@ macro(check_deps)
endmacro()
macro(check_dirs)
# Find the MySQL headers if they were not defined
if(DEFINED MYSQL_DIR)
debugmsg("Searching for MySQL headers at: ${MYSQL_DIR}")
list(APPEND CMAKE_INCLUDE_PATH ${MYSQL_DIR})
find_path(MYSQL_DIR_LOC mysql.h PATHS ${MYSQL_DIR} PATH_SUFFIXES mysql mariadb NO_DEFAULT_PATH)
else()
find_path(MYSQL_DIR_LOC mysql.h PATH_SUFFIXES mysql mariadb)
endif()
debugmsg("Search returned: ${MYSQL_DIR_LOC}")
if(${MYSQL_DIR_LOC} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
else()
set(MYSQL_DIR ${MYSQL_DIR_LOC} CACHE PATH "Path to MySQL headers" FORCE)
message(STATUS "Using MySQL headers found at: ${MYSQL_DIR}")
endif()
unset(MYSQL_DIR_LOC)
# Find the errmsg.sys file if it was not defied
if( DEFINED ERRMSG )
debugmsg("Looking for errmsg.sys at: ${ERRMSG}")
if(NOT(IS_DIRECTORY ${ERRMSG}))
get_filename_component(ERRMSG ${ERRMSG} PATH)
debugmsg("Path to file is: ${ERRMSG}")
endif()
find_file(ERRMSG_FILE errmsg.sys PATHS ${ERRMSG} NO_DEFAULT_PATH)
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found at ${ERRMSG}")
else()
message(STATUS "Using custom errmsg.sys found at: ${ERRMSG_FILE}")
endif()
else()
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english)
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
else()
message(STATUS "Using errmsg.sys found at: ${ERRMSG_FILE}")
endif()
endif()
set(ERRMSG ${ERRMSG_FILE} CACHE FILEPATH "Path to the errmsg.sys file." FORCE)
unset(ERRMSG_FILE)
# Check which init.d script to install
if(WITH_SCRIPTS)
find_file(RPM_FNC functions PATHS /etc/rc.d/init.d)
if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND")
find_file(DEB_FNC init-functions PATHS /lib/lsb)
if(${DEB_FNC} MATCHES "DEB_FNC-NOTFOUND")
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
else()
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
endif()
else()
set(DEB_BASED FALSE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
@ -215,16 +170,17 @@ endmacro()
function(subdirs VAR DIRPATH)
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
set(COMP_VAR PATH)
else()
set(COMP_VAR DIRECTORY)
endif()
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
set(COMP_VAR PATH)
else()
set(COMP_VAR DIRECTORY)
endif()
file(GLOB_RECURSE SDIR ${DIRPATH}/*)
foreach(LOOP ${SDIR})
get_filename_component(LOOP ${LOOP} ${COMP_VAR})
list(APPEND ALLDIRS ${LOOP})
endforeach()
list(REMOVE_DUPLICATES ALLDIRS)
set(${VAR} "${ALLDIRS}" CACHE PATH " " FORCE)
set(${VAR} "${ALLDIRS}" CACHE PATH " " FORCE)
endfunction()

View File

@ -1,9 +1,9 @@
add_library(query_classifier SHARED query_classifier.cc)
target_link_libraries(query_classifier ${MYSQL_EMBEDDED_LIB} aio crypt crypto dl m ${PCRE_LINK_FLAGS} ssl stdc++ z)
target_link_libraries(query_classifier maxscale-common)
set_target_properties(query_classifier PROPERTIES VERSION "1.0.0")
set_target_properties(query_classifier PROPERTIES LINK_FLAGS -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/query_classifier.map)
#set_target_properties(query_classifier PROPERTIES LINK_FLAGS -Wl,-z,defs)
set_target_properties(query_classifier PROPERTIES LINK_FLAGS -Wl,-z,defs)
install(TARGETS query_classifier COMPONENT lib DESTINATION ${MAXSCALE_LIBDIR})
add_subdirectory(qc_mysqlembedded)

View File

@ -1,6 +1,14 @@
# Include the embedded library headers
subdirs(MYSQL_INCLUDE_DIR_ALL ${MYSQL_EMBEDDED_INCLUDE_DIR})
foreach(DIR ${MYSQL_INCLUDE_DIR_ALL})
include_directories(${DIR})
endforeach()
include_directories(${MYSQL_EMMBEDDED_INCLUDE_DIR}/..)
add_library(qc_mysqlembedded SHARED qc_mysqlembedded.cc)
target_link_libraries(qc_mysqlembedded ${MYSQL_EMBEDDED_LIB} aio crypt crypto dl m ${PCRE_LINK_FLAGS} ssl stdc++ z)
include_directories(${MYSQL_INCLUDE_DIR})
target_link_libraries(qc_mysqlembedded ${MYSQL_EMBEDDED_LIBRARIES} aio crypt crypto dl m ${PCRE_LINK_FLAGS} ssl stdc++ z)
set_target_properties(qc_mysqlembedded PROPERTIES VERSION "1.0.0")
set_target_properties(qc_mysqlembedded PROPERTIES LINK_FLAGS -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/qc_mysqlembedded.map)
#set_target_properties(qc_mysqlembedded PROPERTIES LINK_FLAGS -Wl,-z,defs)

View File

@ -60,6 +60,7 @@
#include <log_manager.h>
#include <query_classifier.h>
#include <mysql_client_server_protocol.h>
#include <gwdirs.h>
#include <stdio.h>
#include <stdlib.h>
@ -1775,29 +1776,126 @@ qc_query_op_t qc_get_operation(GWBUF* querybuf)
return operation;
}
bool qc_init(int argc, char** argv, char** groups)
namespace
{
int rc = mysql_library_init(argc, argv, groups);
if (rc != 0)
// Do not change the order without making corresponding changes to IDX_... below.
const char* server_options[] =
{
"MariaDB Corporation MaxScale",
"--no-defaults",
"--datadir=",
"--language=",
"--skip-innodb",
"--default-storage-engine=myisam",
NULL
};
const int IDX_DATADIR = 2;
const int IDX_LANGUAGE = 3;
const int N_OPTIONS = (sizeof(server_options) / sizeof(server_options[0])) - 1;
const char* server_groups[] = {
"embedded",
"server",
"server",
"embedded",
"server",
"server",
NULL
};
const int OPTIONS_DATADIR_SIZE = 10 + PATH_MAX; // strlen("--datadir=");
const int OPTIONS_LANGUAGE_SIZE = 11 + PATH_MAX; // strlen("--language=");
char datadir_arg[OPTIONS_DATADIR_SIZE];
char language_arg[OPTIONS_LANGUAGE_SIZE];
bool create_datadir(const char* base, char* datadir)
{
bool created = false;
if (snprintf(datadir, PATH_MAX, "%s/data%d", base, getpid()) < PATH_MAX)
{
MXS_ERROR("mysql_library_init() failed. Error code: %d", rc);
int rc = mkdir(datadir, 0777);
if ((rc == 0) || (errno == EEXIST))
{
created = true;
}
else
{
char errbuf[STRERROR_BUFLEN];
fprintf(stderr, "MaxScale: error: Cannot create data directory '%s': %d %s\n",
datadir, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
}
}
else
{
MXS_NOTICE("Query classifier initialized.");
fprintf(stderr, "MaxScale: error: Too long data directory: %s/data%d.", base, getpid());
}
return rc == 0;
return created;
}
void qc_end()
void configure_options(const char* datadir, const char* langdir)
{
int rv;
rv = snprintf(datadir_arg, OPTIONS_DATADIR_SIZE, "--datadir=%s", datadir);
ss_dassert(rv < OPTIONS_DATADIR_SIZE); // Ensured by create_datadir().
server_options[IDX_DATADIR] = datadir_arg;
rv = sprintf(language_arg, "--language=%s", langdir);
ss_dassert(rv < OPTIONS_LANGUAGE_SIZE); // Ensured by qc_init().
server_options[IDX_LANGUAGE] = language_arg;
}
}
bool qc_init(void)
{
bool inited = false;
char datadir[PATH_MAX];
if (strlen(get_langdir()) >= PATH_MAX)
{
fprintf(stderr, "MaxScale: error: Language path is too long: %s.", get_langdir());
}
else
{
if (create_datadir(get_datadir(), datadir))
{
configure_options(datadir, get_langdir());
int argc = N_OPTIONS;
char** argv = const_cast<char**>(server_options);
char** groups = const_cast<char**>(server_groups);
int rc = mysql_library_init(argc, argv, groups);
if (rc != 0)
{
MXS_ERROR("mysql_library_init() failed. Error code: %d", rc);
}
else
{
MXS_NOTICE("Query classifier initialized.");
inited = true;
}
}
}
return inited;
}
void qc_end(void)
{
mysql_library_end();
}
bool qc_thread_init()
bool qc_thread_init(void)
{
bool inited = (mysql_thread_init() == 0);
@ -1809,7 +1907,7 @@ bool qc_thread_init()
return inited;
}
void qc_thread_end()
void qc_thread_end(void)
{
mysql_thread_end();
}
@ -1818,6 +1916,9 @@ void qc_thread_end()
* EXPORTS
*/
extern "C"
{
static char version_string[] = "V1.0.0";
static QUERY_CLASSIFIER qc =
@ -1862,4 +1963,4 @@ QUERY_CLASSIFIER* GetModuleObject()
return &qc;
}
}

View File

@ -2,7 +2,7 @@
global:
info;
version;
GetModuleInfo;
GetModuleObject;
ModuleInit;
local:
*;

File diff suppressed because it is too large Load Diff

View File

@ -74,11 +74,11 @@ typedef enum
#define QUERY_IS_TYPE(mask,type) ((mask & type) == type)
bool qc_init(int argc, char** argv, char** groups);
void qc_end();
bool qc_init(const char* plugin_name);
void qc_end(void);
bool qc_thread_init();
void qc_thread_end();
bool qc_thread_init(void);
void qc_thread_end(void);
/**
* Create THD and use it for creating parse tree. Examine parse tree and
@ -99,11 +99,11 @@ char** qc_get_database_names(GWBUF* querybuf, int* size);
typedef struct query_classifier
{
bool (*qc_init)(int argc, char** argv, char** groups);
void (*qc_end)();
bool (*qc_init)(void);
void (*qc_end)(void);
bool (*qc_thread_init)();
void (*qc_thread_end)();
bool (*qc_thread_init)(void);
void (*qc_thread_end)(void);
qc_query_type_t (*qc_get_type)(GWBUF* querybuf);
qc_query_op_t (*qc_get_operation)(GWBUF* querybuf);

View File

@ -1,3 +1,10 @@
# Include the embedded library headers
subdirs(MYSQL_INCLUDE_DIR_ALL ${MYSQL_EMBEDDED_INCLUDE_DIR})
foreach(DIR ${MYSQL_INCLUDE_DIR_ALL})
include_directories(${DIR})
endforeach()
include_directories(${MYSQL_EMMBEDDED_INCLUDE_DIR}/..)
if(${ERRMSG} MATCHES "ERRMSG-NOTFOUND")
message(FATAL_ERROR "The errmsg.sys file was not found, please define the path with -DERRMSG=<path>")
else()

View File

@ -29,9 +29,9 @@ add_subdirectory(inih)
add_executable (consumer ${CMAKE_BINARY_DIR}/consumer.c)
if(MYSQLCLIENT_STATIC_FOUND)
target_link_libraries(consumer ${MYSQLCLIENT_STATIC_LIBRARIES} rabbitmq inih ssl crypt crypto dl z m pthread)
target_link_libraries(consumer ${MARIADB_CONNECTOR_STATIC_LIB} rabbitmq inih ssl crypt crypto dl z m pthread)
else()
target_link_libraries(consumer ${MYSQLCLIENT_LIBRARIES} rabbitmq inih ssl crypt crypto dl z m pthread)
target_link_libraries(consumer ${MARIADB_CONNECTOR_LIB} rabbitmq inih ssl crypt crypto dl z m pthread)
endif()
install(TARGETS consumer DESTINATION ${MAXSCALE_BINDIR})

View File

@ -1,3 +1,6 @@
# Use the client libraries in MaxScale core
include_directories(${MARIADB_CONNECTOR_INCLUDE_DIR})
add_subdirectory(core)
add_subdirectory(modules)
add_subdirectory(inih)

View File

@ -1,6 +1,6 @@
add_library(maxscale-common SHARED adminusers.c atomic.c buffer.c config.c dbusers.c dcb.c filter.c externcmd.c gwbitmask.c gwdirs.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c maxscale_pcre2.c memlog.c modutil.c monitor.c poll.c random_jkiss.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/utils/skygw_utils.cc statistics.c)
target_link_libraries(maxscale-common ${MYSQLCLIENT_LIBRARIES} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++)
target_link_libraries(maxscale-common ${MARIADB_CONNECTOR_LIBRARIES} ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ssl aio pthread crypt dl crypto inih z rt m stdc++)
if(WITH_JEMALLOC)
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})
@ -10,6 +10,7 @@ endif()
add_dependencies(maxscale-common pcre2)
install(TARGETS maxscale-common DESTINATION ${MAXSCALE_LIBDIR})
set_target_properties(maxscale-common PROPERTIES VERSION "1.0.0")
add_executable(maxscale gateway.c)
add_dependencies(maxscale pcre2)

View File

@ -1002,6 +1002,22 @@ handle_global_item(const char *name, const char *value)
MXS_ERROR("Invalid timeout value for 'auth_write_timeout': %s", value);
}
}
else if (strcmp(name, "query_classifier") == 0)
{
int len = strlen(value);
int max_len = sizeof(gateway.qc_name) - 1;
if (len <= max_len)
{
strcpy(gateway.qc_name, value);
}
else
{
MXS_ERROR("The length of '%s' is %d, while the maximum length is %d.",
value, len, max_len);
return 0;
}
}
else
{
for (i = 0; lognames[i].name; i++)
@ -1110,6 +1126,9 @@ global_defaults()
{
strncpy(gateway.sysname, uname_data.sysname, _SYSNAME_STR_LENGTH);
}
/* query_classifier */
memset(gateway.qc_name, 0, sizeof(gateway.qc_name));
}
/**

View File

@ -2186,6 +2186,10 @@ MYSQL *gw_mysql_init()
{
if (gw_mysql_set_timeouts(con) == 0)
{
// MYSQL_OPT_USE_REMOTE_CONNECTION must be set if the embedded
// libary is used. With Connector-C (at least 2.2.1) the call
// fails.
#if !defined(LIBMARIADB)
if (mysql_options(con, MYSQL_OPT_USE_REMOTE_CONNECTION, NULL) != 0)
{
MXS_ERROR("Failed to set external connection. "
@ -2193,6 +2197,7 @@ MYSQL *gw_mysql_init()
mysql_close(con);
con = NULL;
}
#endif
}
else
{

View File

@ -104,33 +104,6 @@ time_t MaxScaleStarted;
extern char *program_invocation_name;
extern char *program_invocation_short_name;
/*
* Server options are passed to the mysql_server_init. Each gateway must have a unique
* data directory that is passed to the mysql_server_init, therefore the data directory
* is not fixed here and will be updated elsewhere.
*/
static char* server_options[] = {
"MariaDB Corporation MaxScale",
"--no-defaults",
"--datadir=",
"--language=",
"--skip-innodb",
"--default-storage-engine=myisam",
NULL
};
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
static char* server_groups[] = {
"embedded",
"server",
"server",
"embedded",
"server",
"server",
NULL
};
/* The data directory we created for this gateway instance */
static char datadir[PATH_MAX + 1] = "";
static bool datadir_defined = false; /*< If the datadir was already set */
@ -144,9 +117,9 @@ static int pidfd = PIDFD_CLOSED;
static bool do_exit = FALSE;
/**
* Flag to indicate whether libmysqld is successfully initialized.
* Flag to indicate whether MySQL is successfully initialized.
*/
static bool libmysqld_started = FALSE;
static bool libmysql_initialized = FALSE;
/**
* If MaxScale is started to run in daemon process the value is true.
@ -505,7 +478,7 @@ void datadir_cleanup()
static void libmysqld_done(void)
{
if (libmysqld_started)
if (libmysql_initialized)
{
mysql_library_end();
}
@ -1062,8 +1035,6 @@ int main(int argc, char **argv)
int child_status;
THREAD* threads = NULL; /*< thread list */
char mysql_home[PATH_MAX+1];
char datadir_arg[10+PATH_MAX+1]; /*< '--datadir=' + PATH_MAX */
char language_arg[11+PATH_MAX+1]; /*< '--language=' + PATH_MAX */
char* cnf_file_path = NULL; /*< conf file, to be freed */
char* cnf_file_arg = NULL; /*< conf filename from cmd-line arg */
THREAD log_flush_thr;
@ -1777,19 +1748,6 @@ int main(int argc, char **argv)
}
}
snprintf(datadir, PATH_MAX, "%s/data%d", get_datadir(), getpid());
if (mkdir(datadir, 0777) != 0){
if (errno != EEXIST){
char errbuf[STRERROR_BUFLEN];
fprintf(stderr,
"Error: Cannot create data directory '%s': %d %s\n",
datadir, errno, strerror_r(errno, errbuf, sizeof(errbuf)));
goto return_main;
}
}
if (!daemon_mode)
{
fprintf(stderr,
@ -1811,25 +1769,23 @@ int main(int argc, char **argv)
MXS_NOTICE("Module directory: %s", get_libdir());
MXS_NOTICE("Service cache: %s", get_cachedir());
/*< Update the server options */
for (i = 0; server_options[i]; i++)
if (!config_load(cnf_file_path))
{
if (!strcmp(server_options[i], "--datadir="))
{
snprintf(datadir_arg, 10+PATH_MAX+1, "--datadir=%s", datadir);
server_options[i] = datadir_arg;
}
else if (!strcmp(server_options[i], "--language="))
{
snprintf(language_arg,
11+PATH_MAX+1,
"--language=%s",
get_langdir());
server_options[i] = language_arg;
}
char* fprerr =
"Failed to open, read or process the MaxScale configuration "
"file. Exiting. See the error log for details.";
print_log_n_stderr(false, !daemon_mode, fprerr, fprerr, 0);
MXS_ERROR("Failed to open, read or process the MaxScale configuration file %s. "
"Exiting.",
cnf_file_path);
rc = MAXSCALE_BADCONFIG;
goto return_main;
}
if (!qc_init(num_elements, server_options, server_groups))
GATEWAY_CONF* cnf = config_get_global_options();
ss_dassert(cnf);
if (!qc_init(cnf->qc_name))
{
char* logerr = "Failed to initialise query classifier library.";
print_log_n_stderr(true, true, logerr, logerr, eno);
@ -1837,7 +1793,7 @@ int main(int argc, char **argv)
goto return_main;
}
if (mysql_library_init(num_elements, server_options, server_groups))
if (mysql_library_init(0, NULL, NULL))
{
if (!daemon_mode)
{
@ -1876,28 +1832,14 @@ int main(int argc, char **argv)
}
MXS_ERROR("mysql_library_init failed. It is a "
"mandatory component, required by router services and "
"the MaxScale core. Error %d, %s, %s : %d. Exiting.",
"the MaxScale core. Error %d, %s. Exiting.",
mysql_errno(NULL),
mysql_error(NULL),
__FILE__,
__LINE__);
mysql_error(NULL));
rc = MAXSCALE_NOLIBRARY;
goto return_main;
}
libmysqld_started = TRUE;
libmysql_initialized = TRUE;
if (!config_load(cnf_file_path))
{
char* fprerr =
"Failed to open, read or process the MaxScale configuration "
"file. Exiting. See the error log for details.";
print_log_n_stderr(false, !daemon_mode, fprerr, fprerr, 0);
MXS_ERROR("Failed to open, read or process the MaxScale configuration file %s. "
"Exiting.",
cnf_file_path);
rc = MAXSCALE_BADCONFIG;
goto return_main;
}
MXS_NOTICE("MariaDB Corporation MaxScale %s (C) MariaDB Corporation Ab 2013-2015", MAXSCALE_VERSION);
MXS_NOTICE("MaxScale is running in process %i", getpid());
@ -2012,6 +1954,8 @@ int main(int argc, char **argv)
/** Release mysql thread context*/
mysql_thread_end();
qc_end();
utils_end();
datadir_cleanup();
MXS_NOTICE("MaxScale shutdown completed.");

View File

@ -124,7 +124,8 @@ typedef struct
int log_to_shm; /**< Write log-file to shared memory */
unsigned int auth_conn_timeout; /**< Connection timeout for the user authentication */
unsigned int auth_read_timeout; /**< Read timeout for the user authentication */
unsigned int auth_write_timeout; /**< Write timeout for the user authentication */
unsigned int auth_write_timeout; /**< Write timeout for the user authentication */
char qc_name[PATH_MAX]; /**< The name of the query classifier to load */
} GATEWAY_CONF;

View File

@ -80,7 +80,6 @@
#include <query_classifier.h>
#include <spinlock.h>
#include <session.h>
#include <plugin.h>
#include <housekeeper.h>
MODULE_INFO info =

View File

@ -64,6 +64,7 @@
#include <dbusers.h>
#include <version.h>
#include <housekeeper.h>
#include <mysql.h>
#define GW_MYSQL_VERSION "MaxScale " MAXSCALE_VERSION
#define GW_MYSQL_LOOP_TIMEOUT 300000000
@ -224,9 +225,15 @@ typedef enum
),
} gw_mysql_capabilities_t;
// mysql.h from Connector-C exposes this enum, while mysql.h from
// MariaDB does not.
// TODO: This should probably be removed as Connector-C will be
// TODO: a pre-requisite for building MaxScale.
#if defined(LIBMARIADB)
typedef enum enum_server_command mysql_server_cmd_t;
#else
/** Copy from enum in mariadb-5.5 mysql_com.h */
typedef enum mysql_server_cmd {
MYSQL_COM_UNDEFINED = -1,
MYSQL_COM_SLEEP = 0,
MYSQL_COM_QUIT,
MYSQL_COM_INIT_DB,
@ -259,7 +266,9 @@ typedef enum mysql_server_cmd {
MYSQL_COM_DAEMON,
MYSQL_COM_END /*< Must be the last */
} mysql_server_cmd_t;
#endif
static const mysql_server_cmd_t MYSQL_COM_UNDEFINED = (mysql_server_cmd_t)-1;
/**
* List of server commands, and number of response packets are stored here.

View File

@ -4,7 +4,9 @@ target_link_libraries(binlogrouter maxscale-common)
install(TARGETS binlogrouter DESTINATION ${MAXSCALE_LIBDIR})
add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master.c blr_slave.c blr.c)
target_link_libraries(maxbinlogcheck maxscale-common query_classifier)
# maxbinlogcheck refers to my_uuid_init and my_uuin. They are non-public functions and
# should not be used. They are found only from the embedded lib.
target_link_libraries(maxbinlogcheck maxscale-common query_classifier ${MYSQL_EMBEDDED_LIBRARIES})
install(TARGETS maxbinlogcheck DESTINATION bin)

View File

@ -1,5 +1,7 @@
if(BUILD_TESTS)
add_executable(testbinlogrouter testbinlog.c ../blr.c ../blr_slave.c ../blr_master.c ../blr_file.c ../blr_cache.c)
target_link_libraries(testbinlogrouter maxscale-common query_classifier)
# testbinlogrouter refers to my_uuid_init and my_uuin. They are non-public functions and
# should not be used. They are found only from the embedded lib.
target_link_libraries(testbinlogrouter maxscale-common query_classifier ${MYSQL_EMBEDDED_LIBRARIES})
add_test(TestBinlogRouter ${CMAKE_CURRENT_BINARY_DIR}/testbinlogrouter)
endif()

View File

@ -1,9 +1,9 @@
if(MYSQLCLIENT_FOUND AND BUILD_TESTS)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/test.cmake @ONLY)
add_executable(testschemarouter testschemarouter.c)
target_link_libraries(testschemarouter ${MYSQLCLIENT_LIBRARIES} ssl crypto dl z m rt pthread)
target_link_libraries(testschemarouter ${MARIADB_CONNECTOR_LIB} ssl crypto dl z m rt pthread)
add_executable(testschemarouter2 testschemarouter2.c)
target_link_libraries(testschemarouter2 ${MYSQLCLIENT_LIBRARIES} ssl crypto dl z m rt pthread)
target_link_libraries(testschemarouter2 ${MARIADB_CONNECTOR_LIB} ssl crypto dl z m rt pthread)
add_test(NAME TestSchemaRouter COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/test.cmake)
endif()

View File

@ -1,6 +1,6 @@
if(MYSQLCLIENT_FOUND)
add_executable(testconnect testconnect.c)
message(STATUS "Linking against: ${MYSQLCLIENT_LIBRARIES}")
target_link_libraries(testconnect ${MYSQLCLIENT_LIBRARIES} ssl crypto dl z m rt pthread)
message(STATUS "Linking against: ${MARIADB_CONNECTOR_LIB}")
target_link_libraries(testconnect ${MARIADB_CONNECTOR_LIB} ssl crypto dl z m rt pthread)
add_test(NAME ReadConnRouterAuthTest COMMAND $<TARGET_FILE:testconnect> 10000 ${TEST_HOST} ${MASTER_PORT} ${TEST_HOST} ${TEST_PORT} 1.10)
endif()
endif()