Merge branch '2.2' into develop
This commit is contained in:
@ -4,7 +4,7 @@ MDBCI is a tool to manage virtual machines (VM). VM can be described in
|
||||
the simple JSON format.
|
||||
JSON templates can be found in [BUILD/mdbci/templates](templates)
|
||||
|
||||
MDBCI_VM_PATH have to be set before executing any MDBCI commands.
|
||||
MDBCI_VM_PATH have to be set before executing any MDBCI commands.
|
||||
This variable points to the directory to store 'Vagrantfile's
|
||||
for all VMs as well as all additional files (e.g. *network_config)
|
||||
|
||||
@ -18,7 +18,7 @@ Installation instructions: [PREPARATION_FOR_MDBCI](https://github.com/mariadb-co
|
||||
|
||||
[BUILD/mdbci/build.sh](build.sh) prepares VM, executes Maxscale build and creates binary RPM or DEB repository.
|
||||
|
||||
Build options can be defined in the environmental variables. For variables descriptions and default values see
|
||||
Build options can be defined in the environmental variables. For variables descriptions and default values see
|
||||
comments in the [BUILD/mdbci/build.sh](build.sh) and [BUILD/mdbci/set_build_variables.sh](set_build_variables.sh)
|
||||
|
||||
Script does not store build log, please use ```stdout``` and ```stderr``` redirection to store log.
|
||||
@ -37,7 +37,7 @@ By default VM will not stay alive after the build. Please use ```export do_not_d
|
||||
to prevent VM from being destroyed. In this case VM have to be destroyed manually by ```mdbci destroy```
|
||||
command.
|
||||
|
||||
VM will be created in ```$HOME/vms directory```, binary repository will be created the in
|
||||
VM will be created in ```$HOME/vms directory```, binary repository will be created the in
|
||||
```$HOME/repository/``` directory.
|
||||
The name of binary repository sub-directory is generated based on source default
|
||||
branch name and current date and time.
|
||||
@ -56,7 +56,7 @@ If this command exits with success ('0') upgrade test reports PASSED.
|
||||
## Build with AWS VM
|
||||
|
||||
To build using AWS VM it is necessary to configure AWS credentials and install `vagrant-aws` plugin.
|
||||
AWS credentials have to be configured in the $HOME/.aws directory as described in the
|
||||
AWS credentials have to be configured in the $HOME/.aws directory as described in the
|
||||
[AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)
|
||||
|
||||
## Example of build
|
||||
@ -71,8 +71,8 @@ export box="ubuntu_xenial_libvirt"
|
||||
# examples:
|
||||
# source="refs/tags/2.1.1" - tag "2.1.1"
|
||||
# source="refs/heads/develop" - "develop" branch
|
||||
# source="2.1" - can be branch or tag "2.1"
|
||||
# (use refs/tags and refs/heads if there are
|
||||
# source="2.1" - can be branch or tag "2.1"
|
||||
# (use refs/tags and refs/heads if there are
|
||||
# both tag "2.1" and branch "2.1")
|
||||
# source="816983691af8fbded1b2b06a8c19e02587a54f32" - commit ID
|
||||
export source="2.2"
|
||||
@ -83,4 +83,3 @@ export target="2.1-2018Jan10"
|
||||
cd BUILD/mdbci
|
||||
./build.sh
|
||||
```
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
# Creates RPM or DEB repository for biniries from
|
||||
# $pre_repo_dir/$target/$box, signs it with keys
|
||||
# from ${gpg_keys_path} and puts signed repo to
|
||||
# from ${gpg_keys_path} and puts signed repo to
|
||||
|
||||
set -x
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ if [ $z_res -eq 127 ] && [ $y_res -eq 127 ] ; then
|
||||
mkdir -p dists/$dist_name/main/binary-i386/
|
||||
dpkg-scanpackages dists/$dist_name/main/binary-i386/ /dev/null | gzip -9c > dists/$dist_name/main/binary-i386/Packages.gz
|
||||
gunzip -c dists/$dist_name/main/binary-i386/Packages.gz > dists/$dist_name/main/binary-i386/Packages
|
||||
# else
|
||||
# else
|
||||
# echo "Architectures: ppc64el" >> dists/$dist_name/main/$arch/Release
|
||||
fi
|
||||
archs=`ls -1 dists/$dist_name/main | sed "s/binary-//" | tr '\n' ' '`
|
||||
@ -55,7 +55,7 @@ if [ $z_res -eq 127 ] && [ $y_res -eq 127 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gpg -abs --digest-algo sha256 -o dists/$dist_name/Release.gpg dists/$dist_name/Release
|
||||
gpg -abs --digest-algo sha256 -o dists/$dist_name/Release.gpg dists/$dist_name/Release
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Package signing failed!"
|
||||
exit 1
|
||||
@ -72,19 +72,19 @@ else
|
||||
echo "%_signature gpg" >> ~/.rpmmacros
|
||||
echo "%_gpg_name MariaDB Maxscale <maxscale@googlegroups.com>" >> ~/.rpmmacros
|
||||
echo "\r" | setsid rpm --resign $sourcedir/*.rpm
|
||||
|
||||
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Package signing failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
cp $sourcedir/* $destdir/
|
||||
pushd ${destdir} >/dev/null 2>&1
|
||||
createrepo -d -s sha .
|
||||
if [ $? != 0 ] ; then
|
||||
echo "Repo creation failed!"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
popd >/dev/null 2>&1
|
||||
gpg --output repomd.xml.key --sign $destdir/repodata/repomd.xml
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyies stuff to VM, run build on VM and copies binaries
|
||||
# Copyies stuff to VM, run build on VM and copies binaries
|
||||
# to $pre_repo_dir/$target/$box
|
||||
|
||||
set -x
|
||||
@ -17,7 +17,7 @@ ssh $sshopt "sudo rm -rf $work_dir"
|
||||
echo "copying stuff to $image machine"
|
||||
ssh $sshopt "mkdir -p $work_dir"
|
||||
|
||||
rsync -avz --delete -e "ssh $scpopt" ${script_dir}/../../ $sshuser@$IP:./$work_dir/
|
||||
rsync -avz --delete -e "ssh $scpopt" ${script_dir}/../../ $sshuser@$IP:./$work_dir/
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "Error copying stuff to $box machine"
|
||||
exit 2
|
||||
|
||||
@ -23,7 +23,7 @@ export source=${scm_source}
|
||||
export source=${source:-"$branch"}
|
||||
echo "source=$source"
|
||||
|
||||
#hack to get rid of Jenkins artifacts
|
||||
#hack to get rid of Jenkins artifacts
|
||||
export target=`echo $target | tr -cd "[:print:]" | sed "s/?//g" | sed "s/ //g"`
|
||||
|
||||
export target=${target:-"$source-$curr_date"}
|
||||
|
||||
@ -37,7 +37,7 @@ ${mdbci_dir}/repository-config/generate_all.sh repo.d
|
||||
${mdbci_dir}/repository-config/maxscale-release.sh $old_target repo.d
|
||||
|
||||
# starting VM for build
|
||||
${mdbci_dir}/mdbci --override --template $MDBCI_VM_PATH/$name.json --repo-dir $dir/repo.d generate $name
|
||||
${mdbci_dir}/mdbci --override --template $MDBCI_VM_PATH/$name.json --repo-dir $dir/repo.d generate $name
|
||||
${mdbci_dir}/mdbci up $name --attempts=1
|
||||
if [ $? != 0 ] ; then
|
||||
if [ $? != 0 ] ; then
|
||||
@ -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
|
||||
maxadm_exit=$?
|
||||
if [ $maxadm_exit == 0 ] ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
ssh $sshopt $maxadmin_command
|
||||
if [ $? != 0 ] ; then
|
||||
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
|
||||
|
||||
@ -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`
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ module=mysqlmon
|
||||
servers=server1
|
||||
user=maxskysql
|
||||
passwd=skysql
|
||||
monitor_interval=1000
|
||||
|
||||
[Masking]
|
||||
type=filter
|
||||
|
||||
@ -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
|
||||
@ -1,11 +1,11 @@
|
||||
# Running Maxscale system tests on Virtual Machines with MDBCI
|
||||
|
||||
MDBCI is a tool to manage virtual machines (VMs).
|
||||
MDBCI is a tool to manage virtual machines (VMs).
|
||||
VMs can be described in the simple JSON format.
|
||||
JSON templates for test configuration can be found in
|
||||
[maxscale-system-test/mdbci/templates/](templates/)
|
||||
|
||||
'MDBCI_VM_PATH' have to be set before executing any MDBCI commands.
|
||||
'MDBCI_VM_PATH' have to be set before executing any MDBCI commands.
|
||||
This variable points to the directory to store 'Vagrantfile's
|
||||
for all VMs as well as all additional files (e.g. *network_config)
|
||||
|
||||
@ -17,7 +17,7 @@ Installation instructions: [PREPARATION_FOR_MDBCI](https://github.com/mariadb-co
|
||||
|
||||
## Basics of test setup
|
||||
|
||||
Test setup is described in template. Templates are stored in
|
||||
Test setup is described in template. Templates are stored in
|
||||
[maxscale-system-test/mdbci/templates/](templates/)
|
||||
Own template have to be put to the same directory.
|
||||
|
||||
@ -44,13 +44,13 @@ Template can contain references to any environmental variables - they all
|
||||
will be replaced with values before VMs starting
|
||||
|
||||
The [maxscale-system-test/mdbci/run_test.sh](run_test.sh) script
|
||||
brings test VMs configuration up and tries to execute
|
||||
brings test VMs configuration up and tries to execute
|
||||
```maxscale-system-test``` using 'ctest'.
|
||||
|
||||
Script can be executed without any parameters and without defining any
|
||||
environmental variables.
|
||||
Script can be executed without any parameters and without defining any
|
||||
environmental variables.
|
||||
In this case, tests will be executed for CentOS 7, MariaDB 10.2 and
|
||||
Maxscale from current 'develop' repository
|
||||
Maxscale from current 'develop' repository
|
||||
[http://max-tst-01.mariadb.com/ci-repository/develop/mariadb-maxscale/](http://max-tst-01.mariadb.com/ci-repository/develop/mariadb-maxscale/)
|
||||
VMs will not be destroyed after the tests.
|
||||
|
||||
@ -73,7 +73,7 @@ Variable name|Meaning
|
||||
```name```|The name of test run - any string to identify VMs set|
|
||||
|
||||
|
||||
For complete list of environmental variables see comments in
|
||||
For complete list of environmental variables see comments in
|
||||
[maxscale-system-test/mdbci/run_test.sh](run_test.sh)
|
||||
and file [maxscale-system-test/mdbci/set_run_test_variables.sh](set_run_test_variables.sh)
|
||||
|
||||
@ -92,7 +92,7 @@ test_set|Meaning
|
||||
|
||||
If ```galera_version``` is not defined the value of ```version``` is used also for Galera backend
|
||||
|
||||
### Test execution
|
||||
### Test execution
|
||||
|
||||
After execution of 'run_test.sh` by default VMs stay alive and other tests can be executed.
|
||||
|
||||
@ -100,7 +100,7 @@ Test use environmental variables to get all infio about test setup (about VMs).
|
||||
|
||||
The script [maxscale-system-test/mdbci/set_env.sh](set_env.sh)
|
||||
loads all needed values (IPs, paths to ssh keyfiles,
|
||||
user names, etc) into environmental variables. Script uses
|
||||
user names, etc) into environmental variables. Script uses
|
||||
data from ```${MDBCI_VM_PATH}/${name}_network_config``` file
|
||||
and also calls MDBCI commands.
|
||||
|
||||
@ -168,7 +168,7 @@ To restore backend separatelly and for intial backend setup check_backend' can b
|
||||
'run_test.sh' makes snapshot of all VMs before tests. The name of snapshot is 'clean'.
|
||||
|
||||
In case of problem, after 'snapshot revert' it is recommended to re-create
|
||||
${name}_network_config file, re-load environmental variables and run
|
||||
${name}_network_config file, re-load environmental variables and run
|
||||
'check_backend'
|
||||
|
||||
```bash
|
||||
|
||||
@ -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);
|
||||
|
||||
30
maxscale-system-test/mxs1751_available_when_donor_crash.cpp
Normal file
30
maxscale-system-test/mxs1751_available_when_donor_crash.cpp
Normal 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;
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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,33 +407,10 @@ 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)
|
||||
else if (strcmp(row[1], "2") == 0 && handle->availableWhenDonor == 1 &&
|
||||
using_xtrabackup(database, server_string))
|
||||
{
|
||||
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)
|
||||
{
|
||||
info.joined = 1;
|
||||
}
|
||||
}
|
||||
mysql_free_result(result2);
|
||||
}
|
||||
else
|
||||
{
|
||||
mon_report_query_error(database);
|
||||
}
|
||||
info.joined = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user