From feca3924b87c708f23722468278bed560ca54d70 Mon Sep 17 00:00:00 2001 From: Varun Deep Saini Date: Tue, 10 Mar 2026 01:42:57 +0530 Subject: [PATCH] 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 --- mysql-test/main/tmp_space_usage.result | 2 ++ mysql-test/main/tmp_space_usage.test | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/mysql-test/main/tmp_space_usage.result b/mysql-test/main/tmp_space_usage.result index 32b7b8d0a58b6..ab493fc312d04 100644 --- a/mysql-test/main/tmp_space_usage.result +++ b/mysql-test/main/tmp_space_usage.result @@ -69,6 +69,8 @@ create table t1 (a int primary key, v varchar(256), c int default(0)) engine=inn create table t2 (a int primary key, v varchar(256), c int default(0)) engine=innodb; begin; insert into t1 (a,v) select seq, repeat(char(64+mod(seq,32)),mod(seq,254)+1) from seq_1_to_3000; +set @@tmp_memory_table_size=1024*1024; +set @@tmp_memory_table_size=0; connection c1; # information_schema.process_list.tmp_space_used == status.tmp_space_used insert into t2 (a,v) select seq, repeat(char(64+mod(seq,32)),mod(seq,254)+1) from seq_1_to_3000; diff --git a/mysql-test/main/tmp_space_usage.test b/mysql-test/main/tmp_space_usage.test index 23a678270fac4..d594bd8c5bb3e 100644 --- a/mysql-test/main/tmp_space_usage.test +++ b/mysql-test/main/tmp_space_usage.test @@ -102,7 +102,11 @@ begin; insert into t1 (a,v) select seq, repeat(char(64+mod(seq,32)),mod(seq,254)+1) from seq_1_to_3000; let $id=`select connection_id()`; +# Use memory for the session_status query's internal temp table so it +# does not change tmp_space_used as a side effect of reading it. +set @@tmp_memory_table_size=1024*1024; let $tmp_usage1=`select variable_value from information_schema.session_status where variable_name="tmp_space_used"`; +set @@tmp_memory_table_size=0; connection c1; --disable_query_log