diff --git a/BUILD/install_build_deps.sh b/BUILD/install_build_deps.sh index 55342045c..7c1ffb592 100755 --- a/BUILD/install_build_deps.sh +++ b/BUILD/install_build_deps.sh @@ -14,9 +14,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 \ diff --git a/maxutils/maxsql/src/mariadb.cc b/maxutils/maxsql/src/mariadb.cc index 6980944a9..9ce7b1793 100644 --- a/maxutils/maxsql/src/mariadb.cc +++ b/maxutils/maxsql/src/mariadb.cc @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include #include @@ -44,6 +46,14 @@ int mysql_query_ex(MYSQL* conn, const std::string& query, int query_retries, tim for (int n = 0; rc != 0 && n < query_retries && 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_cstr); }