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