Skip to content
Permalink
Browse files

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.
  • Loading branch information...
dr-m committed Mar 24, 2017
1 parent 577915d commit a821ef76057f17a9532f525d2858bb1d31c0a56d
@@ -1,53 +1,59 @@
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;
set global innodb_limit_optimistic_insert_debug = 2;
insert into t1 values (1);
begin;
insert into t1 values (5);
begin;
insert into t1 values (4);
insert into t1 values (3);
begin;
insert into t1 values (2);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384
10.0000
delete from t1 where a=4;
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384
8.0000
delete from t1 where a=5;
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384
5.0000
set global innodb_limit_optimistic_insert_debug = 10000;
delete from t1 where a=2;
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384
3.0000
begin;
insert into t1 values (2);
delete from t1 where a=2;
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384
2.0000
begin;
insert into t1 values (2);
delete from t1 where a=2;
rollback;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
DATA_LENGTH / 16384
1.0000
drop table t1;
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;

This file was deleted.

@@ -2,63 +2,56 @@

-- source include/have_innodb.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;
--enable_query_log
--disable_warnings
drop table if exists t1;
--enable_warnings

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
#
set global innodb_limit_optimistic_insert_debug = 2;
insert into t1 values (1);
--connect (con5,localhost,root)
begin;
insert into t1 values (5);
#current tree form
# (1, 5)

--connect (con4,localhost,root)
begin;
insert into t1 values (4);
#records in a page is limited to 2 artificially. root rise occurs
#current tree form
# (1, 5)
#(1, 4) (5)

--connection default
insert into t1 values (3);
#current tree form
# (1, 5)
# (1, 4) (5)
#(1, 3) (4) (5)

--connect (con2,localhost,root)
begin;
insert into t1 values (2);
#current tree form
# (1, 5)
# (1, 4) (5)
# (1, 3) (4) (5)
#(1, 2) (3) (4) (5)

--connection default
analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';

delete from t1 where a=4;
--source include/wait_condition.inc
--connection con4
rollback;
--disconnect con4
--connection default

#deleting 1 record of 2 records don't cause merge artificially.
#current tree form
# (1, 5)
@@ -69,8 +62,11 @@ delete from t1 where a=4;
analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';

delete from t1 where a=5;
--source include/wait_condition.inc
--connection con5
rollback;
--disconnect con5
--connection default

#deleting 1 record of 2 records don't cause merge artificially.
#current tree form
# (1)
@@ -87,8 +83,11 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '

#disable the artificial limitation of records in a page
set global innodb_limit_optimistic_insert_debug = 10000;
delete from t1 where a=2;
--source include/wait_condition.inc
--connection con2
rollback;
--disconnect con2
--connection default

#merge page occurs. and lift up occurs.
#current tree form
# (1)
@@ -98,28 +97,27 @@ delete from t1 where a=2;
analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';

begin;
insert into t1 values (2);
#current tree form
# (1)
# (1) <- lift up this level next, because it is not root
# (1, 2, 3)
rollback;

delete from t1 where a=2;
--source include/wait_condition.inc
#current tree form
# (1)
# (1, 3)

analyze table t1;
select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';

begin;
insert into t1 values (2);
#current tree form
# (1)
# (1, 2, 3) <- lift up this level next, because the father is root

delete from t1 where a=2;
--source include/wait_condition.inc
rollback;
#current tree form
# (1, 3)

@@ -128,6 +126,5 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '

drop table t1;

--disable_query_log
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
--enable_query_log
-- source include/wait_until_count_sessions.inc

0 comments on commit a821ef7

Please sign in to comment.
You can’t perform that action at this time.