Merge branch '2.3' into 2.4

This commit is contained in:
Markus Mäkelä 2019-06-28 09:31:14 +03:00
commit 8568822da2
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
2 changed files with 16 additions and 1 deletions

View File

@ -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 \

View File

@ -13,6 +13,8 @@
#include <maxsql/mariadb.hh>
#include <string.h>
#include <errmsg.h>
#include <thread>
#include <chrono>
#include <maxbase/alloc.h>
#include <maxbase/assert.h>
#include <maxbase/format.hh>
@ -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);
}