summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-03-24 18:01:56 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-24 18:01:56 +0200
commita821ef76057f17a9532f525d2858bb1d31c0a56d (patch)
treebd1910d386c791e55f684032caf37c92c2e84812
parent577915def8d39223aa23a06f898e11e82e72365a (diff)
downloadmariadb-git-a821ef76057f17a9532f525d2858bb1d31c0a56d.tar.gz
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.
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14676111.result18
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14676111-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14676111.test61
3 files changed, 41 insertions, 39 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result
index ebecd1d00cb..ca4a7fd7e4a 100644
--- a/mysql-test/suite/innodb/r/innodb_bug14676111.result
+++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result
@@ -1,10 +1,13 @@
-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
@@ -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';
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
@@ -27,23 +30,25 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '
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
@@ -51,3 +56,4 @@ select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = '
DATA_LENGTH / 16384
1.0000
drop table t1;
+set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111-master.opt b/mysql-test/suite/innodb/t/innodb_bug14676111-master.opt
deleted file mode 100644
index e16b9b0b895..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug14676111-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb-purge-threads=0
diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test
index 41862b8105e..10eb6a3b13c 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14676111.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test
@@ -2,51 +2,40 @@
-- 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)
@@ -54,11 +43,15 @@ insert into t1 values (2);
# (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,14 +97,14 @@ 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)
@@ -113,13 +112,12 @@ 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, 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