Merge branch '2.2' into develop
This commit is contained in:
commit
bb8245d2c1
@ -3,6 +3,10 @@ if (AVRO_FOUND AND JANSSON_FOUND)
|
||||
add_library(maxavro maxavro.c maxavro_schema.c maxavro_record.c maxavro_file.c)
|
||||
target_link_libraries(maxavro maxscale-common ${JANSSON_LIBRARIES})
|
||||
|
||||
if(WITH_ASAN AND ASAN_FOUND)
|
||||
target_link_libraries(maxavro ${ASAN_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_executable(maxavrocheck maxavrocheck.c)
|
||||
target_link_libraries(maxavrocheck maxavro maxscale-common)
|
||||
install_executable(maxavrocheck core)
|
||||
|
@ -43,8 +43,13 @@ int main(int argc, char** argv)
|
||||
execute_query_silent(test.repl->nodes[0], "DROP USER IF EXISTS 'mxs1743'@'%'");
|
||||
test.try_query(test.repl->nodes[0], "%s", "CREATE USER 'mxs1743'@'%' IDENTIFIED BY 'mxs1743'");
|
||||
test.try_query(test.repl->nodes[0], "%s", "GRANT ALL ON *.* TO 'mxs1743'@'%'");
|
||||
|
||||
test.tprintf("Syncing slaves");
|
||||
test.set_timeout(60);
|
||||
test.repl->sync_slaves();
|
||||
|
||||
test.tprintf("Opening new connections to verify readconnroute works");
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
// Open a connection and make sure it works
|
||||
@ -62,6 +67,7 @@ int main(int argc, char** argv)
|
||||
// Give the connections a few seconds to establish
|
||||
sleep(5);
|
||||
|
||||
test.tprintf("Checking the number of connections");
|
||||
std::string query =
|
||||
"SELECT COUNT(*) AS connections FROM information_schema.processlist WHERE user = 'mxs1743'";
|
||||
char master_connections[1024];
|
||||
|
@ -4,72 +4,47 @@
|
||||
* - check SELECT from backend
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include "testconnections.h"
|
||||
#include <iconv.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void check_val(MYSQL* conn, TestConnections* Test)
|
||||
void check_val(MYSQL* conn, TestConnections& test)
|
||||
{
|
||||
char val[256];
|
||||
Test->set_timeout(20);
|
||||
char val[256] = "<failed to read value>";
|
||||
test.set_timeout(30);
|
||||
find_field(conn, "SELECT * FROM t2", "x", val);
|
||||
|
||||
Test->tprintf("result: %s\n", val);
|
||||
|
||||
if (strcmp("Кот", val) != 0)
|
||||
{
|
||||
Test->add_result(1, "Wrong SELECT result: %s\n", val);
|
||||
}
|
||||
test.tprintf("result: %s\n", val);
|
||||
test.add_result(strcmp("Кот", val) != 0, "Wrong SELECT result: %s\n", val);
|
||||
test.stop_timeout();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections* Test = new TestConnections(argc, argv);
|
||||
Test->set_timeout(30);
|
||||
TestConnections test(argc, argv);
|
||||
Mariadb_nodes* nodes = strstr(test.test_name, "galera") ? test.galera : test.repl;
|
||||
|
||||
Mariadb_nodes* nodes;
|
||||
if (strstr(Test->test_name, "galera") != NULL)
|
||||
test.set_timeout(60);
|
||||
|
||||
test.maxscales->connect();
|
||||
|
||||
auto conn = test.maxscales->conn_rwsplit[0];
|
||||
execute_query_silent(conn, "DROP TABLE t2;");
|
||||
test.try_query(conn, "CREATE TABLE t2 (x varchar(10));");
|
||||
test.try_query(conn, "INSERT INTO t2 VALUES (\"Кот\");");
|
||||
|
||||
test.maxscales->disconnect();
|
||||
|
||||
test.stop_timeout();
|
||||
test.repl->connect();
|
||||
test.repl->sync_slaves();
|
||||
|
||||
test.set_timeout(60);
|
||||
check_val(test.maxscales->conn_rwsplit[0], test);
|
||||
check_val(test.maxscales->conn_master[0], test);
|
||||
check_val(test.maxscales->conn_slave[0], test);
|
||||
|
||||
for (int i = 0; i < test.repl->N; i++)
|
||||
{
|
||||
nodes = Test->galera;
|
||||
Test->tprintf("Galera!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes = Test->repl;
|
||||
check_val(nodes->nodes[i], test);
|
||||
}
|
||||
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
Test->set_timeout(30);
|
||||
nodes->connect();
|
||||
|
||||
Test->set_timeout(30);
|
||||
MYSQL* conn = Test->maxscales->conn_rwsplit[0];
|
||||
|
||||
execute_query_silent(conn, (char*) "DROP TABLE t2;");
|
||||
Test->try_query(conn, (char*) "CREATE TABLE t2 (x varchar(10));");
|
||||
char sql[256];
|
||||
sprintf(sql, "INSERT INTO t2 VALUES (\"Кот\");");
|
||||
Test->try_query(conn, "%s", sql);
|
||||
Test->stop_timeout();
|
||||
sleep(5);
|
||||
|
||||
Test->set_timeout(30);
|
||||
check_val(Test->maxscales->conn_rwsplit[0], Test);
|
||||
check_val(Test->maxscales->conn_master[0], Test);
|
||||
check_val(Test->maxscales->conn_slave[0], Test);
|
||||
|
||||
for (int i = 0; i < Test->repl->N; i++)
|
||||
{
|
||||
Test->tprintf("Node %d\n", i);
|
||||
check_val(nodes->nodes[i], Test);
|
||||
}
|
||||
Test->stop_timeout();
|
||||
|
||||
Test->check_maxscale_alive(0);
|
||||
int rval = Test->global_result;
|
||||
delete Test;
|
||||
return rval;
|
||||
return test.global_result;
|
||||
}
|
||||
|
@ -48,12 +48,6 @@ add_library(maxscale-common SHARED
|
||||
utils.cc
|
||||
)
|
||||
|
||||
if(WITH_JEMALLOC)
|
||||
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})
|
||||
elseif(WITH_TCMALLOC)
|
||||
target_link_libraries(maxscale-common ${TCMALLOC_LIBRARIES})
|
||||
endif()
|
||||
|
||||
target_link_libraries(maxscale-common
|
||||
maxbase
|
||||
${MARIADB_CONNECTOR_LIBRARIES}
|
||||
@ -76,6 +70,10 @@ target_link_libraries(maxscale-common
|
||||
${CURL_LIBRARIES}
|
||||
)
|
||||
|
||||
if(WITH_ASAN AND ASAN_FOUND)
|
||||
target_link_libraries(maxscale-common ${ASAN_LIBRARIES})
|
||||
endif()
|
||||
|
||||
find_library(HAVE_LIBDL NAMES dl)
|
||||
if (HAVE_LIBDL)
|
||||
# libdl just exposes libc functionality on most systems. This means that if
|
||||
|
Loading…
x
Reference in New Issue
Block a user