Commit a821ef76 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-11802 innodb.innodb_bug14676111 fails on buildbot

The test was unnecessarily depending on InnoDB purge, which can
sometimes fail to proceed.

Let us rewrite the test to use BEGIN;INSERT;ROLLBACK to cause the
immediate removal of the desired records.
parent 577915de
drop table if exists t1; set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
CREATE TABLE t1 (a int not null primary key) engine=InnoDB; CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
set global innodb_limit_optimistic_insert_debug = 2; set global innodb_limit_optimistic_insert_debug = 2;
insert into t1 values (1); insert into t1 values (1);
begin;
insert into t1 values (5); insert into t1 values (5);
begin;
insert into t1 values (4); insert into t1 values (4);
insert into t1 values (3); insert into t1 values (3);
begin;
insert into t1 values (2); insert into t1 values (2);
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
...@@ -12,14 +15,14 @@ test.t1 analyze status OK ...@@ -12,14 +15,14 @@ test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384 DATA_LENGTH / 16384
10.0000 10.0000
delete from t1 where a=4; rollback;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384 DATA_LENGTH / 16384
8.0000 8.0000
delete from t1 where a=5; rollback;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
...@@ -27,23 +30,25 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = ' ...@@ -27,23 +30,25 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '
DATA_LENGTH / 16384 DATA_LENGTH / 16384
5.0000 5.0000
set global innodb_limit_optimistic_insert_debug = 10000; set global innodb_limit_optimistic_insert_debug = 10000;
delete from t1 where a=2; rollback;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384 DATA_LENGTH / 16384
3.0000 3.0000
begin;
insert into t1 values (2); insert into t1 values (2);
delete from t1 where a=2; rollback;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384 DATA_LENGTH / 16384
2.0000 2.0000
begin;
insert into t1 values (2); insert into t1 values (2);
delete from t1 where a=2; rollback;
analyze table t1; analyze table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 analyze status OK test.t1 analyze status OK
...@@ -51,3 +56,4 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = ' ...@@ -51,3 +56,4 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '
DATA_LENGTH / 16384 DATA_LENGTH / 16384
1.0000 1.0000
drop table t1; drop table t1;
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
...@@ -2,51 +2,40 @@ ...@@ -2,51 +2,40 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_debug.inc -- source include/have_debug.inc
-- source include/count_sessions.inc
# Note that this test needs to be able to manipulate how/when purge is done
# using @@innodb_limit_optimistic_insert_debug. This does not work with
# background purge threads, so we disabled them in the -master.opt (they are
# off by default in normal 5.5 innodb but on by default in xtradb)
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
{
--skip Test requires InnoDB built with UNIV_DEBUG definition.
}
--disable_query_log
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
--enable_query_log
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 (a int not null primary key) engine=InnoDB; CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
let $wait_condition=
SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';
# #
# make 4 leveled straight tree # make 4 leveled straight tree
# #
set global innodb_limit_optimistic_insert_debug = 2; set global innodb_limit_optimistic_insert_debug = 2;
insert into t1 values (1); insert into t1 values (1);
--connect (con5,localhost,root)
begin;
insert into t1 values (5); insert into t1 values (5);
#current tree form #current tree form
# (1, 5) # (1, 5)
--connect (con4,localhost,root)
begin;
insert into t1 values (4); insert into t1 values (4);
#records in a page is limited to 2 artificially. root rise occurs #records in a page is limited to 2 artificially. root rise occurs
#current tree form #current tree form
# (1, 5) # (1, 5)
#(1, 4) (5) #(1, 4) (5)
--connection default
insert into t1 values (3); insert into t1 values (3);
#current tree form #current tree form
# (1, 5) # (1, 5)
# (1, 4) (5) # (1, 4) (5)
#(1, 3) (4) (5) #(1, 3) (4) (5)
--connect (con2,localhost,root)
begin;
insert into t1 values (2); insert into t1 values (2);
#current tree form #current tree form
# (1, 5) # (1, 5)
...@@ -54,11 +43,15 @@ insert into t1 values (2); ...@@ -54,11 +43,15 @@ insert into t1 values (2);
# (1, 3) (4) (5) # (1, 3) (4) (5)
#(1, 2) (3) (4) (5) #(1, 2) (3) (4) (5)
--connection default
analyze table t1; analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
delete from t1 where a=4; --connection con4
--source include/wait_condition.inc rollback;
--disconnect con4
--connection default
#deleting 1 record of 2 records don't cause merge artificially. #deleting 1 record of 2 records don't cause merge artificially.
#current tree form #current tree form
# (1, 5) # (1, 5)
...@@ -69,8 +62,11 @@ delete from t1 where a=4; ...@@ -69,8 +62,11 @@ delete from t1 where a=4;
analyze table t1; analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
delete from t1 where a=5; --connection con5
--source include/wait_condition.inc rollback;
--disconnect con5
--connection default
#deleting 1 record of 2 records don't cause merge artificially. #deleting 1 record of 2 records don't cause merge artificially.
#current tree form #current tree form
# (1) # (1)
...@@ -87,8 +83,11 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = ' ...@@ -87,8 +83,11 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '
#disable the artificial limitation of records in a page #disable the artificial limitation of records in a page
set global innodb_limit_optimistic_insert_debug = 10000; set global innodb_limit_optimistic_insert_debug = 10000;
delete from t1 where a=2; --connection con2
--source include/wait_condition.inc rollback;
--disconnect con2
--connection default
#merge page occurs. and lift up occurs. #merge page occurs. and lift up occurs.
#current tree form #current tree form
# (1) # (1)
...@@ -98,14 +97,14 @@ delete from t1 where a=2; ...@@ -98,14 +97,14 @@ delete from t1 where a=2;
analyze table t1; analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
begin;
insert into t1 values (2); insert into t1 values (2);
#current tree form #current tree form
# (1) # (1)
# (1) <- lift up this level next, because it is not root # (1) <- lift up this level next, because it is not root
# (1, 2, 3) # (1, 2, 3)
rollback;
delete from t1 where a=2;
--source include/wait_condition.inc
#current tree form #current tree form
# (1) # (1)
# (1, 3) # (1, 3)
...@@ -113,13 +112,12 @@ delete from t1 where a=2; ...@@ -113,13 +112,12 @@ delete from t1 where a=2;
analyze table t1; analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1'; select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
begin;
insert into t1 values (2); insert into t1 values (2);
#current tree form #current tree form
# (1) # (1)
# (1, 2, 3) <- lift up this level next, because the father is root # (1, 2, 3) <- lift up this level next, because the father is root
rollback;
delete from t1 where a=2;
--source include/wait_condition.inc
#current tree form #current tree form
# (1, 3) # (1, 3)
...@@ -128,6 +126,5 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = ' ...@@ -128,6 +126,5 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '
drop table t1; drop table t1;
--disable_query_log
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
--enable_query_log -- source include/wait_until_count_sessions.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment