| 1 |
# WL 13352: Create partitioned tables for upgrade and zip file |
| 2 |
# Generates $MYSQLTEST_VARDIR/std_data/upgrade/data_wl13352_$OLD_VERSION.zip.new |
| 3 |
# extn_wl13352_$OLD_VERSION.zip.new |
| 4 |
# This zip file needs to be updated to the version to upgrade to |
| 5 |
# mysql-test/std_data/upgrade/data_wl13352_$OLD_VERSION.zip |
| 6 |
# extn_wl13352_$OLD_VERSION.zip |
| 7 |
# Works for version 5.7.27, 8.0.13, 8.0.15, 8.0.17, 8.0.19 |
| 8 |
# |
| 9 |
# To run it in 5.7 version copy following files in 5.7 |
| 10 |
# 1. mysql-test/suite/innodb/t/partition_upgrade_create.test |
| 11 |
# - Search and comment out all #--force-rmdir |
| 12 |
# 2. mysql-test/suite/innodb/include/partition_upgrade_check.inc |
| 13 |
# - Search and comment out all #--copy_files_wildcard |
| 14 |
# - Comment out SET NAMES utf8mb4 COLLATE utf8mb4_0900_as_cs |
| 15 |
# - Change information_schema.innodb_tables, innodb_tablespaces to |
| 16 |
# innodb_sys_tables, innodb_sys_tablespaces |
| 17 |
# 3. mysql-test/suite/innodb/r/partition_upgrade_create.result |
| 18 |
# - Note the difference in result |
| 19 |
# To run it in other versions (8.0.*) copy the same files. Only |
| 20 |
# result file would need to change. |
| 21 |
|
| 22 |
--echo # Test to create schema for Upgrade in old version |
| 23 |
|
| 24 |
# Disable for creating zip files in other platforms |
| 25 |
--source include/linux.inc |
| 26 |
--source include/have_case_sensitive_file_system.inc |
| 27 |
|
| 28 |
# If you set $NO_EXPORT, $NO_EXT_PATH, $IS_FIXED_PATH, the same |
| 29 |
# needs to be set in partition_import.inc and partition_upgrade.inc |
| 30 |
# for running upgrade and import. |
| 31 |
|
| 32 |
# To disable exporting tablespace |
| 33 |
# --let $NO_EXPORT = 1 |
| 34 |
|
| 35 |
# To disable external file path |
| 36 |
# --let $NO_EXT_PATH = 1 |
| 37 |
|
| 38 |
# To Enable fixed path for external files |
| 39 |
# --let $IS_FIXED_PATH = 1 |
| 40 |
|
| 41 |
# To enable platform and lctn extension [8019, 5727] |
| 42 |
--let HAVE_PLATFORM_LCTN_EXTN = 1 |
| 43 |
|
| 44 |
# To enable upper case table, tablespace name [8019, 5727] |
| 45 |
--let EXTRA_TABLES = 1 |
| 46 |
|
| 47 |
--let $MYSQLD_DATADIR= `select @@datadir` |
| 48 |
--let $EXTERNAL_DIR_NAME= mysql_wl13352_data |
| 49 |
|
| 50 |
# For manual upgrade testing with absolute path to match across setup |
| 51 |
if ($IS_FIXED_PATH) |
| 52 |
{ |
| 53 |
--let $EXTERNAL_DIRECTORY = /tmp/$EXTERNAL_DIR_NAME/ |
| 54 |
} |
| 55 |
|
| 56 |
if (!$IS_FIXED_PATH) |
| 57 |
{ |
| 58 |
--let $EXTERNAL_DIRECTORY = $MYSQL_TMP_DIR/tmp/$EXTERNAL_DIR_NAME/ |
| 59 |
} |
| 60 |
|
| 61 |
# Add entries for more versions if needed |
| 62 |
select case when @@version like "5.7.27%" then '5727' |
| 63 |
when @@version like "8.0.13%" then '8013' |
| 64 |
when @@version like "8.0.15%" then '8015' |
| 65 |
when @@version like "8.0.17%" then '8017' |
| 66 |
when @@version like "8.0.19%" then '8019' |
| 67 |
else 'none' end as VERSION into @current_server_version; |
| 68 |
|
| 69 |
--let $OLD_VERSION= `select @current_server_version` |
| 70 |
--let $VERSION_STR= `select @@version` |
| 71 |
--let $IS_57= `select case when @@version like "5.7%" then 1 else 0 end` |
| 72 |
--let $IS_8019= `select case when @@version like "8.0.19%" then 1 else 0 end` |
| 73 |
|
| 74 |
# By default skip external directory for 5.7 |
| 75 |
if ($IS_57) |
| 76 |
{ |
| 77 |
--let $NO_EXPORT = 1 |
| 78 |
--let $NO_EXT_PATH = 1 |
| 79 |
} |
| 80 |
|
| 81 |
--let $OLD_EXTN = $OLD_VERSION |
| 82 |
|
| 83 |
if ($HAVE_PLATFORM_LCTN_EXTN) { |
| 84 |
|
| 85 |
--let $OLD_LCTN = `select @@lower_case_table_names` |
| 86 |
|
| 87 |
if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 1`) |
| 88 |
{ |
| 89 |
--let $OLD_PLATFORM = _win_lctn_ |
| 90 |
} |
| 91 |
|
| 92 |
if (`select convert(@@version_compile_os using latin1) IN ("Linux") = 1`) |
| 93 |
{ |
| 94 |
--let $OLD_PLATFORM = _lin_lctn_ |
| 95 |
} |
| 96 |
|
| 97 |
if (`select convert(@@version_compile_os using latin1) RLIKE '^(osx|macos)' = 1`) |
| 98 |
{ |
| 99 |
--let $OLD_PLATFORM = _mac_lctn_ |
| 100 |
} |
| 101 |
|
| 102 |
--let $OLD_EXTN = $OLD_VERSION$OLD_PLATFORM$OLD_LCTN |
| 103 |
} |
| 104 |
|
| 105 |
--echo # Starting server with keyring plugin |
| 106 |
--let $restart_parameters = restart: --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT |
| 107 |
|
| 108 |
if (!$NO_EXT_PATH) |
| 109 |
{ |
| 110 |
if (!$IS_57) |
| 111 |
{ |
| 112 |
# Cleanup external directory |
| 113 |
--error 0, 1 |
| 114 |
--force-rmdir $EXTERNAL_DIRECTORY |
| 115 |
|
| 116 |
--let $restart_parameters = restart: --innodb_directories=$EXTERNAL_DIRECTORY --early-plugin-load="keyring_file=$KEYRING_PLUGIN" --loose-keyring_file_data=$MYSQL_TMP_DIR/mysecret_keyring $KEYRING_PLUGIN_OPT |
| 117 |
} |
| 118 |
|
| 119 |
if ($IS_57) |
| 120 |
{ |
| 121 |
# Cleanup external directory |
| 122 |
--error 0, 1 |
| 123 |
--rmdir $EXTERNAL_DIRECTORY/test |
| 124 |
|
| 125 |
--error 0, 1 |
| 126 |
--rmdir $EXTERNAL_DIRECTORY |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR $KEYRING_PLUGIN_OPT --plugin-dir=KEYRING_PLUGIN_PATH $KEYRING_PLUGIN keyring_file.so $EXTERNAL_DIRECTORY /tmp/mysql_wl13352_data/ |
| 131 |
--source include/restart_mysqld.inc |
| 132 |
|
| 133 |
--echo |
| 134 |
--echo # A. Create tables for upgrade and fill data |
| 135 |
|
| 136 |
--let $check_option = CREATE |
| 137 |
--source suite/innodb/include/partition_upgrade_check.inc |
| 138 |
|
| 139 |
if (!$NO_EXPORT) |
| 140 |
{ |
| 141 |
--let $EXPORT_DIRECTORY = $MYSQL_TMP_DIR/data_export |
| 142 |
--mkdir $EXPORT_DIRECTORY |
| 143 |
|
| 144 |
--echo |
| 145 |
--echo # Export table partitions |
| 146 |
--let $check_option = EXPORT |
| 147 |
--source suite/innodb/include/partition_upgrade_check.inc |
| 148 |
} |
| 149 |
|
| 150 |
--echo |
| 151 |
--echo # Check table metadata and data |
| 152 |
--let $check_option = CHECK |
| 153 |
--source suite/innodb/include/partition_upgrade_check.inc |
| 154 |
|
| 155 |
--echo |
| 156 |
--echo # Stop DB server which was created by MTR default |
| 157 |
--source include/shutdown_mysqld.inc |
| 158 |
|
| 159 |
if ($IS_57) |
| 160 |
{ |
| 161 |
--mkdir $MYSQLTEST_VARDIR/std_data/upgrade |
| 162 |
} |
| 163 |
|
| 164 |
--echo # Copy and zip old version data directory. |
| 165 |
--exec ln -s $MYSQLD_DATADIR $MYSQLTEST_VARDIR/data_upgrade |
| 166 |
--exec zip -qr $MYSQL_TMP_DIR/data_upgrade.zip $MYSQLTEST_VARDIR/data_upgrade |
| 167 |
--file_exists $MYSQL_TMP_DIR/data_upgrade.zip |
| 168 |
--move_file $MYSQL_TMP_DIR/data_upgrade.zip $MYSQLTEST_VARDIR/std_data/upgrade/data_wl13352_$OLD_EXTN.zip.new |
| 169 |
--remove_file $MYSQLTEST_VARDIR/data_upgrade |
| 170 |
|
| 171 |
if (!$NO_EXPORT) |
| 172 |
{ |
| 173 |
--echo # Copy and zip old version exported partitions. |
| 174 |
--exec ln -s $EXPORT_DIRECTORY data_export |
| 175 |
--exec zip -qr $MYSQL_TMP_DIR/data_export.zip data_export |
| 176 |
--file_exists $MYSQL_TMP_DIR/data_export.zip |
| 177 |
--move_file $MYSQL_TMP_DIR/data_export.zip $MYSQLTEST_VARDIR/std_data/upgrade/export_wl13352_$OLD_EXTN.zip.new |
| 178 |
--remove_file data_export |
| 179 |
} |
| 180 |
|
| 181 |
if (!$NO_EXT_PATH) { |
| 182 |
--echo # Copy and zip old version external directory. |
| 183 |
|
| 184 |
if ($IS_FIXED_PATH) |
| 185 |
{ |
| 186 |
--exec zip -qr $MYSQL_TMP_DIR/data_external.zip $EXTERNAL_DIRECTORY |
| 187 |
--file_exists $MYSQL_TMP_DIR/data_external.zip |
| 188 |
--move_file $MYSQL_TMP_DIR/data_external.zip $MYSQLTEST_VARDIR/std_data/upgrade/extn_wl13352_$OLD_EXTN.zip.new |
| 189 |
} |
| 190 |
|
| 191 |
if (!$IS_FIXED_PATH) |
| 192 |
{ |
| 193 |
--exec ln -s $MYSQL_TMP_DIR/tmp tmp |
| 194 |
--exec zip -qr $MYSQL_TMP_DIR/data_external.zip tmp/$EXTERNAL_DIR_NAME |
| 195 |
--file_exists $MYSQL_TMP_DIR/data_external.zip |
| 196 |
--move_file $MYSQL_TMP_DIR/data_external.zip $MYSQLTEST_VARDIR/std_data/upgrade/extn_wl13352_$OLD_EXTN.zip.new |
| 197 |
--remove_file tmp |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
--echo # Cleanup: Restart with default options. |
| 202 |
let $restart_parameters =; |
| 203 |
--source include/start_mysqld.inc |
| 204 |
--echo |
| 205 |
--echo # Drop all tables created for upgrade |
| 206 |
--let $check_option = DROP |
| 207 |
--source suite/innodb/include/partition_upgrade_check.inc |
| 208 |
|
| 209 |
if (!$NO_EXPORT) |
| 210 |
{ |
| 211 |
if ($IS_57) |
| 212 |
{ |
| 213 |
--rmdir $EXPORT_DIRECTORY |
| 214 |
} |
| 215 |
|
| 216 |
if (!$IS_57) |
| 217 |
{ |
| 218 |
--force-rmdir $EXPORT_DIRECTORY |
| 219 |
} |
| 220 |
} |
| 221 |
|
| 222 |
if (!$NO_EXT_PATH) |
| 223 |
{ |
| 224 |
if ($IS_57) |
| 225 |
{ |
| 226 |
--rmdir $EXTERNAL_DIRECTORY/test |
| 227 |
--rmdir $EXTERNAL_DIRECTORY |
| 228 |
|
| 229 |
if (!$IS_ABSOLUTE_PATH) |
| 230 |
{ |
| 231 |
--rmdir $MYSQL_TMP_DIR/tmp |
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
if (!$IS_57) |
| 236 |
{ |
| 237 |
--force-rmdir $EXTERNAL_DIRECTORY |
| 238 |
|
| 239 |
if (!$IS_FIXED_PATH) |
| 240 |
{ |
| 241 |
--force-rmdir $MYSQL_TMP_DIR/tmp |
| 242 |
} |
| 243 |
} |
| 244 |
} |
| 245 |
|
| 246 |
--remove_file $MYSQL_TMP_DIR/mysecret_keyring |
| 247 |
|
| 248 |
--disable_query_log |
| 249 |
call mtr.add_suppression("\\[Warning\\].* The datafile '.*' for tablespace .* is in an unprotected location. This file cannot be recovered after a crash until this location is added to innodb_directories"); |
| 250 |
--enable_query_log |