mariadb/mysql-test/suite/innodb/t/mem_pressure.test
Kristian Nielsen abc46259c6 MDEV-34753 memory pressure - erroneous termination condition
Fix race condition in test case by waiting for the expected state to occur.

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
2024-10-19 17:20:27 +11:00

55 lines
1.8 KiB
Text

--source include/have_debug.inc
--source include/have_cgroupv2.inc
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
--echo #
--echo # MDEV-24670 avoid OOM by linux kernel co-operative memory management
--echo #
set @save_dbug=@@debug_dbug;
set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug;
# Wait for the undo logs to be empty from previous tests.
# This is not an actual parameter, so there is no need to restore it.
set GLOBAL innodb_max_purge_lag_wait=0;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL innodb_limit_optimistic_insert_debug=2;
SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR
INSERT INTO t1 SELECT * FROM seq_1_to_1000;
SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit;
DROP TABLE t1;
--disable_cursor_protocol
SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
--enable_cursor_protocol
set debug_dbug="d,trigger_garbage_collection";
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
# either a fail or the pressure event
let SEARCH_PATTERN= [Mm]emory pressure.*;
--source include/search_pattern_in_file.inc
# The garbage collection happens asynchronously after trigger, in a background
# thread. So wait for it to happen to avoid sporadic failure.
let $wait_condition=
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
--source include/wait_condition.inc
eval $wait_condition;
let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*;
let SEARCH_WAIT= FOUND;
--source include/search_pattern_in_file.inc
set debug_dbug=@save_dbug;
--echo # End of 10.11 tests