Commit 831627bf authored by Jérome Perrin's avatar Jérome Perrin

ZMySQLDA: reconnect on mariadb's Connection was killed

After server restarts, mariadb uses an error 1927 which is mariadb
specific, with no corresponding constant in CR module when server
restart. This is the case at least with mariadb 10.3.38.

This fix the following problem:
 - start zope and use mariadb connection
 - restart mariadb
 - use mariadb connection again, see an error:
    Error Type: OperationalError
    Error Value: (1927, 'Connection was killed')

This change to treat 1927 as an error for which we can reconnect and
retry the query. Some other connectors do it, for example sqlalchemy in
https://github.com/sqlalchemy/sqlalchemy/issues/5493
parent 288063e6
......@@ -116,7 +116,8 @@ from ZODB.POSException import ConflictError
hosed_connection = (
CR.SERVER_GONE_ERROR,
CR.SERVER_LOST,
CR.COMMANDS_OUT_OF_SYNC
CR.COMMANDS_OUT_OF_SYNC,
1927, # ER_CONNECTION_KILLED "Connection was killed" in MariaDB
)
query_syntax_error = (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment