mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
5392b4a32c
mysql_insert() first opens all affected tables (which implicitly starts a transaction in InnoDB), then stat tables. A failure to open a stat table caused open_tables() to abort the current stmt transaction (trans_rollback_stmt()). So, from the server point of view the following ha_write_row()-s happened outside of a transactions, and the server didn't bother to commit them. The server has a mechanism to prevent a transaction being unexpectedly committed or rolled back in the middle of a statement - if an operation takes place _in a sub-statement_ it cannot change the transaction state. Operations on stat tables are exactly that - they are not allowed to change a transaction state. Put them in a sub-statement to make sure they don't.
15 lines
326 B
Text
15 lines
326 B
Text
rename table mysql.table_stats to mysql.table_stats_save;
|
|
flush tables;
|
|
set use_stat_tables= PREFERABLY;
|
|
create table t1 (a int) engine=InnoDB;
|
|
start transaction;
|
|
insert t1 values (1);
|
|
insert t1 values (2);
|
|
commit;
|
|
select * from t1;
|
|
a
|
|
1
|
|
2
|
|
drop table t1;
|
|
rename table mysql.table_stats_save to mysql.table_stats;
|
|
flush tables;
|