MXS-2900 maxtest header cleanup
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "testconnections.h"
|
#include "testconnections.h"
|
||||||
#include "big_transaction.h"
|
#include "sql_t1.h"
|
||||||
|
|
||||||
typedef void * FUNC(void * ptr);
|
typedef void * FUNC(void * ptr);
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "testconnections.h"
|
class TestConnections;
|
||||||
#include "sql_t1.h"
|
|
||||||
#include "get_com_select_insert.h"
|
|
||||||
|
|
||||||
// pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
|
// pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
|
||||||
typedef struct
|
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
|
#pragma once
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include "testconnections.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
|
#pragma once
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief execute_cmd Execute shell command
|
* @brief execute_cmd Execute shell command
|
||||||
* @param cmd Command line
|
* @param cmd Command line
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "testconnections.h"
|
class TestConnections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief copy_rules Copy rules file for firewall filter to Maxscale machine
|
* @brief copy_rules Copy rules file for firewall filter to Maxscale machine
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#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
|
* @brief get_global_status_allnodes Reads COM_SELECT and COM_INSERT variables from all nodes and stores into
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "testconnections.h"
|
class TestConnections;
|
||||||
|
|
||||||
#define FAILOVER_WAIT_TIME 20
|
#define FAILOVER_WAIT_TIME 20
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
class TestConnections;
|
||||||
|
|
||||||
int create_tcp_socket();
|
int create_tcp_socket();
|
||||||
char* get_ip(char* host);
|
char* get_ip(char* host);
|
||||||
char* build_get_query(char* host, const char* page);
|
char* build_get_query(char* host, const char* page);
|
||||||
|
@ -5,11 +5,6 @@
|
|||||||
#include "mariadb_func.h"
|
#include "mariadb_func.h"
|
||||||
#include "mariadb_nodes.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
|
class Maxscales: public Nodes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "mariadb_func.h"
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <maxbase/ccdefs.hh>
|
#include <maxbase/ccdefs.hh>
|
||||||
|
#include "mariadb_func.h"
|
||||||
|
|
||||||
typedef std::set<std::string> StringSet;
|
typedef std::set<std::string> StringSet;
|
||||||
|
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "testconnections.h"
|
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
#include "testconnections.h"
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
class RDS
|
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
|
#pragma once
|
||||||
|
|
||||||
#include "mariadb_func.h"
|
#include <mysql.h>
|
||||||
#include "testconnections.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief execute_select_query_and_check Execute query and check that result contains expected number of rows
|
* @brief execute_select_query_and_check Execute query and check that result contains expected number of rows
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <iostream>
|
class TestConnections;
|
||||||
#include "testconnections.h"
|
|
||||||
#include "maxadmin_operations.h"
|
|
||||||
#include "sql_t1.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief check_sha1 Check that checksum of binlog files on Maxscale machines and all backends are equal
|
* @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
|
add_library(maxtest SHARED
|
||||||
big_load.cc
|
big_load.cc
|
||||||
big_transaction.cc
|
|
||||||
blob_test.cc
|
blob_test.cc
|
||||||
config_operations.cc
|
config_operations.cc
|
||||||
different_size.cc
|
different_size.cc
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
#include "big_load.h"
|
#include "big_load.h"
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "testconnections.h"
|
||||||
|
#include "sql_t1.h"
|
||||||
|
#include "get_com_select_insert.h"
|
||||||
|
|
||||||
|
|
||||||
void load(long int* new_inserts,
|
void load(long int* new_inserts,
|
||||||
long int* new_selects,
|
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 "fw_copy_rules.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include "testconnections.h"
|
||||||
|
|
||||||
void copy_rules(TestConnections* Test, const char* rules_name, const char* rules_dir)
|
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'
|
* 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 "keepalived_func.h"
|
||||||
#include "get_my_ip.h"
|
#include "get_my_ip.h"
|
||||||
|
#include "testconnections.h"
|
||||||
|
|
||||||
char* print_version_string(TestConnections* Test)
|
char* print_version_string(TestConnections* Test)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mariadb_nodes.h"
|
#include "mariadb_nodes.h"
|
||||||
#include "sql_const.h"
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -28,6 +27,27 @@ using std::endl;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
static bool g_require_gtid = false;
|
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)
|
void Mariadb_nodes::require_gtid(bool value)
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
#include "maxscales.hh"
|
#include "maxscales.hh"
|
||||||
#include <sstream>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "envv.hh"
|
#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,
|
Maxscales::Maxscales(const char *pref, const char *test_cwd, bool verbose,
|
||||||
std::string network_config)
|
std::string network_config)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "sql_t1.h"
|
#include "sql_t1.h"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "mariadb_func.h"
|
||||||
|
|
||||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static char** sql = NULL;
|
static char** sql = NULL;
|
||||||
|
Reference in New Issue
Block a user