sysown / proxysql

High-performance MySQL proxy with a GPL license.
http://www.proxysql.com
GNU General Public License v3.0
6.05k stars 983 forks source link

Exceeding the max_transaction_behind value, the status of mysql_Server did not change to SHUNNING #4638

Closed zhaozhiguang closed 2 months ago

zhaozhiguang commented 2 months ago

Exceeding the max_transaction_behind value, the status of mysql_Server did not change to SHUNNING

version: 2.6.3 mode: mysql group replication

zhaozhiguang commented 2 months ago

I am using Hikari connection pool and JDBC template to query data (select count (*) from tables) for lag data verification. I found that lagging data could be queried, but I directly changed it to using JDBC's driverManager. getConnection() to obtain new connections and execute the same query data each time, so the quantity remains the same

zhaozhiguang commented 2 months ago

problem analysis Connection pool (such as HikariCP): A connection pool establishes and maintains a certain number of database connections in advance. These connections were already directed to specific MySQL server instances at the time of creation. If ProxySQL detects a delay in a server instance and decides not to route new queries to that instance, but established connections still point to that instance, queries executed through these connections may still return old data. Driver Manager: Every time a connection is obtained through Driver Manager, a new connection is established. If ProxySQL has updated its routing rules based on the state of MGR, new connections will follow these rules, making it more likely to connect to the server instance with the latest data.