1#
2# MDEV-11942 BLACKHOLE is no longer active in 10.1 by default, mysql_upgrade not handling the situation
3#
4source include/have_innodb.inc;
5source include/not_embedded.inc;
6
7if (!$HA_BLACKHOLE_SO) {
8  skip Need blackhole plugin;
9}
10if (!$HA_ARCHIVE_SO) {
11  skip Need Archive plugin;
12}
13
14source include/switch_to_mysql_user.inc;
15drop view mysql.user_bak;
16
17let $datadir= `select @@datadir`;
18
19install soname 'ha_blackhole';
20install soname 'ha_archive';
21
22vertical_results;
23create table t1 (a int) engine=blackhole;
24create table t2 (a int) engine=archive;
25select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
26select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
27
28flush tables;
29uninstall plugin blackhole;
30uninstall plugin archive;
31select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
32select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
33
34--echo # upgrade from 10.1 - engines aren't enabled
35--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
36exec $MYSQL_UPGRADE 2>&1;
37select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
38select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
39
40drop table mysql.global_priv;
41rename table mysql.global_priv_bak to mysql.global_priv;
42source include/switch_to_mysql_user.inc;
43drop view mysql.user_bak;
44
45# pretend it's an upgrade from 10.0
46alter table mysql.user drop column default_role, drop column max_statement_time;
47
48# but mysql_upgrade_info tells otherwise
49remove_file $datadir/mysql_upgrade_info;
50write_file $datadir/mysql_upgrade_info;
5110.1.10-MariaDB
52EOF
53
54--echo # still upgrade from 10.1
55--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
56exec $MYSQL_UPGRADE 2>&1;
57select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
58select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
59
60drop table mysql.global_priv;
61rename table mysql.global_priv_bak to mysql.global_priv;
62source include/switch_to_mysql_user.inc;
63drop view mysql.user_bak;
64
65alter table mysql.user drop column default_role, drop column max_statement_time;
66remove_file $datadir/mysql_upgrade_info;
67
68--echo # upgrade from 10.0 - engines are enabled
69--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB /
70exec $MYSQL_UPGRADE 2>&1;
71select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1';
72select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2';
73
74drop table t1, t2;
75
76remove_file $datadir/mysql_upgrade_info;
77uninstall plugin blackhole;
78uninstall plugin archive;
79
80drop table mysql.global_priv;
81rename table mysql.global_priv_bak to mysql.global_priv;
82