Merge branch '2.2' into develop

This commit is contained in:
Markus Mäkelä
2018-04-03 11:01:06 +03:00
17 changed files with 180 additions and 65 deletions

View File

@ -83,4 +83,3 @@ export target="2.1-2018Jan10"
cd BUILD/mdbci
./build.sh
```

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyies repo from ${unsorted_repo_dir}/$target/$box to
# Copyes repo from ${unsorted_repo_dir}/$target/$box to
dir=`pwd`
if [ "$box_type" == "RPM" ] ; then

View File

@ -92,19 +92,25 @@ else
maxscale_start_cmd="sudo ./maxscale_start.sh 2> /dev/null &"
fi
ssh $sshopt "sudo cp $cnf_file /etc/maxscale.cnf"
ssh $sshopt "$maxscale_start_cmd" &
pid_to_kill=$!
sleep 10
for i in {1..10}
do
sleep 5
ssh $sshopt $maxadmin_command
if [ $? != 0 ] ; then
maxadm_exit=$?
if [ $maxadm_exit == 0 ] ; then
break
fi
done
if [ $maxadm_exit != 0 ] ; then
echo "Maxadmin executing error"
res=1
fi
maxadmin_out=`ssh $sshopt $maxadmin_command`
echo $maxadmin_out | grep "CLI"
if [ $? != 0 ] ; then

View File

@ -731,11 +731,16 @@ users_refresh_time=120
How many statements MaxScale should store for each session. This is for
debugging purposes, as in case of problems it is often of value to be able
to find out exactly what statements were sent before a particular
problem turned up. See also `dump_last_statements` using which the actual
dumping of the statements is enabled.
problem turned up.
**Note:** See also `dump_last_statements` using which the actual dumping
of the statements is enabled. Unless both of the parameters are defined,
the statement dumping mechanism doesn't work.
```
retain_last_statements=20
```
Default is `0`.
#### `dump_last_statements`

View File

@ -158,7 +158,7 @@ public:
/**
* @brief Get a pointer to the internal DCB
*
* @return Pointer to internal DCB
* @return Pointer to DCB or NULL if not connected
*/
inline DCB* dcb() const
{

View File

@ -636,6 +636,10 @@ add_test_executable(mxs1713_lots_of_databases.cpp mxs1713_lots_of_databases mxs1
# https://jira.mariadb.org/browse/MXS-1731
add_test_executable(mxs1731_old_persisted_config.cpp mxs1731_old_persisted_config replication LABELS REPL_BACKEND)
# MXS-1751: Maxscale crashes when certain config is in play (with nodes down)
# https://jira.mariadb.org/browse/MXS-1751
add_test_executable(mxs1751_available_when_donor_crash.cpp mxs1751_available_when_donor_crash mxs1751_available_when_donor_crash LABELS GALERA_BACKEND)
# 'namedserverfilter' test
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)

View File

@ -15,6 +15,7 @@ module=mysqlmon
servers=server1
user=maxskysql
passwd=skysql
monitor_interval=1000
[Masking]
type=filter

View File

@ -0,0 +1,53 @@
[maxscale]
threads=###threads###
[Galera Monitor]
type=monitor
module=galeramon
servers=server1,server2,server3
user=maxskysql
passwd=skysql
monitor_interval=100
available_when_donor=true
[RW Split Router]
type=service
router=readwritesplit
servers=server1,server2,server3
user=maxskysql
passwd=skysql
master_accept_reads=true
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
[CLI]
type=service
router=cli
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=default
[server1]
type=server
address=###galera_server_IP_1###
port=###galera_server_port_1###
protocol=MySQLBackend
[server2]
type=server
address=###galera_server_IP_2###
port=###galera_server_port_2###
protocol=MySQLBackend
[server3]
type=server
address=###galera_server_IP_3###
port=###galera_server_port_3###
protocol=MySQLBackend

View File

@ -67,6 +67,9 @@ int main(int argc, char* argv[])
{
if (test.maxscales->start() == 0)
{
// Give the monitor a few seconds to monitor the servers
sleep(5);
if (test.maxscales->connect_rwsplit() == 0)
{
run(test);

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2016 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: 2020-01-01
*
* 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.
*/
#include "testconnections.h"
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
for (int i = 0; i < 2; i++)
{
test.galera->stop_node(0);
test.galera->stop_node(1);
test.galera->start_node(1);
test.galera->start_node(0);
test.galera->fix_replication();
}
return test.global_result;
}

View File

@ -66,6 +66,7 @@ void Backend::close(close_type type)
}
dcb_close(m_dcb);
m_dcb = NULL;
/** decrease server current connection counters */
atomic_add(&m_backend->connections, -1);

View File

@ -260,6 +260,41 @@ static json_t* diagnostics_json(const MXS_MONITOR *mon)
return rval;
}
static bool using_xtrabackup(MXS_MONITORED_SERVER *database, const char* server_string)
{
bool rval = false;
MYSQL_RES* result;
if (mxs_mysql_query(database->con, "SHOW VARIABLES LIKE 'wsrep_sst_method'") == 0
&& (result = mysql_store_result(database->con)) != NULL)
{
if (mysql_field_count(database->con) < 2)
{
mysql_free_result(result);
MXS_ERROR("Unexpected result for \"SHOW VARIABLES LIKE "
"'wsrep_sst_method'\". Expected 2 columns."
" MySQL Version: %s", server_string);
}
MYSQL_ROW row;
while ((row = mysql_fetch_row(result)))
{
if (row[1] && strncmp(row[1], "xtrabackup", 10) == 0)
{
rval = true;
}
}
mysql_free_result(result);
}
else
{
mon_report_query_error(database);
}
return rval;
}
/**
* Monitor an individual server. Does not deal with the setting of master or
* slave bits, except for clearing them when a server is not joined to the
@ -273,8 +308,7 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITORED_SERVER *database)
{
GALERA_MONITOR* handle = (GALERA_MONITOR*) mon->handle;
MYSQL_ROW row;
MYSQL_RES *result, *result2;
int isjoined = 0;
MYSQL_RES *result;
char *server_string;
/* Don't even probe server flagged as in maintenance */
@ -364,6 +398,8 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITORED_SERVER *database)
info.local_index = local_index;
}
ss_dassert(row[0] && row[1]);
if (strcmp(row[0], "wsrep_local_state") == 0)
{
if (strcmp(row[1], "4") == 0)
@ -371,34 +407,11 @@ monitorDatabase(MXS_MONITOR *mon, MXS_MONITORED_SERVER *database)
info.joined = 1;
}
/* Check if the node is a donor and is using xtrabackup, in this case it can stay alive */
else if (strcmp(row[1], "2") == 0 && handle->availableWhenDonor == 1)
{
if (mxs_mysql_query(database->con, "SHOW VARIABLES LIKE 'wsrep_sst_method'") == 0
&& (result2 = mysql_store_result(database->con)) != NULL)
{
if (mysql_field_count(database->con) < 2)
{
mysql_free_result(result);
mysql_free_result(result2);
MXS_ERROR("Unexpected result for \"SHOW VARIABLES LIKE "
"'wsrep_sst_method'\". Expected 2 columns."
" MySQL Version: %s", server_string);
return;
}
while ((row = mysql_fetch_row(result2)))
{
if (strncmp(row[1], "xtrabackup", 10) == 0)
else if (strcmp(row[1], "2") == 0 && handle->availableWhenDonor == 1 &&
using_xtrabackup(database, server_string))
{
info.joined = 1;
}
}
mysql_free_result(result2);
}
else
{
mon_report_query_error(database);
}
}
else
{
/* Force joined = 0 */