Debian Codegraph @

mysql-test/suite/innodb/t/alter_datadir_path_on_upgrade.test

raw
1 --source include/have_innodb_16k.inc
2
3 --echo #
4 --echo #Bug #33398681 Innodb ibd tablespace file is moved back from innodb_directories to datadir after ALTER TABLE
5 --echo #
6
7 # This test will check whether the ibd tablespace file is moved back in the upgrade scenario below or not
8
9 #Testing Upgrade scenario
10 --echo # Upgrade scenario
11 --echo # Part 1: Steps already executed in older version of mysqld i.e., 8.0.36 which does not contain the fix for Bug #33398681
12 --echo # 1a. Build 8.0.36 and create data_dir folder in it. Initialize mysqld in this data_dir folder. This will be the default datadir for 8.0.36
13 --echo # 1b. Start mysql client and create database test_upgsc and create tables t7a, t7b t7c in it
14 --echo # 1c. Shutdown the server and move t7a.ibd, t7b.ibd, t7c.ibd to new external directory d1 and delete database folder test_upgsc in default directory data_dir
15 --echo # 1d. Start and shutdown the server again to make ibd files get recognized as moved in 8.0.36
16 --echo # 1e. Zip this data_dir and new external dir d1 as new_innodbdir into MYSQL_TEST_DIR/std_data/data80036_with_externally_stored_tablespaces.zip
17 --echo # Part 2: Steps to be executed in the current version i.e., in this test
18 --echo # 2a. Copy the data80036_with_externally_stored_tablespaces.zip from MYSQL_TEST_DIR/std_data/ to MYSQL_TMP_DIR/test_Bug33398681/ as data8036.zip
19 --echo # 2b. Check that the zip file data8036.zip exists in working MYSQL_TMP_DIR/test_Bug33398681/ folder and unzip it in the same directory
20 --echo # 2c. Check that data_dir and new_innodbdir are existing in MYSQL_TMP_DIR/test_Bug33398681/ and list all the files
21 --echo # 2d. Set MYSQLD_NEW_DATADIR as MYSQL_TMP_DIR/test_Bug33398681/data_dir and EXTERNAL_DIR3 AS MYSQL_TMP_DIR/test_Bug33398681/new_innodbdir
22 --echo # 2e. Start the server with datadir=MYSQLD_NEW_DATADIR and innodb-directories=EXTERNAL_DIR3 options
23 --echo # 2f. Trigger Alter table force for t7a, t7b, t7c
24 --echo # 2g. Verify that the ibd files for t7a, t7b, t7c exist in EXTERNAL_DIR3
25
26 #Table t7a: Covers upgrade scenario where table is being created in old version without the fix for Bug33398681 and moved to new location, restarted once, upgraded to new version and triggered alter table force
27 #Table t7b: Covers upgrade scenario where table is being created in old version without the fix for Bug33398681 and moved to new location, restarted once, upgraded to new version and triggered alter table force algo=inplace
28 #Table t7c: Covers upgrade scenario where table is being created in old version without the fix for Bug33398681 and moved to new location, restarted once, upgraded to new version and triggered alter table force algo=copy;
29
30 --echo # Shutdown server
31 --source include/shutdown_mysqld.inc
32
33 --echo # Copy the zip directory of 8.0.36 from MYSQL_TEST_DIR/std_data/ to MYSQL_TMP_DIR/test_Bug33398681 working location.
34 --mkdir $MYSQL_TMP_DIR/test_Bug33398681
35 --exec unzip -qo $MYSQL_TEST_DIR/std_data/data80036_with_externally_stored_tablespaces.zip -d $MYSQL_TMP_DIR/test_Bug33398681
36
37 --echo # Check that the file exists in the working folder.
38 --file_exists $MYSQL_TMP_DIR/test_Bug33398681/data_dir
39 --list_files $MYSQL_TMP_DIR/test_Bug33398681/data_dir *
40 --file_exists $MYSQL_TMP_DIR/test_Bug33398681/new_innodbdir
41 --list_files $MYSQL_TMP_DIR/test_Bug33398681/new_innodbdir *
42 --list_files $MYSQL_TMP_DIR/test_Bug33398681/new_innodbdir/test_upgsc *
43
44 --echo # Set different path for --datadir which points to old version 8.0.36
45 --let $MYSQLD_NEW_DATADIR = $MYSQL_TMP_DIR/test_Bug33398681/data_dir
46
47 --echo # Set EXTERNAL_DIR3
48 --let $EXTERNAL_DIR3 = $MYSQL_TMP_DIR/test_Bug33398681/new_innodbdir
49
50 --echo # Start server with new data and external directories
51 --let restart_parameters="restart: --datadir=$MYSQLD_NEW_DATADIR --innodb-directories=$EXTERNAL_DIR3 --lower_case_table_names=1"
52 --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $MYSQL_TEST_DIR MYSQL_TEST_DIR
53 --source include/start_mysqld.inc
54
55 --echo # Perform ALTER TABLE operations
56 ALTER TABLE test_upgsc.t7a FORCE;
57 ALTER TABLE test_upgsc.t7b FORCE, ALGORITHM=INPLACE;
58 ALTER TABLE test_upgsc.t7c FORCE, ALGORITHM=COPY;
59
60 --echo # Check that the ibd files still exist in EXTERNAL_DIR3
61 --list_files $EXTERNAL_DIR3/test_upgsc *
62
63 --echo # Clean Up
64 --let restart_parameters="restart:"
65 --source include/restart_mysqld.inc
66
67 --force-rmdir $MYSQL_TMP_DIR/test_Bug33398681
68
69 --echo # End Test
70