mariadb/mysql-test/suite/galera/r/tmp_space_usage.result
Monty b2f6216695 MDEV-37808 "Local temporary space limit reached" on not so rare occasions
This bug happens when using galera, max_tmp_session_space_usage and a
transaction that uses temporary file of a size between 'binlog-cache-size'
(default 32K) and 64K followed by a change user command.

In the case of a transaction of size between 32k and 64k, the server don't
truncate the binary log file on disk to speed up things, which is fine.

The bug was that change_user() reset the tmp_space_used variable and the
next time the temporary_file was truncated, we got a negative value for
tmp_space_used, which caused the error "Local temporary space limit
reached".

Fixed by not resetting tmp_space_used in init(), which is called by
change_user().

Other things
- Truncate binary log cache files when change_user() is called. This
  makes the new users session not depending on log file sizes by previous
  user.
- Some new ASSERT and DBUG_ENTER
- Fixed typo in DBUG output in ma_pagecache.c
2025-11-19 15:14:40 +02:00

29 lines
764 B
Text

connection node_2;
connection node_1;
#
# MDEV-37808 "Local temporary space limit reached" on not so rare
# occasions
#
connection node_1;
set @@max_tmp_session_space_usage=1024*1024*1024;
create user foo;
grant all privileges on *.* to foo;
use test;
create table t1(a int, b varchar(1024)) engine=innodb;
insert into t1 select seq, repeat("a", 500) from seq_1_to_100;
create table t2(a int, b varchar(1024)) engine=myisam;
insert into t2 select seq, repeat("a", 500) from seq_1_to_100;
show status like "%tmp_space%";
Variable_name Value
Max_tmp_space_used 102054
Tmp_space_used 102054
use test;
select count(*) from t1;
count(*)
100
show status like "%tmp_space%";
Variable_name Value
Max_tmp_space_used 102054
Tmp_space_used 0
drop table t1,t2;
drop user foo;