Question: is there any way to force ProxySQL to always route SQL statements to the
write hostgroup if autocommit=0, and in all other cases use the rules defined in the mysql_query_rules table?
Simple use case: I call setAutoCommit(false) on the java.sql.Connection object, and then perform the following statements in a single transaction:
1. SELECT * from tableA;
2. UPDATE tableA set columnB = 'valueC';
3. SELECT * from tableA;
Finally, I call commit() on the java.sql.Connection object.
#1 can go to either master or slave - it doesn't matter
#2 obviously must go to master (write hostgroup), which it always does in my experiments
I want #3 to go to master as well, because it is part of the same transaction, but it is always going to slave.
I have considered setting mysql-enforce_autocommit_on_reads=true, but after learning about that setting I'm reluctant to change it as it seems it might send some of my UPDATE statements to the slave, which is definitely not what I want.
If ProxySQL could be aware of the autocommit status, and if it is OFF then just send everything to the write hostgroup (or even a specific host) then I think that would solve my problem.
Will experiment with mysql-enforce_autocommit_on_reads tomorrow.