From b796351b2c7c25337a0ffb6d5c13de88569dd7f6 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Fri, 28 Jun 2019 00:15:28 +0300 Subject: [PATCH 1/2] make apt non-interactive in install_build_deps.sh In Ubuntu Bionic there is need to update libssl which causes system services restart and apt asks user to allow this restart. It cases build script to hang and build fails due to timeout. Additional dpkg options and DEBIAN_FRONTEND=noninteractive solves the problem --- BUILD/install_build_deps.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BUILD/install_build_deps.sh b/BUILD/install_build_deps.sh index df67add78..a8777e603 100755 --- a/BUILD/install_build_deps.sh +++ b/BUILD/install_build_deps.sh @@ -10,9 +10,14 @@ if [ $? == 0 ] then # DEB-based distro install_libdir=/usr/lib + export DEBIAN_FRONTEND=noninteractive sudo apt-get update - sudo apt-get install -y --force-yes dpkg-dev git wget \ + sudo dpkg-reconfigure libc6 + sudo -E apt-get -q -o Dpkg::Options::=--force-confold \ + -o Dpkg::Options::=--force-confdef \ + -y --force-yes \ + install dpkg-dev git wget \ build-essential libssl-dev ncurses-dev bison flex \ perl libtool libpcre3-dev tcl tcl-dev uuid \ uuid-dev libsqlite3-dev liblzma-dev libpam0g-dev pkg-config \ From 42c37585f4f5bfbc06c7cc6eb44d80013027f468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Jun 2019 00:45:54 +0300 Subject: [PATCH 2/2] Throttle query retry attempts It was possible that a one-second outage that caused immediate rejection of network connections would cause all of the query retry attempts to fail within a very short period of time. By preventing rapid reconnections, query_retries is more effective as an error filtering mechanism. --- server/core/mysql_utils.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/core/mysql_utils.cc b/server/core/mysql_utils.cc index c82b8d8fd..34430ec7d 100644 --- a/server/core/mysql_utils.cc +++ b/server/core/mysql_utils.cc @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include @@ -251,6 +253,14 @@ int mxs_mysql_query_ex(MYSQL* conn, const char* query, int query_retries, time_t && mxs_mysql_is_net_error(mysql_errno(conn)) && time(NULL) - start < query_retry_timeout; n++) { + if (n > 0) + { + // The first reconnection didn't work, wait for one second before attempting again. This + // should reduce the likelihood of transient problems causing state changes due to too many + // reconnection attemps in a short period of time. + std::this_thread::sleep_for(std::chrono::seconds(1)); + } + rc = mysql_query(conn, query); }