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