You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current version of the gem, there is an issue with handling SQL timeout configurations for MariaDB databases. While the timeout setting logic works well for PostgreSQL and MySQL, it raises an error when used with MariaDB:
Mysql2::Error: Unknown system variable 'max_execution_time' (Mysql2::Error)
This error occurs because MariaDB does not support the max_execution_time system variable, which is specific to MySQL. Instead, MariaDB uses MAX_STATEMENT_TIME (available from version 10.2).
Another potential issue is the reliance on the mysql adapter. Since Rails 7.1, the trilogy adapter is the default.
Steps to Reproduce
Set up a Rails application that connects to a MariaDB database.
Define deploy_pin task and try to execute it.
The query execution will fail with the aforementioned error.
Suggested Fix
To ensure compatibility with MariaDB and trilogy, we can:
Determine whether the connection is to MariaDB or MySQL. Since both databases may use the same adapter (mysql2 or trilogy), differentiating them based solely on the adapter name is unreliable. I'd suggest rather configuring it as a part of the DeployPin configuration.
Use the correct timeout statement based on the server type:
For MariaDB, use SET SESSION max_statement_time = %s.
For MySQL, continue using SET max_execution_time = %s.
For PostgreSQL, continue using SET statement_timeout TO %s.
I'd be happy to assist with the implementation if needed! 😊
The text was updated successfully, but these errors were encountered:
mateuszgorniak
changed the title
Timeout handling for MariaDB + trillogy adapter compatibility
Timeout handling for MariaDB + trilogy adapter compatibility
Sep 13, 2024
Description
In the current version of the gem, there is an issue with handling SQL timeout configurations for MariaDB databases. While the timeout setting logic works well for PostgreSQL and MySQL, it raises an error when used with MariaDB:
This error occurs because MariaDB does not support the
max_execution_time
system variable, which is specific to MySQL. Instead, MariaDB usesMAX_STATEMENT_TIME
(available from version 10.2).Another potential issue is the reliance on the
mysql
adapter. Since Rails 7.1, the trilogy adapter is the default.Steps to Reproduce
deploy_pin
task and try to execute it.Suggested Fix
To ensure compatibility with MariaDB and trilogy, we can:
DeployPin
configuration.SET SESSION max_statement_time = %s
.SET max_execution_time = %s
.SET statement_timeout TO %s
.I'd be happy to assist with the implementation if needed! 😊
The text was updated successfully, but these errors were encountered: