Merge branch '2.2' into develop

This commit is contained in:
Markus Mäkelä
2018-06-06 08:56:31 +03:00
26 changed files with 140 additions and 57 deletions

View File

@ -28,6 +28,7 @@
the master. There is also limited capability for rejoining nodes.
For more details, please refer to:
* [MariaDB MaxScale 2.2.9 Release Notes](Release-Notes/MaxScale-2.2.9-Release-Notes.md)
* [MariaDB MaxScale 2.2.8 Release Notes](Release-Notes/MaxScale-2.2.8-Release-Notes.md)
* [MariaDB MaxScale 2.2.7 Release Notes](Release-Notes/MaxScale-2.2.7-Release-Notes.md)
* [MariaDB MaxScale 2.2.6 Release Notes](Release-Notes/MaxScale-2.2.6-Release-Notes.md)

View File

@ -0,0 +1,40 @@
# MariaDB MaxScale 2.2.9 Release Notes -- 2018-06
Release 2.2.9 is a GA release.
This document describes the changes in release 2.2.9, when compared to
release 2.2.7 (2.2.8 was not officially released).
For any problems you encounter, please consider submitting a bug
report at [Jira](https://jira.mariadb.org).
## Bug fixes
### 2.2.9
* [MXS-1899](https://jira.mariadb.org/browse/MXS-1899) generated [maxscale] section causes errors
* [MXS-1896](https://jira.mariadb.org/browse/MXS-1896) LOAD DATA INFILE is mistaken for LOAD DATA LOCAL INFILE
* [MXS-1743](https://jira.mariadb.org/browse/MXS-1743) Maxscale unable to enforce round-robin between read service for Slave
### 2.2.8
* [MXS-1889](https://jira.mariadb.org/browse/MXS-1889) A single remaining master is valid for readconnroute configured with 'router_options=slave'
* [MXS-1740](https://jira.mariadb.org/browse/MXS-1740) Hintfilter leaks memory
## Known Issues and Limitations
There are some limitations and known issues within this version of MaxScale.
For more information, please refer to the [Limitations](../About/Limitations.md) document.
## Packaging
RPM and Debian packages are provided for the Linux distributions supported
by MariaDB Enterprise.
Packages can be downloaded [here](https://mariadb.com/downloads/mariadb-tx/maxscale).
## Source Code
The source code of MaxScale is tagged at GitHub with a tag, which is identical
with the version of MaxScale. For instance, the tag of version X.Y.Z of MaxScale
is X.Y.Z. Further, *master* always refers to the latest released non-beta version.
The source code is available [here](https://github.com/mariadb-corporation/MaxScale).

View File

@ -177,6 +177,7 @@ extern const char CN_STRIP_DB_ESC[];
extern const char CN_SUBSTITUTE_VARIABLES[];
extern const char CN_THREADS[];
extern const char CN_THREAD_STACK_SIZE[];
extern const char CN_TICKS[];
extern const char CN_TYPE[];
extern const char CN_UNIX[];
extern const char CN_USER[];

View File

@ -266,6 +266,7 @@ struct mxs_monitor
uint8_t journal_hash[SHA_DIGEST_LENGTH]; /**< SHA1 hash of the latest written journal */
MxsDiskSpaceThreshold* disk_space_threshold; /**< Disk space thresholds */
int64_t disk_space_check_interval; /**< How often should a disk space check be made at most. */
uint64_t ticks; /**< Number of performed monitoring intervals */
struct mxs_monitor *next; /**< Next monitor in the linked list */
};

View File

@ -705,6 +705,9 @@ add_test_executable(mxs1808_long_data.cpp mxs1808_long_data replication LABELS r
# https://jira.mariadb.org/browse/MXS-1824
add_test_executable(mxs1824_double_cursor.cpp mxs1824_double_cursor replication LABELS readwritesplit REPL_BACKEND)
# TODO: Remove this once the problem with the connector is resolved
set_tests_properties(mxs1824_double_cursor PROPERTIES WILL_FAIL TRUE)
# MXS-1828: Multiple LOAD DATA LOCAL INFILE commands in one query cause a hang
# https://jira.mariadb.org/browse/MXS-1828
add_test_executable(mxs1828_double_local_infile.cpp mxs1828_double_local_infile replication LABELS readwritesplit REPL_BACKEND)
@ -721,6 +724,10 @@ add_test_executable(mxs1873_large_sescmd.cpp mxs1873_large_sescmd replication LA
# https://jira.mariadb.org/browse/MXS-1896
add_test_executable(mxs1896_load_data_infile.cpp mxs1896_load_data_infile replication LABELS readwritesplit REPL_BACKEND)
# MXS-1899: generated [maxscale] section causes errors
# https://jira.mariadb.org/browse/MXS-1899
add_test_executable(mxs1899_generated_cnf.cpp mxs1899_generated_cnf replication LABELS REPL_BACKEND)
# 'namedserverfilter' test
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)

View File

@ -0,0 +1,18 @@
/**
* MXS-1889: generated [maxscale] section causes errors
*
* https://jira.mariadb.org/browse/MXS-1899
*/
#include "testconnections.h"
int main(int argc, char** argv)
{
TestConnections test(argc, argv);
test.maxscales->ssh_node_f(0, true, "maxctrl alter maxscale auth_connect_timeout 10");
test.assert(test.maxscales->restart() == 0, "Restarting MaxScale after modification "
"of global parameters should work");
return test.global_result;
}

View File

@ -60,7 +60,7 @@ int main(int argc, char** argv)
test.repl->block_node(1);
test.repl->block_node(2);
test.repl->block_node(3);
sleep(5);
sleep(10);
test.tprintf("Checking that master has stale status");
check_master(test);
@ -78,7 +78,7 @@ int main(int argc, char** argv)
test.repl->unblock_node(1);
test.repl->unblock_node(2);
test.repl->unblock_node(3);
sleep(5);
sleep(10);
test.tprintf("Checking that node 0 is the master and slaves are OK");
check_master(test);
@ -86,7 +86,7 @@ int main(int argc, char** argv)
test.tprintf("Blocking master to trigger stale slave status");
test.repl->block_node(0);
sleep(5);
sleep(10);
test.tprintf("Checking that slaves have stale status");
check_slave(test);
@ -102,7 +102,7 @@ int main(int argc, char** argv)
check_slave(test);
test.repl->unblock_node(0);
sleep(5);
sleep(10);
test.tprintf("Checking that node 0 is the master and slaves are OK");
check_master(test);

View File

@ -63,10 +63,10 @@ void restore_servers(TestConnections& test, bool events_added)
replicate_from(test, 0, 3);
replicate_from(test, 1, 3);
replicate_from(test, 2, 3);
sleep(3);
sleep(10);
o1 = test.maxscales->ssh_node_output(0,
"maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy);
sleep(2);
sleep(10);
int master_id = get_master_server_id(test);
test.assert(master_id == 1, "Switchover failed to set server1 as master.");
}
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
test.try_query(test.repl->nodes[3], "STOP SLAVE;RESET SLAVE ALL;");
test.tprintf(" Wait for the monitor to detect it ");
sleep(8);
sleep(10);
test.tprintf(" Connect and insert should work ");
get_output(test);
@ -123,7 +123,6 @@ int main(int argc, char *argv[])
test.maxscales->connect_maxscale(0);
test.try_query(test.maxscales->conn_rwsplit[0], "INSERT INTO test.t1 VALUES (1)");
test.maxscales->close_maxscale_connections(0);
sleep(1);
test.repl->connect(3);
char result_tmp[bufsize];
if (find_field(test.repl->nodes[3], GTID_QUERY, GTID_FIELD, result_tmp) == 0)
@ -137,7 +136,7 @@ int main(int argc, char *argv[])
test.repl->unblock_node(2);
test.tprintf(" Wait for the monitor to detect it ");
sleep(8);
sleep(10);
test.tprintf("Check that we are still using the last node to which we failed over "
"to and that the old nodes are in maintenance mode");

View File

@ -60,7 +60,7 @@ int main(int argc, char** argv)
test.tprintf("Start by having the current master replicate from the external server");
test.repl->connect();
test.repl->replicate_from(0, 3);
sleep(5);
sleep(10);
check_status(test, "server1", master_running, "server1 should be the master");
check_status(test, "server2", slave_running, "server2 should be a slave");
check_status(test, "server3", slave_running, "server3 should be a slave");

View File

@ -35,7 +35,7 @@ int main(int argc, char** argv)
sleep(3);
test.maxscales->ssh_node_output(0, FAILOVER_CMD , true, &ec);
sleep(5);
sleep(10);
check_test_1(test, node0_id);
if (test.global_result != 0)
@ -48,7 +48,7 @@ int main(int argc, char** argv)
sleep(3);
test.maxscales->ssh_node_output(0, FAILOVER_CMD, true, &ec);
sleep(5);
sleep(10);
check_test_2(test);
if (test.global_result != 0)
@ -61,7 +61,7 @@ int main(int argc, char** argv)
sleep(3);
test.maxscales->ssh_node_output(0, FAILOVER_CMD, true, &ec);
sleep(5);
sleep(10);
check_test_3(test);
return test.global_result;

View File

@ -122,7 +122,7 @@ void insert_data(TestConnections& test)
void run(TestConnections& test)
{
sleep(5);
sleep(10);
cout << "\nConnecting to MaxScale." << endl;
x::connect_maxscale(test);
@ -162,7 +162,7 @@ void run(TestConnections& test)
cout << "\nClosing connection to MaxScale." << endl;
test.maxscales->close_maxscale_connections(0);
sleep(5);
sleep(10);
cout << "\nConnecting to MaxScale." << endl;
x::connect_maxscale(test);

View File

@ -44,7 +44,7 @@ int main(int argc, char** argv)
test.try_query(nodes[3], CHANGE_CMD);
test.try_query(nodes[3], "START SLAVE;");
sleep(4);
sleep(10);
get_output(test);
test.tprintf(LINE);
@ -56,7 +56,6 @@ int main(int argc, char** argv)
test.assert(master_id == -1, "Master was promoted even when no slave was eligible.");
test.repl->unblock_node(0);
sleep(1);
// Restore normal settings.
test.try_query(nodes[1], "START SLAVE;");

View File

@ -122,7 +122,7 @@ void expect(TestConnections& test, const char* zServer, const char* zState1, con
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -147,7 +147,7 @@ void run(TestConnections& test)
cout << "\nStopping slave " << N - 1 << endl;
test.repl->stop_node(N - 1);
sleep(8);
sleep(10);
// server4 was stopped, so we expect the state of it to be /Down/,
// and the states of the other ones not to have changed.
@ -171,7 +171,7 @@ void run(TestConnections& test)
cout << "\nStopping master." << endl;
test.repl->stop_node(0);
sleep(8);
sleep(10);
// server1 (previous master) was taken down, so its state should be /Down/.
// server2 should have been made into master, and server4 should still be down.
@ -183,7 +183,7 @@ void run(TestConnections& test)
cout << "\nBringing up slave " << N - 1 << endl;
test.repl->start_node(N - 1, (char*)"");
sleep(8);
sleep(10);
// server1 should still be down, server2 still master, and server3 still
// a slave. server4 was brought up, so it should have been rejoined and

View File

@ -204,7 +204,7 @@ void stop_node(XTestConnections& test, int index)
void run(XTestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -236,7 +236,7 @@ void run(XTestConnections& test)
cout << "\nClosing connection to MaxScale." << endl;
test.maxscales->close_maxscale_connections(0);
sleep(5);
sleep(10);
list_servers(test);

View File

@ -157,7 +157,7 @@ void check_server_status(TestConnections& test, int N, int down = -1)
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -183,14 +183,14 @@ void run(TestConnections& test)
cout << "\nStopping slave " << slave << endl;
test.repl->stop_node(i);
sleep(5);
sleep(10);
check_server_status(test, N, i);
cout << "\nStarting slave " << slave << endl;
test.repl->start_node(i, (char*)"");
sleep(5);
sleep(10);
check_server_status(test, N);
}

View File

@ -98,7 +98,7 @@ int main(int argc, char** argv)
test.assert(false, "Could not start MaxScale.");
return test.global_result;
}
sleep(5);
sleep(10);
get_output(test);
StringSet node2_states = test.get_server_status("server3");
@ -119,7 +119,7 @@ int main(int argc, char** argv)
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
mysql_query(nodes[0], cmd);
mysql_query(nodes[0], "START SLAVE;");
sleep(5);
sleep(10);
get_output(test);
int master_id = get_master_server_id(test);
test.assert(master_id == 4, "Server 4 should be the cluster master.");
@ -132,7 +132,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0,
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
sleep(1);
sleep(10);
master_id = get_master_server_id(test);
test.assert(master_id == 1, "Server 1 should be the cluster master.");
get_output(test);

View File

@ -88,7 +88,7 @@ int main(int argc, char** argv)
cout << "Stopping master, should auto-failover." << endl;
int master_id_old = get_master_server_id(test);
test.repl->stop_node(0);
sleep(5);
sleep(10);
get_output(test);
int master_id_new = get_master_server_id(test);
cout << "Master server id is " << master_id_new << endl;
@ -118,7 +118,7 @@ int main(int argc, char** argv)
test.assert(false, "Could not start MaxScale.");
return test.global_result;
}
sleep(5);
sleep(10);
get_output(test);
expect(test, "server1", "Running");
@ -139,7 +139,7 @@ int main(int argc, char** argv)
MYSQL** nodes = test.repl->nodes;
mysql_query(nodes[ind], cmd);
mysql_query(nodes[ind], "START SLAVE;");
sleep(5);
sleep(10);
get_output(test);
expect(test, "server1", "Running");

View File

@ -81,7 +81,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0, "maxadmin call command mysqlmon switchover "
"MySQL-Monitor server1 server2" , true, &ec);
sleep(5); // Wait for monitor to update status
sleep(10); // Wait for monitor to update status
get_output(test);
master_id = get_master_server_id(test);
test.assert(master_id == old_master_id, "Switchover back to server1 failed.");

View File

@ -32,7 +32,6 @@ int main(int argc, char** argv)
char result_tmp[bufsize];
// Advance gtid:s a bit to so gtid variables are updated.
generate_traffic_and_check(test, maxconn, 10);
sleep(1);
test.tprintf(LINE);
print_gtids(test);
get_input();
@ -55,7 +54,6 @@ int main(int argc, char** argv)
{
cout << "Sending more inserts." << endl;
generate_traffic_and_check(test, maxconn, 5);
sleep(1);
if (find_field(maxconn, GTID_QUERY, GTID_FIELD, result_tmp) == 0)
{
gtid_final = result_tmp;
@ -63,13 +61,13 @@ int main(int argc, char** argv)
print_gtids(test);
cout << "Bringing old master back online..." << endl;
test.repl->start_node(master_index, (char*) "");
sleep(5);
sleep(10);
test.repl->connect();
get_output(test);
test.tprintf("and manually rejoining it to cluster.");
const char REJOIN_CMD[] = "maxadmin call command mariadbmon rejoin MySQL-Monitor server1";
test.maxscales->ssh_node_output(0, REJOIN_CMD , true, &ec);
sleep(2);
sleep(10);
get_output(test);
string gtid_old_master;
@ -85,7 +83,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0, "maxadmin call command mysqlmon switchover "
"MySQL-Monitor server1 server2" , true, &ec);
sleep(5); // Wait for monitor to update status
sleep(10); // Wait for monitor to update status
get_output(test);
master_id = get_master_server_id(test);
test.assert(master_id == old_master_id, "Switchover back to server1 failed.");

View File

@ -94,7 +94,7 @@ int main(int argc, char** argv)
string rejoin_s4 = REJOIN_CMD + " server4";
test.maxscales->ssh_node_output(0, rejoin_s3.c_str() , true, &ec);
test.maxscales->ssh_node_output(0, rejoin_s4.c_str() , true, &ec);
sleep(5);
sleep(10);
get_output(test);
StringSet node2_states = test.get_server_status("server3");
@ -115,11 +115,11 @@ int main(int argc, char** argv)
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
mysql_query(nodes[0], cmd);
mysql_query(nodes[0], "START SLAVE;");
sleep(5);
sleep(10);
string rejoin_s2 = REJOIN_CMD + " server2";
test.maxscales->ssh_node_output(0, rejoin_s2.c_str() , true, &ec);
test.maxscales->ssh_node_output(0, rejoin_s3.c_str() , true, &ec);
sleep(2);
sleep(10);
get_output(test);
int master_id = get_master_server_id(test);
test.assert(master_id == 4, "Server 4 should be the cluster master.");
@ -132,7 +132,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0,
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
sleep(1);
sleep(10);
master_id = get_master_server_id(test);
test.assert(master_id == 1, "Server 1 should be the cluster master.");
get_output(test);

View File

@ -122,7 +122,7 @@ void expect(TestConnections& test, const char* zServer, const char* zState1, con
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -149,7 +149,7 @@ void run(TestConnections& test)
zCommand = "call command mysqlmon switchover MySQL-Monitor server2 server1";
test.maxscales->execute_maxadmin_command_print(0, (char*)zCommand);
sleep(5);
sleep(10);
expect(test, "server1", "Slave", "Running");
expect(test, "server2", "Master", "Running");
@ -162,7 +162,7 @@ void run(TestConnections& test)
zCommand = "call command mysqlmon switchover MySQL-Monitor server1 server2";
test.maxscales->execute_maxadmin_command_print(0, (char*)zCommand);
sleep(5);
sleep(10);
expect(test, "server1", "Master", "Running");
expect(test, "server2", "Slave", "Running");

View File

@ -122,7 +122,7 @@ void expect(TestConnections& test, const char* zServer, const char* zState1, con
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -147,7 +147,7 @@ void run(TestConnections& test)
cout << "\nStopping slave " << N - 1 << endl;
test.repl->stop_node(N - 1);
sleep(8);
sleep(10);
// server4 was stopped, so we expect the state of it to be /Down/,
// and the states of the other ones not to have changed.
@ -171,7 +171,7 @@ void run(TestConnections& test)
cout << "\nStopping master." << endl;
test.repl->stop_node(0);
sleep(8);
sleep(10);
// server1 (previous master) was taken down, so its state should be /Down/.
// server2 should have been made into master, and server4 should still be down.
@ -183,7 +183,7 @@ void run(TestConnections& test)
cout << "\nBringing up slave " << N - 1 << endl;
test.repl->start_node(N - 1, (char*)"");
sleep(8);
sleep(10);
// server1 should still be down, server2 still master, and server3 still
// a slave. server4 was brought up, but as auto_rejoin is false, it should
@ -198,7 +198,7 @@ void run(TestConnections& test)
const char* zCommand = "call command mysqlmon switchover MySQL-Monitor server4 server2";
test.maxscales->execute_maxadmin_command_print(0, (char*)zCommand);
sleep(8);
sleep(10);
// The state should not change, as server4 is not good enough as master.
expect(test, "server1", "Down");

View File

@ -151,6 +151,7 @@ const char CN_STRIP_DB_ESC[] = "strip_db_esc";
const char CN_SUBSTITUTE_VARIABLES[] = "substitute_variables";
const char CN_THREADS[] = "threads";
const char CN_THREAD_STACK_SIZE[] = "thread_stack_size";
const char CN_TICKS[] = "ticks";
const char CN_TYPE[] = "type";
const char CN_UNIX[] = "unix";
const char CN_USER[] = "user";

View File

@ -626,14 +626,20 @@ int ntfw_cb(const char* filename,
int fileflags,
struct FTW* pfwt)
{
int rc = remove(filename);
int rc = 0;
int datadir_len = strlen(get_datadir());
std::string filename_string(filename + datadir_len);
if (rc != 0)
if (strncmp(filename_string.c_str(), "/data", 5) == 0)
{
int eno = errno;
errno = 0;
MXS_ERROR("Failed to remove the data directory %s of MaxScale due to %d, %s.",
datadir, eno, mxs_strerror(eno));
rc = remove(filename);
if (rc != 0)
{
int eno = errno;
errno = 0;
MXS_ERROR("Failed to remove the data directory %s of MaxScale due to %d, %s.",
filename_string.c_str(), eno, mxs_strerror(eno));
}
}
return rc;
}
@ -657,6 +663,13 @@ void cleanup_process_datadir()
}
}
void cleanup_old_process_datadirs()
{
int depth = 1;
int flags = FTW_CHDIR | FTW_DEPTH | FTW_MOUNT;
nftw(get_datadir(), ntfw_cb, depth, flags);
}
static void write_footer(void)
{
file_write_footer(stdout);
@ -1981,7 +1994,7 @@ int main(int argc, char **argv)
#ifdef SS_DEBUG
MXS_NOTICE("Commit: %s", MAXSCALE_COMMIT);
#endif
cleanup_old_process_datadirs();
if (!cnf->config_check)
{
/*

View File

@ -137,6 +137,7 @@ MXS_MONITOR* monitor_create(const char *name, const char *module)
mon->script_timeout = DEFAULT_SCRIPT_TIMEOUT;
mon->parameters = NULL;
mon->check_maintenance_flag = MAINTENANCE_FLAG_NOCHECK;
mon->ticks = 0;
memset(mon->journal_hash, 0, sizeof(mon->journal_hash));
mon->disk_space_threshold = NULL;
mon->disk_space_check_interval = 0;
@ -543,6 +544,7 @@ monitor_show(DCB *dcb, MXS_MONITOR *monitor)
dcb_printf(dcb, "Monitor: %p\n", monitor);
dcb_printf(dcb, "Name: %s\n", monitor->name);
dcb_printf(dcb, "State: %s\n", state);
dcb_printf(dcb, "Times monitored: %lu\n", monitor->ticks);
dcb_printf(dcb, "Sampling interval: %lu milliseconds\n", monitor->interval);
dcb_printf(dcb, "Connect Timeout: %i seconds\n", monitor->connect_timeout);
dcb_printf(dcb, "Read Timeout: %i seconds\n", monitor->read_timeout);
@ -1852,6 +1854,7 @@ json_t* monitor_json_data(const MXS_MONITOR* monitor, const char* host)
json_object_set_new(attr, CN_MODULE, json_string(monitor->module_name));
json_object_set_new(attr, CN_STATE, json_string(monitor_state_to_string(monitor->state)));
json_object_set_new(attr, CN_TICKS, json_integer(monitor->ticks));
/** Monitor parameters */
json_object_set_new(attr, CN_PARAMETERS, monitor_parameters_to_json(monitor));
@ -2732,6 +2735,7 @@ void MonitorInstance::tick()
}
flush_server_status();
atomic_add_uint64(&m_monitor->ticks, 1);
}
void MonitorInstance::main()

View File

@ -304,6 +304,7 @@ void MariaDBMonitor::main()
while (!should_shutdown())
{
atomic_add_uint64(&m_monitor->ticks, 1);
timespec loop_start;
/* Coarse time has resolution ~1ms (as opposed to 1ns) but this is enough. */
clock_gettime(CLOCK_MONOTONIC_COARSE, &loop_start);