1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-26 11:49:09 +03:00
mariadb/mysql-test/suite/innodb/t/innodb_row_lock_time_ms.test
Vlad Lesin 090a84366a MDEV-29311 Server Status Innodb_row_lock_time% is reported in seconds
Before MDEV-24671, the wait time was derived from my_interval_timer() /
1000 (nanoseconds converted to microseconds, and not microseconds to
milliseconds like I must have assumed). The lock_sys.wait_time and
lock_sys.wait_time_max are already in milliseconds; we should not divide
them by 1000.

In MDEV-24738 the millisecond counts lock_sys.wait_time and
lock_sys.wait_time_max were changed to a 32-bit type. That would
overflow in 49.7 days. Keep using a 64-bit type for those millisecond
counters.

Reviewed by: Marko Mäkelä
2023-07-10 12:42:46 +03:00

43 lines
1.2 KiB
Plaintext

--source include/have_innodb.inc
--source include/count_sessions.inc
CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES (1);
SET GLOBAL innodb_monitor_reset = "module_innodb";
BEGIN;
SELECT * FROM t FOR UPDATE;
--connect(con1,localhost,root,,)
SET innodb_lock_wait_timeout = 1;
--error ER_LOCK_WAIT_TIMEOUT
SELECT * FROM t FOR UPDATE;
--disconnect con1
--connection default
COMMIT;
SELECT variable_value > 100 FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time';
SELECT variable_value > 100 FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
SELECT variable_value > 100 FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="lock_row_lock_time";
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="lock_row_lock_time_max";
SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS
WHERE NAME="lock_row_lock_time_avg";
DROP TABLE t;
--disable_warnings
SET GLOBAL innodb_monitor_reset=default;
--enable_warnings
--source include/wait_until_count_sessions.inc