mariadb/mysql-test/suite/galera/t/tmp_space_usage.test
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

33 lines
803 B
Text

--source include/galera_cluster.inc
--source include/have_sequence.inc
--source include/have_log_bin.inc
--source include/have_binlog_format_row.inc
--echo #
--echo # MDEV-37808 "Local temporary space limit reached" on not so rare
--echo # occasions
--echo #
--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%";
change_user foo;
use test;
select count(*) from t1;
show status like "%tmp_space%";
drop table t1,t2;
change_user root;
drop user foo;