Merge branch '2.3' into 2.4
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
#include "testconnections.h"
|
||||
#include "big_transaction.h"
|
||||
#include "sql_t1.h"
|
||||
|
||||
typedef void * FUNC(void * ptr);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ add_test_executable_ex(NAME mysqlmon_multimaster SOURCE mysqlmon_multimaster.cpp
|
||||
CONFIG mysqlmon_multimaster.cnf VMS repl_backend LABELS mysqlmon BREAKS_REPL)
|
||||
|
||||
# MySQL Monitor with Multi-master configurations (assume_unique_hostnames=OFF)
|
||||
add_test_executable_ex(NAME mysqlmon_multimaster_serverid SOURCE mysqlmon_multimaster.cpp
|
||||
add_test_executable_ex(NAME mysqlmon_multimaster_serverid ORIG_NAME mysqlmon_multimaster
|
||||
CONFIG mysqlmon_multimaster_serverid.cnf VMS repl_backend LABELS mysqlmon BREAKS_REPL)
|
||||
|
||||
# MySQL Monitor Failover Test
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "testconnections.h"
|
||||
#include "sql_t1.h"
|
||||
#include "get_com_select_insert.h"
|
||||
class TestConnections;
|
||||
|
||||
// pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
|
||||
typedef struct
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <mysql.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "sql_t1.h"
|
||||
|
||||
/**
|
||||
* @brief big_transaction Executes big transaction (includes N INSERTs of 10000 rows)
|
||||
* @param conn MYSQL connection handler
|
||||
* @param N Number of INSERTs
|
||||
* @return 0 if success
|
||||
*/
|
||||
int big_transaction(MYSQL* conn, int N);
|
||||
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include "testconnections.h"
|
||||
|
||||
/**
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
||||
*
|
||||
* Change Date: 2024-03-10
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace base
|
||||
{
|
||||
|
||||
/* Environment variable. Usage:
|
||||
* Env user{"USER"};
|
||||
* std::string home = Env{"HOME"};
|
||||
* An environment variable can be empty() but
|
||||
* still is_defined().
|
||||
*/
|
||||
class Env : public std::string
|
||||
{
|
||||
public:
|
||||
Env(const std::string& name) : m_is_defined(false)
|
||||
{
|
||||
if (const char* var = getenv(name.c_str()))
|
||||
{
|
||||
m_is_defined = true;
|
||||
this->assign(var);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_defined() const
|
||||
{
|
||||
return m_is_defined;
|
||||
}
|
||||
private:
|
||||
bool m_is_defined;
|
||||
};
|
||||
} // base
|
||||
@ -1,10 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* @brief execute_cmd Execute shell command
|
||||
* @param cmd Command line
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "testconnections.h"
|
||||
class TestConnections;
|
||||
|
||||
/**
|
||||
* @brief copy_rules Copy rules file for firewall filter to Maxscale machine
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "testconnections.h"
|
||||
class Mariadb_nodes;
|
||||
|
||||
/**
|
||||
* @brief get_global_status_allnodes Reads COM_SELECT and COM_INSERT variables from all nodes and stores into
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "testconnections.h"
|
||||
class TestConnections;
|
||||
|
||||
#define FAILOVER_WAIT_TIME 20
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
class TestConnections;
|
||||
|
||||
int create_tcp_socket();
|
||||
char* get_ip(char* host);
|
||||
char* build_get_query(char* host, const char* page);
|
||||
|
||||
@ -5,11 +5,6 @@
|
||||
#include "mariadb_func.h"
|
||||
#include "mariadb_nodes.h"
|
||||
|
||||
#define DEFAULT_MAXSCALE_CNF "/etc/maxscale.cnf"
|
||||
#define DEFAULT_MAXSCALE_LOG_DIR "/var/log/maxscale/"
|
||||
#define DEFAULT_MAXSCALE_BINLOG_DIR "/var/lib/maxscale/Binlog_Service/"
|
||||
#define DEFAULT_MAXADMIN_PASSWORD "mariadb"
|
||||
|
||||
class Maxscales: public Nodes
|
||||
{
|
||||
public:
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <string>
|
||||
#include "mariadb_func.h"
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <maxbase/ccdefs.hh>
|
||||
#include "mariadb_func.h"
|
||||
|
||||
typedef std::set<std::string> StringSet;
|
||||
|
||||
|
||||
@ -2,10 +2,8 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include "testconnections.h"
|
||||
#include <jansson.h>
|
||||
|
||||
using namespace std;
|
||||
#include "testconnections.h"
|
||||
|
||||
class RDS
|
||||
{
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
#ifndef SQL_CONST_H
|
||||
#define SQL_CONST_H
|
||||
|
||||
const char* create_repl_user =
|
||||
"grant replication slave on *.* to repl@'%%' identified by 'repl'; "
|
||||
"FLUSH PRIVILEGES";
|
||||
const char* setup_slave =
|
||||
"change master to MASTER_HOST='%s', "
|
||||
"MASTER_USER='repl', "
|
||||
"MASTER_PASSWORD='repl', "
|
||||
"MASTER_LOG_FILE='%s', "
|
||||
"MASTER_LOG_POS=%s, "
|
||||
"MASTER_PORT=%d; "
|
||||
"start slave;";
|
||||
|
||||
const char* setup_slave_no_pos =
|
||||
"change master to MASTER_HOST='%s', "
|
||||
"MASTER_USER='repl', "
|
||||
"MASTER_PASSWORD='repl', "
|
||||
"MASTER_LOG_FILE='mar-bin.000001', "
|
||||
"MASTER_LOG_POS=4, "
|
||||
"MASTER_PORT=%d";
|
||||
|
||||
|
||||
#endif // SQL_CONST_H
|
||||
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "mariadb_func.h"
|
||||
#include "testconnections.h"
|
||||
#include <mysql.h>
|
||||
|
||||
/**
|
||||
* @brief execute_select_query_and_check Execute query and check that result contains expected number of rows
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include "testconnections.h"
|
||||
#include "maxadmin_operations.h"
|
||||
#include "sql_t1.h"
|
||||
class TestConnections;
|
||||
|
||||
/**
|
||||
* @brief check_sha1 Check that checksum of binlog files on Maxscale machines and all backends are equal
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
add_library(maxtest SHARED
|
||||
big_load.cc
|
||||
big_transaction.cc
|
||||
blob_test.cc
|
||||
clustrix_nodes.cpp
|
||||
config_operations.cc
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
#include "big_load.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include "testconnections.h"
|
||||
#include "sql_t1.h"
|
||||
#include "get_com_select_insert.h"
|
||||
|
||||
|
||||
void load(long int* new_inserts,
|
||||
long int* new_selects,
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
#include "big_transaction.h"
|
||||
|
||||
int big_transaction(MYSQL* conn, int N)
|
||||
{
|
||||
int local_result = 0;
|
||||
char sql[1000000];
|
||||
local_result += create_t1(conn);
|
||||
local_result += execute_query(conn, (char*) "START TRANSACTION");
|
||||
local_result += execute_query(conn, (char*) "SET autocommit = 0");
|
||||
|
||||
for (int i = 0; i < N; i++)
|
||||
{
|
||||
create_insert_string(sql, 10000, i);
|
||||
local_result += execute_query(conn, "%s", sql);
|
||||
local_result += execute_query(conn, "CREATE TABLE t2(id int);");
|
||||
local_result += execute_query(conn, "%s", sql);
|
||||
local_result += execute_query(conn, "DROP TABLE t2;");
|
||||
local_result += execute_query(conn, "%s", sql);
|
||||
}
|
||||
|
||||
local_result += execute_query(conn, (char*) "COMMIT");
|
||||
return local_result;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
#include "fw_copy_rules.h"
|
||||
#include <sstream>
|
||||
#include "testconnections.h"
|
||||
|
||||
void copy_rules(TestConnections* Test, const char* rules_name, const char* rules_dir)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "testconnections.h"
|
||||
#include "mariadb_nodes.h"
|
||||
|
||||
/**
|
||||
* Reads COM_SELECT and COM_INSERT variables from all nodes and stores into 'selects' and 'inserts'
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "keepalived_func.h"
|
||||
#include "get_my_ip.h"
|
||||
#include "testconnections.h"
|
||||
|
||||
char* print_version_string(TestConnections* Test)
|
||||
{
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
#include "mariadb_nodes.h"
|
||||
#include "sql_const.h"
|
||||
#include <climits>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@ -28,6 +27,27 @@ using std::endl;
|
||||
namespace
|
||||
{
|
||||
static bool g_require_gtid = false;
|
||||
|
||||
const char setup_slave_no_pos[] =
|
||||
"change master to MASTER_HOST='%s', "
|
||||
"MASTER_USER='repl', "
|
||||
"MASTER_PASSWORD='repl', "
|
||||
"MASTER_LOG_FILE='mar-bin.000001', "
|
||||
"MASTER_LOG_POS=4, "
|
||||
"MASTER_PORT=%d";
|
||||
|
||||
const char setup_slave[] =
|
||||
"change master to MASTER_HOST='%s', "
|
||||
"MASTER_USER='repl', "
|
||||
"MASTER_PASSWORD='repl', "
|
||||
"MASTER_LOG_FILE='%s', "
|
||||
"MASTER_LOG_POS=%s, "
|
||||
"MASTER_PORT=%d; "
|
||||
"start slave;";
|
||||
|
||||
const char create_repl_user[] =
|
||||
"grant replication slave on *.* to repl@'%%' identified by 'repl'; "
|
||||
"FLUSH PRIVILEGES";
|
||||
}
|
||||
|
||||
void Mariadb_nodes::require_gtid(bool value)
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
#include "maxscales.hh"
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include "envv.hh"
|
||||
|
||||
#define DEFAULT_MAXSCALE_CNF "/etc/maxscale.cnf"
|
||||
#define DEFAULT_MAXSCALE_LOG_DIR "/var/log/maxscale/"
|
||||
#define DEFAULT_MAXSCALE_BINLOG_DIR "/var/lib/maxscale/Binlog_Service/"
|
||||
#define DEFAULT_MAXADMIN_PASSWORD "mariadb"
|
||||
|
||||
Maxscales::Maxscales(const char *pref,
|
||||
const char *test_cwd,
|
||||
bool verbose,
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#include "sql_t1.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <pthread.h>
|
||||
#include "mariadb_func.h"
|
||||
|
||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static char** sql = NULL;
|
||||
|
||||
@ -87,9 +87,11 @@ endfunction()
|
||||
|
||||
# Same as "add_test_executable" but with a local config template file. Called using named arguments as in
|
||||
# add_test_executable_ex(NAME <testname> SOURCE <source.cc> CONFIG <configfile.cnf> VMS <backends setup>
|
||||
# LABELS <label list>)
|
||||
# LABELS <label list>).
|
||||
#
|
||||
# If creating a derived test, denote the original test with ORIG_NAME.
|
||||
function(add_test_executable_ex)
|
||||
set(arg_names NAME SOURCE CONFIG LIBS VMS LABELS)
|
||||
set(arg_names NAME SOURCE CONFIG LIBS VMS LABELS ORIG_NAME)
|
||||
set(now_parsing "")
|
||||
foreach(elem ${ARGN})
|
||||
list(FIND arg_names ${elem} arg_names_ind)
|
||||
@ -112,6 +114,8 @@ function(add_test_executable_ex)
|
||||
list(APPEND vms_setup ${elem})
|
||||
elseif("${now_parsing}" STREQUAL "LABELS")
|
||||
list(APPEND labels ${elem})
|
||||
elseif("${now_parsing}" STREQUAL "ORIG_NAME")
|
||||
list(APPEND orig_name ${elem})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@ -124,8 +128,30 @@ function(add_test_executable_ex)
|
||||
message(FATAL_ERROR "NAME ${errmsg}")
|
||||
endif()
|
||||
|
||||
list(LENGTH source_file list_len)
|
||||
if (NOT ${list_len} EQUAL 1)
|
||||
# If original name was given, source file should not.
|
||||
list(LENGTH orig_name n_orig_name)
|
||||
list(LENGTH source_file n_source_file)
|
||||
|
||||
if ("${n_orig_name}" GREATER 1)
|
||||
message(FATAL_ERROR "ORIG_NAME has multiple values.")
|
||||
elseif("${n_orig_name}" EQUAL 1)
|
||||
|
||||
if ("${n_source_file}" GREATER 0)
|
||||
message(FATAL_ERROR "Both ORIG_NAME and SOURCE are defined.")
|
||||
endif()
|
||||
|
||||
# Also check link libraries
|
||||
list(LENGTH link_libraries n_link_libraries)
|
||||
if ("${n_link_libraries}" GREATER 0)
|
||||
message(FATAL_ERROR "Both ORIG_NAME and LIBS are defined.")
|
||||
endif()
|
||||
|
||||
get_test_property(${orig_name} TIMEOUT to)
|
||||
if (NOT to)
|
||||
message(FATAL_ERROR "${orig_name} is not an existing test.")
|
||||
endif()
|
||||
|
||||
elseif(NOT ${n_source_file} EQUAL 1)
|
||||
message(FATAL_ERROR "SOURCE ${errmsg}")
|
||||
endif()
|
||||
|
||||
@ -157,12 +183,15 @@ function(add_test_executable_ex)
|
||||
|
||||
set(config_file_path "${CMAKE_CURRENT_SOURCE_DIR}/${config_file}")
|
||||
add_test_info(${name} ${config_file_path} "${vms_upper}")
|
||||
add_executable(${name} ${source_file})
|
||||
|
||||
if ("${n_source_file}" EQUAL 1)
|
||||
add_executable(${name} ${source_file})
|
||||
list(APPEND link_libraries maxtest)
|
||||
target_link_libraries(${name} ${link_libraries})
|
||||
|
||||
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
else()
|
||||
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${orig_name} ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
list(APPEND ctest_labels ${vms_upper} ${labels})
|
||||
add_test_properties(${name} ${ctest_labels})
|
||||
|
||||
Reference in New Issue
Block a user