Skip to content

Commit

Permalink
Added reconnect support for ER_CLIENT_INTERACTION_TIMEOUT
Browse files Browse the repository at this point in the history
  • Loading branch information
FredyH committed May 22, 2022
1 parent 1152181 commit 91f546a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions MySQL/include/mysqld_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,7 @@
#define ER_EXPRESSION_REFERS_TO_UNINIT_FIELD 4029
#define ER_PARTITION_DEFAULT_ERROR 4030
#define ER_REFERENCED_TRG_DOES_NOT_EXIST 4031
#define ER_CLIENT_INTERACTION_TIMEOUT 4031 //Since MySQL 8.0.24
#define ER_INVALID_DEFAULT_PARAM 4032
#define ER_BINLOG_NON_SUPPORTED_BULK 4033
#define ER_BINLOG_UNCOMPRESS_ERROR 4034
Expand Down
1 change: 1 addition & 0 deletions src/mysql/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ void Database::runQuery(const std::shared_ptr<IQuery>& query, const std::shared_
unsigned int errorCode = error.getErrorCode();
bool retryableError = errorCode == CR_SERVER_LOST || errorCode == CR_SERVER_GONE_ERROR ||
errorCode == ER_MAX_PREPARED_STMT_COUNT_REACHED || errorCode == ER_UNKNOWN_STMT_HANDLER ||
errorCode == ER_CLIENT_INTERACTION_TIMEOUT ||
errorCode == CR_NO_PREPARE_STMT;
if (retry && retryableError && attemptReconnect()) {
//Need to free statements before retrying in case the connection was lost
Expand Down
1 change: 1 addition & 0 deletions src/mysql/PreparedQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ void PreparedQuery::executeStatement(Database &database, MYSQL *connection, cons
unsigned int errorCode = error.getErrorCode();
if (errorCode == CR_SERVER_LOST || errorCode == CR_SERVER_GONE_ERROR ||
errorCode == ER_MAX_PREPARED_STMT_COUNT_REACHED || errorCode == ER_UNKNOWN_STMT_HANDLER ||
errorCode == ER_CLIENT_INTERACTION_TIMEOUT ||
errorCode == CR_NO_PREPARE_STMT) {
//In these cases the statement will no longer be valid, free it.
database.freeStatement(this->cachedStatement);
Expand Down

0 comments on commit 91f546a

Please sign in to comment.