File: partition_upgrade.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (215 lines) | stat: -rw-r--r-- 5,886 bytes parent folder | download
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
# WL 13352: Test Upgrade of partitioned tables from different versions
# Caller need to set OLD_VERSION: 5727, 8013, 8015, 8017, 8019
#                    OLD_LCTN: 0,1,2 [lower_case_table_names]
#                    OLD_PLATFORM: lin, win, mac [linux/windows/mac]

# To disable external file path
# --let $NO_EXT_PATH = 1

# To Enable fixed path for external files
# --let $IS_FIXED_PATH = 1

--echo # Test Upgrade from old version $OLD_VERSION

--source include/have_innodb_16k.inc
--source include/not_valgrind.inc

# For all other versions we run only on case sensitive fs
if ($OLD_VERSION != 8019) {
  if ($OLD_VERSION != 5727) {
    --source include/have_case_sensitive_file_system.inc
    --let $OLD_LCTN = 1
  }
}

--let $OLD_EXTN = $OLD_VERSION
--let $LCTN = --lower_case_table_names=$OLD_LCTN

# lower_case_table_names = 0 is supported only on case sensitive fs
if ($OLD_LCTN == 0) {
  --source include/have_case_sensitive_file_system.inc
}

# lower_case_table_names = 2 is supported only on case sensitive fs
if ($OLD_LCTN == 2) {
  --source include/have_case_insensitive_file_system.inc
}

if ($OLD_VERSION == 5727)
{
  # By default skip external directory for 5.7
  --let $NO_EXT_PATH = 1

  # 5.7 upgrade not supported across platforms
  if ($OLD_PLATFORM == win)
  {
    --source include/windows.inc
  }

  if ($OLD_PLATFORM == mac)
  {
    --source include/have_mac_os.inc
  }

  if ($OLD_PLATFORM == lin)
  {
    --source include/have_case_sensitive_file_system.inc
  }
  --let $OLD_EXTN = `select concat("$OLD_VERSION", "_", "$OLD_PLATFORM", "_lctn_", "$OLD_LCTN")`
}

# Check migration across platforms for 8.0.19
if ($OLD_VERSION == 8019)
{
  --let $OLD_EXTN = `select concat("$OLD_VERSION", "_", "$OLD_PLATFORM", "_lctn_", "$OLD_LCTN")`
  --let EXTRA_TABLES = 1
}

--echo # Stop DB server which was created by MTR default
--source include/shutdown_mysqld.inc

--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/
  --let $UNZIP_DIR = /
}

if (!$IS_FIXED_PATH)
{
  --let $EXTERNAL_DIRECTORY = $MYSQL_TMP_DIR/tmp/$EXTERNAL_DIR_NAME/
  --let $UNZIP_DIR = $MYSQL_TMP_DIR
}

# Cleanup external directory
--error 0, 1
--force-rmdir $EXTERNAL_DIRECTORY

--echo # Copy and unzip old version data directory.
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/data_wl13352_$OLD_EXTN.zip $MYSQL_TMP_DIR/data_upgrade.zip
--file_exists $MYSQL_TMP_DIR/data_upgrade.zip
--exec unzip -qo $MYSQL_TMP_DIR/data_upgrade.zip -d $MYSQL_TMP_DIR
--remove_file $MYSQL_TMP_DIR/data_upgrade.zip

if (!$NO_EXT_PATH)
{
  --echo # Copy and unzip external directory
  --copy_file $MYSQLTEST_VARDIR/std_data/upgrade/extn_wl13352_$OLD_EXTN.zip $MYSQL_TMP_DIR/data_extn.zip
  --file_exists $MYSQL_TMP_DIR/data_extn.zip
  --exec unzip -qo $MYSQL_TMP_DIR/data_extn.zip -d $UNZIP_DIR
  --remove_file $MYSQL_TMP_DIR/data_extn.zip
}

let $MYSQLD_DATADIR_UPGRADE = $MYSQL_TMP_DIR/data_upgrade;
--echo List all files before upgrade
--echo -----------------------------
--list_files $MYSQLD_DATADIR_UPGRADE/test

if (!$NO_EXT_PATH)
{
  --echo
  --echo List all files in external directory
  --echo ------------------------------------
  --list_files $EXTERNAL_DIRECTORY/test

  --echo
  --echo List files outside database directory (empty)
  --echo ---------------------------------------------
  --list_files $EXTERNAL_DIRECTORY
}

--echo
--echo # Upgrade to latest mysql version
let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/mysqld_upgrade.log;

if ($NO_EXT_PATH) {
  --replace_result $MYSQLD MYSQLD $MYSQLD_DATADIR_UPGRADE MYSQLD_DATADIR_UPGRADE $MYSQLD_LOG MYSQLD_LOG
  --exec echo "restart: --datadir=$MYSQLD_DATADIR_UPGRADE $LCTN --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
}

if (!$NO_EXT_PATH) {
  --replace_result $MYSQLD MYSQLD $MYSQLD_DATADIR_UPGRADE MYSQLD_DATADIR_UPGRADE $MYSQLD_LOG MYSQLD_LOG $EXTERNAL_DIRECTORY EXTERNAL_DIRECTORY
  --exec echo "restart: --datadir=$MYSQLD_DATADIR_UPGRADE $LCTN --innodb_directories=$EXTERNAL_DIRECTORY --log-error=$MYSQLD_LOG" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
}

--let $wait_counter= 10000

# Additional wait for 30 minutes for valgrid run
--let add_wait_counter= 18000

--enable_reconnect
--source include/wait_until_connected_again.inc

--echo
--echo List all files of upgraded data
--echo -------------------------------
--list_files $MYSQLD_DATADIR_UPGRADE/test

if (!$NO_EXT_PATH)
{
  --echo
  --echo List all files in external directory
  --echo ------------------------------------
  --list_files $EXTERNAL_DIRECTORY/test

  --echo
  --echo List files outside database directory (empty)
  --echo ---------------------------------------------
  --list_files $EXTERNAL_DIRECTORY
}

--echo
--echo # A. Validate upgraded tables and data

--let $i = 0

while($i < 2)
{
  --echo # 1. Check table metadata and data
  --let $check_option = CHECK
  --source partition_upgrade_check.inc

  --echo # 2. Do DML insert/update/delete on upgraded tables
  --let $check_option = DML
  --source partition_upgrade_check.inc

  --echo # 3. Do DDL ALTER/DROP on upgraded tables
  --let $check_option = DDL
  --source partition_upgrade_check.inc

  if ($i == 0) {
    --echo
    --echo # B. Create all the tables again and validate
    --let $check_option = DROP
    --source partition_upgrade_check.inc
    --let $check_option = CREATE
    --source partition_upgrade_check.inc
    --echo
  }
  --inc $i
}

--echo
--echo # Shutdown server
--source include/shutdown_mysqld.inc

--echo
--echo # Remove upgraded data directory.
--force-rmdir $MYSQL_TMP_DIR/data_upgrade

if (!$NO_EXT_PATH)
{
  --force-rmdir $EXTERNAL_DIRECTORY

  if (!$IS_FIXED_PATH)
  {
    --force-rmdir $MYSQL_TMP_DIR/tmp
  }
}

--echo
--echo # Cleanup: Restart with default options.
--let $restart_parameters =
--source include/start_mysqld.inc