From 64e282f74b56491fe05ee4808ef5caac9f369c88 Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Wed, 17 Apr 2019 11:19:07 +0300 Subject: [PATCH 1/7] Fix config of mysqlmon_multimaster_serverid --- .../cnf/maxscale.cnf.template.mysqlmon_multimaster_serverid | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mysqlmon_multimaster_serverid b/maxscale-system-test/cnf/maxscale.cnf.template.mysqlmon_multimaster_serverid index 749147a54..a85c925f8 100644 --- a/maxscale-system-test/cnf/maxscale.cnf.template.mysqlmon_multimaster_serverid +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mysqlmon_multimaster_serverid @@ -10,6 +10,7 @@ user=maxskysql password= skysql detect_stale_master=0 monitor_interval=1000 +assume_unique_hostnames=false [RW Split Router] type=service @@ -18,6 +19,7 @@ servers=server1, server2, server3, server4 user=maxskysql password=skysql slave_selection_criteria=LEAST_ROUTER_CONNECTIONS +max_slave_replication_lag=1 [Read Connection Router Slave] type=service From 03dc969cf203decb4d0bc65280fe4f901da87830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 17 Apr 2019 16:22:58 +0300 Subject: [PATCH 2/7] Fix use-after-free in LocalClient If the DCB was closed before the handshake for the LocalCliet connection was received, the gw_decode_mysql_server_handshake would use the closed DCB to log the connection ID. Clearing out the pointer prevents it. --- server/modules/protocol/MySQL/mariadb_client.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/modules/protocol/MySQL/mariadb_client.cc b/server/modules/protocol/MySQL/mariadb_client.cc index 5a52ecbde..9f9f1a1e6 100644 --- a/server/modules/protocol/MySQL/mariadb_client.cc +++ b/server/modules/protocol/MySQL/mariadb_client.cc @@ -32,6 +32,8 @@ LocalClient::LocalClient(MYSQL_session* session, MySQLProtocol* proto, int fd) , m_self_destruct(false) { MXB_POLL_DATA::handler = LocalClient::poll_handler; + m_protocol.owner_dcb = nullptr; + m_protocol.stored_query = nullptr; } LocalClient::~LocalClient() From 4e2b6d6cb3a50d65df4818d574378717cb45c9f4 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Thu, 18 Apr 2019 03:44:02 +0300 Subject: [PATCH 3/7] Add maxscale-system-test dependecies installation script --- BUILD/install_cmake.sh | 23 +++++++++ BUILD/install_test_build_deps.sh | 80 ++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100755 BUILD/install_cmake.sh create mode 100755 BUILD/install_test_build_deps.sh diff --git a/BUILD/install_cmake.sh b/BUILD/install_cmake.sh new file mode 100755 index 000000000..71dd0e9e9 --- /dev/null +++ b/BUILD/install_cmake.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# cmake +wget -q http://max-tst-01.mariadb.com/ci-repository/cmake-3.7.1-Linux-x86_64.tar.gz --no-check-certificate +if [ $? != 0 ] ; then + echo "CMake can not be downloaded from Maxscale build server, trying from cmake.org" + wget -q https://cmake.org/files/v3.7/cmake-3.7.1-Linux-x86_64.tar.gz --no-check-certificate +fi +sudo tar xzf cmake-3.7.1-Linux-x86_64.tar.gz -C /usr/ --strip-components=1 + +cmake_version=`cmake --version | grep "cmake version" | awk '{ print $3 }'` +if [ "`echo -e "3.7.1\n$cmake_version"|sort -V|head -n 1`" != "3.7.1" ] ; then + echo "cmake does not work! Trying to build from source" + wget -q https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz --no-check-certificate + tar xzf cmake-3.7.1.tar.gz + cd cmake-3.7.1 + + ./bootstrap + gmake + sudo make install + cd .. +fi + diff --git a/BUILD/install_test_build_deps.sh b/BUILD/install_test_build_deps.sh new file mode 100755 index 000000000..029f03968 --- /dev/null +++ b/BUILD/install_test_build_deps.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +# Installs all build dependecies for maxscale-system-test +# Only Ubuntu Bionic/Xenial, CentOS 7, SLES 15 are supported + +rp=`realpath $0` +export src_dir=`dirname $rp` +export LC_ALL=C +command -v apt-get + +if [ $? == 0 ] +then + # DEB-based distro + install_libdir=/usr/lib + source /etc/os-release + echo "deb http://mirror.netinch.com/pub/mariadb/repo/10.3/ubuntu/ ${UBUNTU_CODENAME} main" > mariadb.list + sudo cp mariadb.list /etc/apt/sources.list.d/ + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0xF1656F24C74CD1D8 + sudo apt-get update + sudo apt-get install -y --force-yes \ + git wget build-essential \ + libssl-dev mariadb-client php perl \ + coreutils libjansson-dev zlib1g-dev \ + mariadb-test python python-pip cmake libpam0g-dev + sudo apt-get install -y --force-yes openjdk-8-jdk + if [ $? != 0 ] + then + sudo apt-get install -y --force-yes openjdk-7-jdk + fi + pip install --upgrade pip + pip install JayDeBeApi +else + ## RPM-based distro + install_libdir=/usr/lib64 + command -v yum + + if [ $? != 0 ] + then + # We need zypper here + cat >mariadb.repo <<'EOL' +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.3/sles/$releasever/$basearch/ +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=0 +EOL + sudo cp mariadb.repo /etc/zypp/repos.d/ + + sudo zypper -n refresh + sudo zypper -n install gcc gcc-c++ \ + libopenssl-devel libgcrypt-devel MariaDB-devel MariaDB-test \ + php perl coreutils libjansson-devel python python-pip \ + cmake pam-devel openssl-devel python-devel libjansson-devel + sudo zypper -n install java-1_8_0-openjdk + else + # YUM! + cat >mariadb.repo <<'EOL' +[mariadb] +name = MariaDB +baseurl = http://yum.mariadb.org/10.3/centos/$releasever/$basearch/ +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=0 +EOL + sudo cp mariadb.repo /etc/yum.repos.d/ + sudo yum clean all + sudo yum install -y --nogpgcheck epel-release + sudo yum install -y --nogpgcheck git wget gcc gcc-c++ \ + libgcrypt-devel \ + openssl-devel mariadb-devel mariadb-test \ + php perl coreutils python python-pip \ + cmake pam-devel python-devel jansson-devel + sudo yum install -y --nogpgcheck java-1.8.0-openjdk + sudo yum install -y --nogpgcheck centos-release-scl + sudo yum install -y --nogpgcheck devtoolset-7-gcc* + echo "please run 'scl enable devtoolset-7 bash' to enable new gcc!!" + fi + sudo pip install --upgrade pip + sudo pip install JayDeBeApi +fi + From 7fc3527e1d5b3451f1983a38ebd348c3cb44728a Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Thu, 18 Apr 2019 12:10:24 +0300 Subject: [PATCH 4/7] Check for Docker in run_npm_test.sh Lack of Docker can cause build failure To avoid it if Docker is not available test is not started, simply returns 0 It is hard to make Docker installation reliable especially for very old or very new distros --- test/run_npm_test.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/run_npm_test.sh b/test/run_npm_test.sh index 8cd614f5b..ef3c855df 100755 --- a/test/run_npm_test.sh +++ b/test/run_npm_test.sh @@ -12,6 +12,21 @@ then exit 1 fi +# Prevent failures in case if Docker is not available +command -v docker +if [ $? != 0 ] +then + echo "Docker is not available, skipping the test" + exit 0 +fi + +command -v docker-compose +if [ $? != 0 ] +then + echo "docker-compose is not available, skipping the test" + exit 0 +fi + srcdir=$1 testsrc=$2 testdir=$3 From 2d8a93e88d63317281ab37f9ec4e707bd6e26707 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 23 Apr 2019 11:17:01 +0300 Subject: [PATCH 5/7] Update 2.3.6 release date --- Documentation/Release-Notes/MaxScale-2.3.6-Release-Notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/Release-Notes/MaxScale-2.3.6-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.3.6-Release-Notes.md index c2e248278..29ae50b32 100644 --- a/Documentation/Release-Notes/MaxScale-2.3.6-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.3.6-Release-Notes.md @@ -1,4 +1,4 @@ -# MariaDB MaxScale 2.3.6 Release Notes +# MariaDB MaxScale 2.3.6 Release Notes -- 2019-04-23 Release 2.3.6 is a GA release. From f41ce6db16631caa816e2c0742b428140b4b296b Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 23 Apr 2019 11:20:38 +0300 Subject: [PATCH 6/7] Update maintenance version for 2.3 --- VERSION23.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION23.cmake b/VERSION23.cmake index 643875ab7..3bceeb242 100644 --- a/VERSION23.cmake +++ b/VERSION23.cmake @@ -5,7 +5,7 @@ set(MAXSCALE_VERSION_MAJOR "2" CACHE STRING "Major version") set(MAXSCALE_VERSION_MINOR "3" CACHE STRING "Minor version") -set(MAXSCALE_VERSION_PATCH "6" CACHE STRING "Patch version") +set(MAXSCALE_VERSION_PATCH "7" CACHE STRING "Patch version") # This should only be incremented if a package is rebuilt set(MAXSCALE_BUILD_NUMBER 1 CACHE STRING "Release number") From ba79028a46936f4b17ad9a417dd5bccb9498bb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 18 Apr 2019 10:18:29 +0300 Subject: [PATCH 7/7] Add debug assertions into the core The assertions make sure DCB writes and reads are only done by the thread that owns them. --- server/core/dcb.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/core/dcb.cc b/server/core/dcb.cc index 3b72d4748..c18ba056b 100644 --- a/server/core/dcb.cc +++ b/server/core/dcb.cc @@ -565,6 +565,7 @@ int dcb_read(DCB* dcb, GWBUF** head, int maxbytes) { + mxb_assert(dcb->poll.owner == RoutingWorker::get_current()); int nsingleread = 0; int nreadtotal = 0; @@ -904,6 +905,7 @@ static int dcb_log_errors_SSL(DCB* dcb, int ret) */ int dcb_write(DCB* dcb, GWBUF* queue) { + mxb_assert(dcb->poll.owner == RoutingWorker::get_current()); dcb->writeqlen += gwbuf_length(queue); // The following guarantees that queue is not NULL if (!dcb_write_parameter_check(dcb, queue)) @@ -3301,6 +3303,7 @@ public: RoutingWorker& rworker = static_cast(worker); if (dcb_is_still_valid(m_dcb, rworker.id()) && m_dcb->m_uid == m_uid) { + mxb_assert(m_dcb->poll.owner == RoutingWorker::get_current()); m_dcb->fakeq = m_buffer; dcb_handler(m_dcb, m_ev); } @@ -3321,6 +3324,7 @@ static void poll_add_event_to_dcb(DCB* dcb, GWBUF* buf, uint32_t ev) { if (dcb == this_thread.current_dcb) { + mxb_assert(dcb->poll.owner == RoutingWorker::get_current()); // If the fake event is added to the current DCB, we arrange for // it to be handled immediately in dcb_handler() when the handling // of the current events are done...