【Background】
The Java service uses mysql.8.0.13.jar as the driver to execute business SQL.
【Phenomenon】
When adding an index to a large table, the Java program will intermittently throw a “statement cancelled due to client request” error after varying lengths of time (30-60 minutes).
However, upon investigation, it was found that the SQL was still running and the index was eventually added successfully.
【Additional Information】
Apart from the necessary parameters like user and password, no extra operations were set in the connection URL parameters. The result of executing the command SHOW VARIABLES LIKE ‘max_execution_time’; is 0.
【TiDB Version】
In addition to the driver version issue mentioned above, you should also check whether load balancers like nginx/haproxy have set connection timeout periods.
It could be due to driver incompatibility or the Java framework. Try modifying the JDBC parameters. You can first try downgrading, and if that doesn’t work, consider comparing it with MySQL to see if the driver works properly.