From 78c97ec579e1c569b8ab91f2c0f0cf20635ad370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Thu, 21 Jun 2018 10:29:58 +0200 Subject: [PATCH] Do not reset connections for error 1047 and 1053 --- lib/MySQL_Session.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index bdc550d7d..654dac0ae 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -2980,10 +2980,18 @@ handler_again: proxy_warning("Retrying query.\n"); } } - if (mysql_thread___reset_connection_algorithm == 2) { - create_new_session_and_reset_connection(myds); - } else { - myds->destroy_MySQL_Connection_From_Pool(true); + switch (myerr) { + case 1047: // WSREP has not yet prepared node for application use + case 1053: // Server shutdown in progress + myds->destroy_MySQL_Connection_From_Pool(false); + break; + default: + if (mysql_thread___reset_connection_algorithm == 2) { + create_new_session_and_reset_connection(myds); + } else { + myds->destroy_MySQL_Connection_From_Pool(true); + } + break; } myconn = myds->myconn; // re-initialize myds->fd=0;