polardbxengine/mysql-test/suite/innodb/t/innodb_cats_debug.test

107 lines
2.9 KiB
Plaintext

--source include/have_debug.inc
--source include/have_debug_sync.inc
--echo #
--echo # Bug #91959 UBSAN: signed integer overflow in lock_update_trx_age
--echo #
CREATE TABLE t1 (
id INT PRIMARY KEY
) Engine=InnoDB;
# Save the original settings, to be restored at the end of test
SET @innodb_lock_wait_timeout_saved = @@global.innodb_lock_wait_timeout;
# Make sure that transactions will not finish prematurely
SET @@global.innodb_lock_wait_timeout = 100000;
--source suite/innodb/include/force_cats.inc
# We will need many connections, to create a graph,
# in which there are N layers, and on each layer there are
# two transactions
--let $NUMBER_OF_LAYERS = 33
--let $ONE = 1
--expr $NUMBER_OF_CONNECTIONS = $NUMBER_OF_LAYERS << $ONE
# transactions at layer $layer will hold a granted S locks
# on row number $layer, and will wait for an exclusive lock
# on $layer + 1
--let $layer = 0
while($layer < $NUMBER_OF_LAYERS)
{
--eval INSERT INTO t1 (id) VALUES ($layer)
--inc $layer
}
--let $connection_number = 0
while($connection_number < $NUMBER_OF_CONNECTIONS)
{
--let $connection_name = connection$connection_number
--expr $layer = $connection_number >> $ONE
--echo # establishing connection $connection_name on layer $layer and acquire S lock on $layer
--connect ($connection_name, localhost, root,,)
BEGIN;
--eval SELECT * FROM t1 WHERE id = $layer FOR SHARE
--inc $connection_number
}
--let $connection_number = 0
while($connection_number < $NUMBER_OF_CONNECTIONS)
{
--expr $layer = $connection_number >> $ONE
--expr $next_layer = $layer + $ONE
--let $connection_name = connection$connection_number
if($next_layer < $NUMBER_OF_LAYERS)
{
--echo # connection_name on layer $layer tries to acquire X lock on $next_layer
--connection $connection_name
--eval SET DEBUG_SYNC = 'lock_wait_will_wait SIGNAL $connection_name'
--send_eval SELECT * FROM t1 WHERE id = $next_layer FOR UPDATE;ROLLBACK
--connection default
--eval SET DEBUG_SYNC = 'now WAIT_FOR $connection_name'
}
--inc $connection_number
}
# Disconnect all clients
--expr $connection_number = $NUMBER_OF_CONNECTIONS - $ONE
while($connection_number >= 0)
{
--expr $layer = $connection_number >> $ONE
--expr $next_layer = $layer + $ONE
--let $connection_name = connection$connection_number
--connection $connection_name
--echo # cleaning up connection $connection_name
if($next_layer < $NUMBER_OF_LAYERS)
{
--reap
}
ROLLBACK;
--disconnect $connection_name
--dec $connection_number
}
--source suite/innodb/include/discourage_cats.inc
--connection default
# Clean up tables
DROP TABLE t1;
# Restore saved state
SET @@global.innodb_lock_wait_timeout = @innodb_lock_wait_timeout_saved;
--echo #
--echo # End of Bug #91959
--echo #