diff options
Diffstat (limited to 'mysql-test/suite/innodb/r/innodb_bug84958.result')
-rw-r--r-- | mysql-test/suite/innodb/r/innodb_bug84958.result | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_bug84958.result b/mysql-test/suite/innodb/r/innodb_bug84958.result new file mode 100644 index 00000000..3375efb9 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_bug84958.result @@ -0,0 +1,87 @@ +# +# Bug #84958 InnoDB's MVCC has O(N^2) behaviors +# https://bugs.mysql.com/bug.php?id=84958 +# +# Set up the test with a procedure and a function. +# +CREATE PROCEDURE insert_n(start int, end int) +BEGIN +DECLARE i INT DEFAULT start; +WHILE i <= end do +INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = i; +SET i = i + 1; +END WHILE; +END~~ +CREATE FUNCTION num_pages_get() +RETURNS INT +BEGIN +DECLARE ret INT; +SELECT variable_value INTO ret +FROM information_schema.global_status +WHERE variable_name = 'innodb_buffer_pool_read_requests'; +RETURN ret; +END~~ +# +# Create a table with one record in it and start an RR transaction +# +CREATE TABLE t1 (a INT, b INT, c INT, PRIMARY KEY(a,b), KEY (b,c)) +ENGINE=InnoDB STATS_PERSISTENT=0; +InnoDB 0 transactions not purged +BEGIN; +SELECT * FROM t1; +a b c +# +# Create 100 newer record versions in con2 and con3 +# +connect con2, localhost, root,,; +connection con2; +BEGIN; +INSERT INTO t1 VALUES (1, 2, 3) ON DUPLICATE KEY UPDATE c = NULL; +CALL insert_n(1, 50);; +connect con3, localhost, root,,; +connection con3; +BEGIN; +CALL insert_n(51, 100);; +connection con2; +COMMIT; +connection con3; +INSERT INTO t1 VALUES (1, 2, 1) ON DUPLICATE KEY UPDATE c = NULL; +COMMIT; +connection default; +# +# Connect to default and record how many pages were accessed +# when selecting the record using the secondary key. +# +InnoDB 2 transactions not purged +SET @num_pages_1 = num_pages_get(); +SELECT * FROM t1 force index (b); +a b c +SET @num_pages_2= num_pages_get(); +SELECT IF(@num_pages_2 - @num_pages_1 < 5000, 'OK', @num_pages_2 - @num_pages_1) num_pages_diff; +num_pages_diff +OK +# +# Commit and show the final record. +# +SELECT * FROM t1; +a b c +SELECT * FROM t1 force index (b); +a b c +COMMIT; +SELECT * FROM t1 force index (b); +a b c +1 2 NULL +SELECT * FROM t1; +a b c +1 2 NULL +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +# +# Cleanup +# +disconnect con2; +disconnect con3; +DROP TABLE t1; +DROP PROCEDURE insert_n; +DROP FUNCTION num_pages_get; |