Skip to content

Commit 7b96c9b

Browse files
ssorumgarddahlerlend
authored andcommitted
Bug#29917793: REJECT UPGRADE 8.0.14-16 -> 8.0.17 FOR LCTN=1 AND PARTITIONED TABLES
If we are on a case sensitive file system with lower_case_table_names == 1, then upgrade from 8.0.14, 8.0.15 and 8.0.16 should be rejected if we have partitioned tables in the database, unless the command line option '--upgrade=force' is submitted. Change-Id: Ia805e94efbaf98ad981dfb08c676817b22ace0f8
1 parent 2d82d6c commit 7b96c9b

File tree

11 files changed

+313
-0
lines changed

11 files changed

+313
-0
lines changed

mysql-test/r/dd_upgrade_ci.result

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
########################################################################
2+
# This test scripts covers meta data related aspects of upgrade
3+
# after 8.0. For upgrade from 5.7 to 8.0, see dd_upgrade_test.
4+
########################################################################
5+
#
6+
# Bug#29917793: REJECT UPGRADE 8.0.14-16 -> 8.0.17 FOR LCTN=1 AND PARTITIONED TABLES
7+
#
8+
# This is the test case for case insensitive file systems. A corresponding test case
9+
# for case sensitive file systems can be found in dd_upgrade_cs.test.
10+
#
11+
# Test with lctn=1 and no partitioned tables. Upgrade should succeed.
12+
# Set different path for --datadir and check that it exists.
13+
# Upgrade the server.
14+
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG --lower_case_table_names=1
15+
# Stop the server and do cleanup.
16+
# Test with lctn=1 and partitioned tables. Upgrade should succeed since we are on a
17+
# case insensitive file system.
18+
# Set different path for --datadir and check that it exists.
19+
# Upgrade the server.
20+
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG --lower_case_table_names=1
21+
# Table rebuild will succeed.
22+
ALTER TABLE test.t ENGINE = InnoDB;
23+
# Stop the server and do cleanup.
24+
# Restart the server with default options.
25+
# restart:

mysql-test/r/dd_upgrade_cs.result

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,50 @@ x$schema_flattened_keys VIEW
115115
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG --autocommit=0 --completion_type=chain --upgrade=force
116116
# Stop the server and do cleanup.
117117
# Remove copied files
118+
#
119+
# Bug#29917793: REJECT UPGRADE 8.0.14-16 -> 8.0.17 FOR LCTN=1 AND PARTITIONED TABLES
120+
#
121+
# This is the test case for case sensitive file systems. A corresponding test case
122+
# for case insensitive file systems can be found in dd_upgrade_ci.test.
123+
#
124+
# Test with lctn=1 and no partitioned tables. Upgrade should succeed.
125+
# Set different path for --datadir and check that it exists.
126+
# Upgrade the server.
127+
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG --lower_case_table_names=1
128+
# Stop the server and do cleanup.
129+
# Test with lctn=1 and partitioned tables. Upgrade should be rejected unless submitting --upgrade=FORCE.
130+
# Set different path for --datadir and check that it exists.
131+
# Upgrading the server should be rejected.
132+
Pattern "with partitioned tables and lower_case_table_names == 1" found
133+
# Retry upgrading the server.
134+
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG --lower_case_table_names=1 --upgrade=force
135+
# Table rebuild will fail.
136+
ALTER TABLE test.t ENGINE = InnoDB;
137+
ERROR HY000: Got error 44 - 'InnoDB error' from storage engine
138+
# After RENAME, table rebuild will succeed.
139+
RENAME TABLE test.t TO test.t_new;
140+
RENAME TABLE test.t_new TO test.t;
141+
ALTER TABLE test.t ENGINE = InnoDB;
142+
SHOW CREATE TABLE test.t;
143+
Table Create Table
144+
t CREATE TABLE `t` (
145+
`a` int(11) DEFAULT NULL
146+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
147+
/*!50100 PARTITION BY RANGE (`a`)
148+
(PARTITION p0 VALUES LESS THAN (-1) ENGINE = InnoDB,
149+
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
150+
# Stop the server and do cleanup.
151+
# Test with lctn=0 and no partitioned tables. Upgrade should succeed.
152+
# Set different path for --datadir and check that it exists.
153+
# Upgrade the server.
154+
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG
155+
# Stop the server and do cleanup.
156+
# Test with lctn=0 and partitioned tables. Upgrade should succeed.
157+
# Set different path for --datadir and check that it exists.
158+
# Upgrade the server.
159+
# restart: --datadir=MYSQLD_DATADIR --log-error=MYSQLD_LOG
160+
# Table rebuild will succeed.
161+
ALTER TABLE test.t ENGINE = InnoDB;
162+
# Stop the server and do cleanup.
118163
# Restart the server with default options.
119164
# restart:
4.93 MB
Binary file not shown.
4.91 MB
Binary file not shown.
4.93 MB
Binary file not shown.
4.87 MB
Binary file not shown.

mysql-test/t/dd_upgrade_ci.test

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
--echo ########################################################################
2+
--echo # This test scripts covers meta data related aspects of upgrade
3+
--echo # after 8.0. For upgrade from 5.7 to 8.0, see dd_upgrade_test.
4+
--echo ########################################################################
5+
6+
--source include/have_case_insensitive_file_system.inc
7+
--source include/not_valgrind.inc
8+
--source include/shutdown_mysqld.inc
9+
10+
--echo #
11+
--echo # Bug#29917793: REJECT UPGRADE 8.0.14-16 -> 8.0.17 FOR LCTN=1 AND PARTITIONED TABLES
12+
--echo #
13+
--echo # This is the test case for case insensitive file systems. A corresponding test case
14+
--echo # for case sensitive file systems can be found in dd_upgrade_cs.test.
15+
--echo #
16+
17+
--echo # Test with lctn=1 and no partitioned tables. Upgrade should succeed.
18+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_0.log
19+
--let $name_base = data_80016_lctn1_lin_nopart
20+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/$name_base.zip $MYSQL_TMP_DIR/$name_base.zip
21+
--file_exists $MYSQL_TMP_DIR/$name_base.zip
22+
--exec unzip -qo $MYSQL_TMP_DIR/$name_base.zip -d $MYSQL_TMP_DIR
23+
24+
--echo # Set different path for --datadir and check that it exists.
25+
--let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/$name_base
26+
--file_exists $MYSQLD_DATADIR
27+
28+
--echo # Upgrade the server.
29+
--let $wait_counter= 3000
30+
--let $restart_parameters= restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_LOG --lower_case_table_names=1
31+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
32+
--source include/start_mysqld.inc
33+
34+
--echo # Stop the server and do cleanup.
35+
--source include/shutdown_mysqld.inc
36+
--remove_file $MYSQL_TMP_DIR/$name_base.zip
37+
--force-rmdir $MYSQLD_DATADIR
38+
39+
--echo # Test with lctn=1 and partitioned tables. Upgrade should succeed since we are on a
40+
--echo # case insensitive file system.
41+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_1.log
42+
--let $name_base = data_80016_lctn1_lin_part
43+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/$name_base.zip $MYSQL_TMP_DIR/$name_base.zip
44+
--file_exists $MYSQL_TMP_DIR/$name_base.zip
45+
--exec unzip -qo $MYSQL_TMP_DIR/$name_base.zip -d $MYSQL_TMP_DIR
46+
47+
--echo # Set different path for --datadir and check that it exists.
48+
--let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/$name_base
49+
--file_exists $MYSQLD_DATADIR
50+
51+
--echo # Upgrade the server.
52+
--let $wait_counter= 3000
53+
--let $restart_parameters= restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_LOG --lower_case_table_names=1
54+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
55+
--source include/start_mysqld.inc
56+
57+
--echo # Table rebuild will succeed.
58+
ALTER TABLE test.t ENGINE = InnoDB;
59+
60+
--echo # Stop the server and do cleanup.
61+
--source include/shutdown_mysqld.inc
62+
--remove_file $MYSQL_TMP_DIR/$name_base.zip
63+
--force-rmdir $MYSQLD_DATADIR
64+
65+
66+
--echo # Restart the server with default options.
67+
--let $restart_parameters= restart:
68+
--source include/start_mysqld.inc

mysql-test/t/dd_upgrade_cs.test

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,129 @@ SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES
207207
--echo # Remove copied files
208208
--remove_file $MYSQL_TMP_DIR/data_80015.zip
209209
--force-rmdir $MYSQLD_DATADIR
210+
211+
212+
--echo #
213+
--echo # Bug#29917793: REJECT UPGRADE 8.0.14-16 -> 8.0.17 FOR LCTN=1 AND PARTITIONED TABLES
214+
--echo #
215+
--echo # This is the test case for case sensitive file systems. A corresponding test case
216+
--echo # for case insensitive file systems can be found in dd_upgrade_ci.test.
217+
--echo #
218+
219+
--echo # Test with lctn=1 and no partitioned tables. Upgrade should succeed.
220+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_5.log
221+
--let $name_base = data_80016_lctn1_lin_nopart
222+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/$name_base.zip $MYSQL_TMP_DIR/$name_base.zip
223+
--file_exists $MYSQL_TMP_DIR/$name_base.zip
224+
--exec unzip -qo $MYSQL_TMP_DIR/$name_base.zip -d $MYSQL_TMP_DIR
225+
226+
--echo # Set different path for --datadir and check that it exists.
227+
--let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/$name_base
228+
--file_exists $MYSQLD_DATADIR
229+
230+
--echo # Upgrade the server.
231+
--let $wait_counter= 3000
232+
--let $restart_parameters= restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_LOG --lower_case_table_names=1
233+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
234+
--source include/start_mysqld.inc
235+
236+
--echo # Stop the server and do cleanup.
237+
--source include/shutdown_mysqld.inc
238+
--remove_file $MYSQL_TMP_DIR/$name_base.zip
239+
--force-rmdir $MYSQLD_DATADIR
240+
241+
242+
--echo # Test with lctn=1 and partitioned tables. Upgrade should be rejected unless submitting --upgrade=FORCE.
243+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_6.log
244+
--let $name_base = data_80016_lctn1_lin_part
245+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/$name_base.zip $MYSQL_TMP_DIR/$name_base.zip
246+
--file_exists $MYSQL_TMP_DIR/$name_base.zip
247+
--exec unzip -qo $MYSQL_TMP_DIR/$name_base.zip -d $MYSQL_TMP_DIR
248+
249+
--echo # Set different path for --datadir and check that it exists.
250+
--let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/$name_base
251+
--file_exists $MYSQLD_DATADIR
252+
253+
--echo # Upgrading the server should be rejected.
254+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
255+
--error 1
256+
--exec $MYSQLD --no-defaults --secure-file-priv="" --log-error=$MYSQLD_LOG --datadir=$MYSQLD_DATADIR --lower_case_table_names=1
257+
258+
--let SEARCH_FILE = $MYSQLD_LOG
259+
--let SEARCH_PATTERN = with partitioned tables and lower_case_table_names == 1
260+
--source include/search_pattern.inc
261+
262+
--echo # Retry upgrading the server.
263+
--let $wait_counter= 3000
264+
--let $restart_parameters= restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_LOG --lower_case_table_names=1 --upgrade=force
265+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
266+
--source include/start_mysqld.inc
267+
268+
--echo # Table rebuild will fail.
269+
--error ER_GET_ERRNO
270+
ALTER TABLE test.t ENGINE = InnoDB;
271+
272+
--echo # After RENAME, table rebuild will succeed.
273+
RENAME TABLE test.t TO test.t_new;
274+
RENAME TABLE test.t_new TO test.t;
275+
ALTER TABLE test.t ENGINE = InnoDB;
276+
SHOW CREATE TABLE test.t;
277+
278+
--echo # Stop the server and do cleanup.
279+
--source include/shutdown_mysqld.inc
280+
--remove_file $MYSQL_TMP_DIR/$name_base.zip
281+
--force-rmdir $MYSQLD_DATADIR
282+
283+
284+
--echo # Test with lctn=0 and no partitioned tables. Upgrade should succeed.
285+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_7.log
286+
--let $name_base = data_80016_lctn0_lin_nopart
287+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/$name_base.zip $MYSQL_TMP_DIR/$name_base.zip
288+
--file_exists $MYSQL_TMP_DIR/$name_base.zip
289+
--exec unzip -qo $MYSQL_TMP_DIR/$name_base.zip -d $MYSQL_TMP_DIR
290+
291+
--echo # Set different path for --datadir and check that it exists.
292+
--let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/$name_base
293+
--file_exists $MYSQLD_DATADIR
294+
295+
--echo # Upgrade the server.
296+
--let $wait_counter= 3000
297+
--let $restart_parameters= restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_LOG
298+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
299+
--source include/start_mysqld.inc
300+
301+
--echo # Stop the server and do cleanup.
302+
--source include/shutdown_mysqld.inc
303+
--remove_file $MYSQL_TMP_DIR/$name_base.zip
304+
--force-rmdir $MYSQLD_DATADIR
305+
306+
307+
--echo # Test with lctn=0 and partitioned tables. Upgrade should succeed.
308+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/save_dd_upgrade_8.log
309+
--let $name_base = data_80016_lctn0_lin_part
310+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/$name_base.zip $MYSQL_TMP_DIR/$name_base.zip
311+
--file_exists $MYSQL_TMP_DIR/$name_base.zip
312+
--exec unzip -qo $MYSQL_TMP_DIR/$name_base.zip -d $MYSQL_TMP_DIR
313+
314+
--echo # Set different path for --datadir and check that it exists.
315+
--let $MYSQLD_DATADIR = $MYSQL_TMP_DIR/$name_base
316+
--file_exists $MYSQLD_DATADIR
317+
318+
--echo # Upgrade the server.
319+
--let $wait_counter= 3000
320+
--let $restart_parameters= restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_LOG
321+
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLD_LOG MYSQLD_LOG
322+
--source include/start_mysqld.inc
323+
324+
--echo # Table rebuild will succeed.
325+
ALTER TABLE test.t ENGINE = InnoDB;
326+
327+
--echo # Stop the server and do cleanup.
328+
--source include/shutdown_mysqld.inc
329+
--remove_file $MYSQL_TMP_DIR/$name_base.zip
330+
--force-rmdir $MYSQLD_DATADIR
331+
332+
210333
--echo # Restart the server with default options.
211334
--let $restart_parameters= restart:
212335
--source include/start_mysqld.inc

share/errmsg-utf8.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19625,6 +19625,9 @@ ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE
1962519625
ER_LOG_CANNOT_WRITE_EXTENDED
1962619626
eng "Failed to write to %s: %s (%s)"
1962719627

19628+
ER_UPGRADE_WITH_PARTITIONED_TABLES_REJECTED
19629+
eng "Upgrading from server version %d with partitioned tables and lower_case_table_names == 1 on a case sensitive file system may cause issues, and is therefore prohibited. To upgrade anyway, restart the new server version with the command line option 'upgrade=FORCE'. When upgrade is completed, please execute 'RENAME TABLE <part_table_name> TO <new_table_name>; RENAME TABLE <new_table_name> TO <part_table_name>;' for each of the partitioned tables. Please see the documentation for further information."
19630+
1962819631
# DO NOT add server-to-client messages here!
1962919632
# This range is for messages intended for the error log only.
1963019633
# See the FAQ at the end of the file for further information.

sql/dd/impl/bootstrap/bootstrap_ctx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ static std::set<uint> supported_dd_versions = {
7676
static constexpr uint SERVER_VERSION_50700 = 50700;
7777
static constexpr uint SERVER_VERSION_80011 = 80011;
7878
static constexpr uint SERVER_VERSION_80013 = 80013;
79+
static constexpr uint SERVER_VERSION_80014 = 80014;
80+
static constexpr uint SERVER_VERSION_80015 = 80015;
81+
static constexpr uint SERVER_VERSION_80016 = 80016;
7982

8083
/*
8184
Set of unsupported server version labels. An unsupported server version is a

0 commit comments

Comments
 (0)