Skip to content

Commit e506bef

Browse files
committed
MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
* Versioning tests support Closes #1043
1 parent 43623f0 commit e506bef

File tree

8 files changed

+74
-9
lines changed

8 files changed

+74
-9
lines changed

mysql-test/suite/versioning/common.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ if ($MTR_COMBINATION_MYISAM)
4646
{
4747
--let $MTR_COMBINATION_TIMESTAMP= 1
4848
}
49+
if ($MTR_COMBINATION_HEAP)
50+
{
51+
--let $MTR_COMBINATION_TIMESTAMP= 1
52+
}
4953
if ($MTR_COMBINATION_TRX_ID)
5054
{
5155
let $sys_datatype_expl= bigint(20) unsigned;

mysql-test/suite/versioning/engines.combinations

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ default-storage-engine=innodb
66

77
[myisam]
88
default-storage-engine=myisam
9+
10+
[heap]
11+
default-storage-engine=memory

mysql-test/suite/versioning/r/create.result

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ t1 CREATE TABLE `t1` (
1313
`Sys_end` SYS_DATATYPE GENERATED ALWAYS AS ROW END INVISIBLE COMMENT 'end',
1414
PERIOD FOR SYSTEM_TIME (`Sys_start`, `Sys_end`)
1515
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
16-
select table_catalog,table_schema,table_name,table_type,version,table_rows,avg_row_length,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1';
16+
select table_catalog,table_schema,table_name,table_type,version,table_rows,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1';
1717
table_catalog def
1818
table_schema test
1919
table_name t1
2020
table_type SYSTEM VERSIONED
2121
version 10
2222
table_rows 0
23-
avg_row_length 0
2423
data_free 0
2524
auto_increment NULL
2625
check_time NULL

mysql-test/suite/versioning/r/rpl.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ Table Create Table
128128
t1 CREATE TABLE `t1` (
129129
`a` int(11) DEFAULT NULL,
130130
`b` int(11) DEFAULT NULL
131-
) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
131+
) ENGINE=ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
132132
## Case 2: ERROR on the master, it'll fail on the master, the slave won't see it
133133
connection master;
134134
set system_versioning_alter_history= ERROR;
@@ -140,7 +140,7 @@ Table Create Table
140140
t1 CREATE TABLE `t1` (
141141
`a` int(11) DEFAULT NULL,
142142
`b` int(11) DEFAULT NULL
143-
) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
143+
) ENGINE=ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
144144
## Case 3: table is not versioned on the master, ALTER will work on the slave
145145
connection master;
146146
create or replace table t1 (a int);
@@ -154,7 +154,7 @@ Table Create Table
154154
t1 CREATE TABLE `t1` (
155155
`a` int(11) DEFAULT NULL,
156156
`b` int(11) DEFAULT NULL
157-
) ENGINE=INNODB_OR_MYISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
157+
) ENGINE=ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
158158
connection master;
159159
drop table t1, t2;
160160
create table t1 (i int) with system versioning partition by system_time limit 8 ( partition p1 history, partition p2 history, partition pn current );
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
3+
#
4+
create or replace table t1 (a int);
5+
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8);
6+
insert into t1 select * from t1;
7+
insert into t1 select * from t1;
8+
insert into t1 select * from t1;
9+
insert into t1 select * from t1;
10+
insert into t1 select * from t1;
11+
insert into t1 select * from t1;
12+
insert into t1 select * from t1;
13+
insert into t1 select * from t1;
14+
insert into t1 select * from t1;
15+
connect con1,localhost,root,,test;
16+
alter table t1 add system versioning;
17+
connection default;
18+
update t1 set a= 7 where a = 3;
19+
update t1 set a= 2 where a = 7;
20+
update t1 set a= 5 where a = 2;
21+
update t1 set a= 1 where a = 5;
22+
update t1 set a= 8 where a = 1;
23+
update t1 set a= 4 where a = 8;
24+
update t1 set a= 6;
25+
drop table t1;

mysql-test/suite/versioning/t/create.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ eval create table t1 (
1515
--replace_result $default_engine DEFAULT_ENGINE $sys_datatype_expl SYS_DATATYPE
1616
show create table t1;
1717

18-
--query_vertical select table_catalog,table_schema,table_name,table_type,version,table_rows,avg_row_length,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1'
18+
--query_vertical select table_catalog,table_schema,table_name,table_type,version,table_rows,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1'
1919
--query_vertical select table_catalog,table_schema,table_name,column_name,ordinal_position,column_default,character_maximum_length,character_octet_length,character_set_name,collation_name,column_key,extra,column_comment,is_generated,generation_expression from information_schema.columns where table_name='t1'
2020

2121
--echo # Implicit fields test

mysql-test/suite/versioning/t/rpl.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ create or replace table t1 (a int) with system versioning;
9696
set system_versioning_alter_history= KEEP;
9797
alter table t1 add column b int;
9898
sync_slave_with_master;
99-
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM
99+
--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
100100
show create table t1;
101101

102102
--echo ## Case 2: ERROR on the master, it'll fail on the master, the slave won't see it
@@ -105,7 +105,7 @@ set system_versioning_alter_history= ERROR;
105105
--error ER_VERS_ALTER_NOT_ALLOWED
106106
alter table t1 drop column b;
107107
sync_slave_with_master;
108-
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM
108+
--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
109109
show create table t1;
110110

111111
--echo ## Case 3: table is not versioned on the master, ALTER will work on the slave
@@ -116,7 +116,7 @@ create or replace table t1 (a int) with system versioning;
116116
connection master;
117117
alter table t1 add column b int;
118118
sync_slave_with_master;
119-
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM
119+
--replace_result InnoDB ENGINE MyISAM ENGINE MEMORY ENGINE
120120
show create table t1;
121121

122122
connection master;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
source include/big_test.inc;
2+
source suite/versioning/engines.inc;
3+
source suite/versioning/common.inc;
4+
5+
--echo #
6+
--echo # MDEV-15458 Segfault in heap_scan() upon UPDATE after ADD SYSTEM VERSIONING
7+
--echo #
8+
create or replace table t1 (a int);
9+
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8);
10+
insert into t1 select * from t1;
11+
insert into t1 select * from t1;
12+
insert into t1 select * from t1;
13+
insert into t1 select * from t1;
14+
insert into t1 select * from t1;
15+
insert into t1 select * from t1;
16+
insert into t1 select * from t1;
17+
insert into t1 select * from t1;
18+
insert into t1 select * from t1;
19+
20+
--connect (con1,localhost,root,,test)
21+
alter table t1 add system versioning;
22+
23+
--connection default
24+
update t1 set a= 7 where a = 3;
25+
update t1 set a= 2 where a = 7;
26+
update t1 set a= 5 where a = 2;
27+
update t1 set a= 1 where a = 5;
28+
update t1 set a= 8 where a = 1;
29+
update t1 set a= 4 where a = 8;
30+
update t1 set a= 6;
31+
32+
drop table t1;
33+
34+
source suite/versioning/common_finish.inc;

0 commit comments

Comments
 (0)