Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
None
-
None
Description
I'm facing the following situation. There is periodic procedure calling by event (CREATE EVENT) that modifies record and commits. There are two additional sessions (one by HeidiSQL, one by mysql command line tool) that issue select on view based on the table involved. I noticed outdated values, returned by mysql session while another session return accurate new value of datetime column.
Then (in mysql session) I issue "flush tables" command. Then on next execution I get new value.
This upsets me. I was expecting to get the latest column value regardless "flush tables". Is that designed behavior? Are there some system settings that affect the logic? Should I issue "flush tables" every time before issuing select?
My environment:
11.4.2-MariaDB
Win64
my.ini: autocommit=0 sql_mode=ORACLE
With autocommit=0 which you have in the config file yes, it is generally the expected behavior.
Consider the following simple scenario
--source include/have_innodb.inc
--connect (con1,localhost,root,,)
--connection default
--connection con1
It will result in
a
1
a
1
a
2
Here connection con1 opens a new transaction by running select from the table.
Since it has transaction isolation level repeatable-read (default), it will continue showing the same result set until the transaction is ended.
In the case above, the transaction is ended by an explicit commit, but it can be done implicitly by many statements. FLUSH TABLES is one of such statements, so when you run it, the current transaction ends, and you start getting the new result.
For your "good" connection, maybe HeidiSQL overrides the autocommit=0 value on the session level, or something similar occurs.
All in all, autocommit=0 globally in the config file is rarely a useful thing, unless you really know what it is there for, maybe it's worth reconsidering it.