Skip to content

Commit feca392

Browse files
author
Varun Deep Saini
committed
MDEV-39013: Fix flaky main.tmp_space_usage test
Reading information_schema.session_status with tmp_memory_table_size=0 forces the query's internal temp table to disk, which changes tmp_space_used as a side effect of reading it. By the time connection c1 reads the value from processlist, it sees the inflated value. Fix by temporarily setting tmp_memory_table_size high before the session_status read, same pattern already used earlier in the test (lines 72-77) for the same reason. Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
1 parent d477356 commit feca392

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

mysql-test/main/tmp_space_usage.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ create table t1 (a int primary key, v varchar(256), c int default(0)) engine=inn
6969
create table t2 (a int primary key, v varchar(256), c int default(0)) engine=innodb;
7070
begin;
7171
insert into t1 (a,v) select seq, repeat(char(64+mod(seq,32)),mod(seq,254)+1) from seq_1_to_3000;
72+
set @@tmp_memory_table_size=1024*1024;
73+
set @@tmp_memory_table_size=0;
7274
connection c1;
7375
# information_schema.process_list.tmp_space_used == status.tmp_space_used
7476
insert into t2 (a,v) select seq, repeat(char(64+mod(seq,32)),mod(seq,254)+1) from seq_1_to_3000;

mysql-test/main/tmp_space_usage.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ begin;
102102
insert into t1 (a,v) select seq, repeat(char(64+mod(seq,32)),mod(seq,254)+1) from seq_1_to_3000;
103103

104104
let $id=`select connection_id()`;
105+
# Use memory for the session_status query's internal temp table so it
106+
# does not change tmp_space_used as a side effect of reading it.
107+
set @@tmp_memory_table_size=1024*1024;
105108
let $tmp_usage1=`select variable_value from information_schema.session_status where variable_name="tmp_space_used"`;
109+
set @@tmp_memory_table_size=0;
106110

107111
connection c1;
108112
--disable_query_log

0 commit comments

Comments
 (0)