From 982272aa968e5b59252ae78466618ee9fb0440b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Fri, 27 Jan 2023 10:52:36 +0100 Subject: [PATCH] Fix 'connect_timeout' and 'connect_retries' for 'MYSQL_COM_BINLOG_DUMP' Fix honoring of 'connect_timeout_server_max' and 'connect_retries_on_failure' for 'fast_forward' sessions created by 'MYSQL_COM_BINLOG_DUMP' when session still doesn't own a backend connection. --- lib/MySQL_Session.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 235ab3e463..3030ff36cb 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4014,6 +4014,19 @@ int MySQL_Session::get_pkts_from_client(bool& wrong_pass, PtrSize_t& pkt) { mybe->server_myds->reinit_queues(); // reinitialize the queues in the myds . By default, they are not active mybe->server_myds->wait_until = 0; if (mybe->server_myds->DSS==STATE_NOT_INITIALIZED) { + // NOTE: This section is entirely borrowed from 'STATE_SLEEP' for 'session_fast_forward'. + // Check comments there for extra information. + // ============================================================================= + if (mybe->server_myds->max_connect_time == 0) { + uint64_t connect_timeout = + mysql_thread___connect_timeout_server < mysql_thread___connect_timeout_server_max ? + mysql_thread___connect_timeout_server_max : mysql_thread___connect_timeout_server; + mybe->server_myds->max_connect_time = thread->curtime + connect_timeout * 1000; + } + mybe->server_myds->connect_retries_on_failure = mysql_thread___connect_retries_on_failure; + CurrentQuery.start_time=thread->curtime; + // ============================================================================= + // we don't have a connection previous_status.push(FAST_FORWARD); // next status will be FAST_FORWARD set_status(CONNECTING_SERVER); // now we need a connection