-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathpartial_backup_tests.sh
executable file
·371 lines (305 loc) · 21.3 KB
/
partial_backup_tests.sh
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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#!/bin/bash
########################################################################
# Created By Manish Chawla, Percona LLC #
# Modified By Mohit Joshi, Percona LLC #
# This script tests backup for individual tables #
# Usage: #
# 1. Set paths in this script: #
# xtrabackup_dir, backup_dir, mysqldir, datadir, qascripts, logdir #
# 2. Run the script as: ./partial_backup_tests.sh #
# 3. Logs are available in: logdir #
########################################################################
export xtrabackup_dir="$HOME/pxb-8.4/bld_8.4_debug/install/bin"
export mysqldir="$HOME/mysql-8.4/bld_8.4/install"
export datadir="${mysqldir}/data"
export backup_dir="$HOME/dbbackup_$(date +"%d_%m_%Y")"
export PATH="$PATH:$xtrabackup_dir"
export qascripts="$HOME/percona-qa"
export logdir="$HOME/backuplogs"
export mysql_random_data_load_tool="$HOME/mysql_random_data_load"
# Set sysbench variables
num_tables=10
table_size=1000
mysql_start_timeout=60
# Setting default server_type to Percona Server
server_type=PS
server_version=$($mysqldir/bin/mysqld --version | awk -F 'Ver ' '{print $2}' | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1)
check_dependencies() {
# This function checks if the required dependencies are installed
if ! sysbench --version >/dev/null 2>&1 ; then
echo "ERR: The sysbench tool is not installed. It is required to run load."
exit 1
fi
if ! pt-table-checksum --version >/dev/null 2>&1 ; then
echo "ERR: The percona toolkit is not installed. It is required to check the data."
exit 1
fi
if [ ! -f ${mysql_random_data_load_tool} ]; then
echo "The mysql_random_data_load tool is not installed. It is required to create the data."
echo "Installing mysql_random_data_load tool"
wget https://github.com/Percona-Lab/mysql_random_data_load/releases/download/v0.1.12/mysql_random_data_load_0.1.12_Linux_x86_64.tar.gz
tar -C $HOME -xf mysql_random_data_load_0.1.12_Linux_x86_64.tar.gz
fi
}
start_server() {
# This function starts the server
pkill -9 mysqld
echo "=>Starting MySQL server"
$mysqldir/bin/mysqld --no-defaults --basedir=$mysqldir --datadir=$datadir $MYSQLD_OPTIONS --port=21000 --socket=$mysqldir/socket.sock --plugin-dir=$mysqldir/lib/plugin --max-connections=1024 --log-error=$datadir/error.log --general-log --log-error-verbosity=3 --core-file > /dev/null 2>&1 &
MPID="$!"
for X in $(seq 0 ${mysql_start_timeout}); do
sleep 1
if ${mysqldir}/bin/mysqladmin -uroot -S${mysqldir}/socket.sock ping > /dev/null 2>&1; then
echo "..Server started successfully"
break
fi
if [ $X -eq ${mysql_start_timeout} ]; then
echo "ERR: Database could not be started. Please check error logs: ${mysqldir}/data/error.log"
exit 1
fi
done
}
initialize_db() {
local MYSQLD_OPTIONS=$1
# This function initializes and starts mysql database
if [ ! -d "${logdir}" ]; then
mkdir "${logdir}"
fi
if [ -d $datadir ]; then
rm -rf $datadir
fi
echo "=>Creating data directory"
$mysqldir/bin/mysqld --no-defaults $MYSQLD_OPTIONS --datadir=$datadir --initialize-insecure > $mysqldir/mysql_install_db.log 2>&1
echo "..Data directory created"
start_server
$mysqldir/bin/mysqladmin ping --user=root --socket=$mysqldir/socket.sock >/dev/null 2>&1
if [ "$?" -ne 0 ]; then
echo "ERR: Database could not be started in location ${mysqldir}. Please check the directory"
exit 1
fi
output=$($mysqldir/bin/mysql -uroot -S$mysqldir/socket.sock -Ne "SELECT COUNT(*) FROM information_schema.engines WHERE engine='InnoDB' AND comment LIKE 'Percona%';")
if [ "$output" -eq 1 ]; then
server_type="PS"
echo "Test is running against: $server_type-$server_version"
elif [ "$output" -eq 0 ]; then
server_type="MS"
echo "Test is running against: $server_type-$server_version"
else
echo "Invalid server version!"
exit 1
fi
$mysqldir/bin/mysql -uroot -S$mysqldir/socket.sock -e"CREATE DATABASE test;"
echo "Create data using sysbench"
if [[ "${MYSQLD_OPTIONS}" != *"encrypt"* ]]; then
sysbench /usr/share/sysbench/oltp_insert.lua --tables=${num_tables} --table-size=${table_size} --mysql-db=test --mysql-user=root --threads=100 --db-driver=mysql --mysql-socket="${mysqldir}"/socket.sock prepare >"${logdir}"/sysbench.log
else
# Encryption enabled
for ((i=1; i<=num_tables; i++)); do
echo "Creating the table sbtest$i..."
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE test.sbtest$i (id int(11) NOT NULL AUTO_INCREMENT, k int(11) NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k)) ENGINE=InnoDB DEFAULT CHARSET=latin1 ENCRYPTION='Y';"
done
echo "Adding data in tables..."
sysbench /usr/share/sysbench/oltp_insert.lua --tables=${num_tables} --mysql-db=test --mysql-user=root --threads=50 --db-driver=mysql --mysql-socket=${mysqldir}/socket.sock --time=30 run >/dev/null 2>&1
fi
}
take_partial_backup() {
# This function takes a partial backup
local BACKUP_PARAMS="$1"
local PREPARE_PARAMS="$2"
local RESTORE_PARAMS="$3"
local TABLES_LIST="$4"
log_date=$(date +"%d_%m_%Y_%M")
if [ -d ${backup_dir} ]; then
rm -r ${backup_dir}
fi
mkdir -p ${backup_dir}/full
echo "Taking backup"
"${xtrabackup_dir}"/xtrabackup --user=root --password='' --backup --target-dir="${backup_dir}"/full -S "${mysqldir}"/socket.sock --datadir="${datadir}" ${BACKUP_PARAMS} 2>"${logdir}"/full_backup_"${log_date}"_log
if [ "$?" -ne 0 ]; then
echo "ERR: Full Backup failed. Please check the log at: ${logdir}/full_backup_${log_date}_log"
exit 1
else
echo "Full backup was successfully created at: ${backup_dir}/full. Logs available at: ${logdir}/full_backup_${log_date}_log"
fi
sleep 1
echo "Preparing backup with --export option"
"${xtrabackup_dir}"/xtrabackup --prepare --export --target_dir="${backup_dir}"/full ${PREPARE_PARAMS} 2>"${logdir}"/prepare_full_backup_"${log_date}"_log
if [ "$?" -ne 0 ]; then
echo "ERR: Prepare of full backup failed. Please check the log at: ${logdir}/prepare_full_backup_${log_date}_log"
exit 1
else
echo "Prepare of full backup was successful. Logs available at: ${logdir}/prepare_full_backup_${log_date}_log"
fi
# Collect data before restore
orig_data=$(pt-table-checksum S="${mysqldir}"/socket.sock,u=root -d test --recursion-method hosts --no-check-binlog-format --no-version-check 2>/dev/null | awk '{print $4}')
echo "Tables list to restore: ${TABLES_LIST}"
for table in ${TABLES_LIST}; do
echo "Restoring ${table}"
echo "Discard tablespace of ${table}"
"${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -e "ALTER TABLE test.$table DISCARD TABLESPACE;"
echo "Copy ${table} files from backup"
#cp -r "${backup_dir}"/full/test/${table}.* "${mysqldir}"/data/test/.
cp -r "${backup_dir}"/full/test/${table}* "${mysqldir}"/data/test/.
if [ "$?" -ne 0 ]; then
echo "ERR: The ${table} files could not be copied to ${mysqldir}/data/test/ dir. The backup in ${backup_dir}/full/test does not contain the ${table} files."
exit 1
fi
echo "Import tablespace of ${table}"
"${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -e "ALTER TABLE test.$table IMPORT TABLESPACE;"
if [ "$?" -ne 0 ]; then
echo "ERR: Restore of ${table} failed. Please check the database logs at: ${mysqldir}/log"
exit 1
else
echo "Restore of ${table} was successful."
fi
done
check_tables
echo "Check the restored data"
# Collect data after restore
res_data=$(pt-table-checksum S="${mysqldir}"/socket.sock,u=root -d test --recursion-method hosts --no-check-binlog-format --no-version-check 2>/dev/null | awk '{print $4}')
if [[ "${orig_data}" != "${res_data}" ]]; then
echo "ERR: Data changed after restore. Original data: ${orig_data} Restored data: ${res_data}"
else
echo "Restored data is correct"
fi
}
check_tables() {
echo "Check the table status"
check_err=0
while read table; do
echo "Checking table $table ..."
if ! table_status=$("${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -Bse "CHECK TABLE test.$table"|cut -f4-); then
echo "ERR: CHECK TABLE test.$table query failed"
# Check if database went down
if ! "${mysqldir}"/bin/mysqladmin ping --user=root --socket="${mysqldir}"/socket.sock >/dev/null 2>&1; then
echo "ERR: The database has gone down due to corruption in table test.$table"
exit 1
fi
fi
if [[ "$table_status" != "OK" ]]; then
echo "ERR: CHECK TABLE test.$table query displayed the table status as '$table_status'"
check_err=1
fi
done < <("${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -Bse "SHOW TABLES FROM test;")
# Check if database went down
if ! "${mysqldir}"/bin/mysqladmin ping --user=root --socket="${mysqldir}"/socket.sock >/dev/null 2>&1; then
echo "ERR: The database has gone down due to corruption, the restore was unsuccessful"
exit 1
fi
if [[ "$check_err" -eq 0 ]]; then
echo "All innodb tables status: OK"
else
echo "After restore, some tables may be corrupt, check table status is not OK"
fi
}
create_keyring_component_files() {
echo "Create global manifest file"
cat <<-EOF >"${mysqldir}"/bin/mysqld.my
{
"components": "file://component_keyring_file"
}
EOF
if [[ ! -f "${mysqldir}"/bin/mysqld.my ]]; then
echo "ERR: The global manifest could not be created in ${mysqldir}/bin/mysqld.my"
exit 1
fi
echo "Create global configuration file"
cat <<-EOF >"${mysqldir}"/lib/plugin/component_keyring_file.cnf
{
"path": "$mysqldir/lib/plugin/component_keyring_file", "read_only": false }
EOF
if [[ ! -f "${mysqldir}"/lib/plugin/component_keyring_file.cnf ]]; then
echo "ERR: The global configuration could not be created in ${mysqldir}/lib/plugin/component_keyring_file.cnf"
exit 1
fi
}
test_partial_table_backup() {
# Test suite for partial table backup tests
check_dependencies
echo "Test: Full backup and partial table restore"
initialize_db ""
echo "Create a table with all data types"
"${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -e "CREATE TABLE IF NOT EXISTS alltypes (a INT, b TINYINT, c SMALLINT, d MEDIUMINT, e BIGINT, f DECIMAL, g NUMERIC, h FLOAT, i REAL, j DOUBLE, k BIT(16), l DATE, m TIME, n DATETIME, o TIMESTAMP, p YEAR, q CHAR, r VARCHAR(120), s BINARY(3), t VARBINARY(3), u BLOB, v TEXT, x ENUM('1', '2', '3'), y SET('a', 'b', 'c', 'd'), z TINYBLOB, aa MEDIUMBLOB, ab LONGBLOB, ac TINYTEXT, ad MEDIUMTEXT, ae LONGTEXT, af GEOMETRY SRID 0, ag JSON);" test
port_no=$("${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -Bse "select @@port;")
echo "Add data in the alltypes table"
${mysql_random_data_load_tool} test alltypes 10 --user root --password '' --host=127.0.0.1 --port=${port_no} >"${logdir}"/data_load_log 2>&1
if [ "$?" -ne 0 ]; then
echo "ERR: The mysql_random_data_load_tool could not add data to the alltypes table. Please check the logs at: ${logdir}/data_load_log"
exit 1
fi
"${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -e "UPDATE alltypes SET k = 'a', af = POINT(1,2), ag = '{\"key1\": \"value1\", \"key2\": \"value2\"}';" test
take_partial_backup "" "" "" "sbtest1 sbtest2 alltypes"
echo "###################################################################################"
echo "Test: Partial backup and restore of tables using a pattern and excluding some tables"
take_partial_backup "--tables=sbtest[1-5] --tables-exclude=sbtest10,sbtest5,sbtest4" "" "" "sbtest1 sbtest2 sbtest3"
for table in sbtest10 sbtest5 sbtest4; do
if [[ -f "${backup_dir}"/full/test/"${table}".ibd ]]; then
echo "ERR: PXB took the backup of ${table} table. The ${table} table should be excluded from the backup."
exit 1
fi
done
echo "###################################################################################"
echo "Test: Partial backup and restore of tables using a text file"
echo "test.sbtest3">"${logdir}"/tables.txt
echo "test.sbtest5">>"${logdir}"/tables.txt
take_partial_backup "--tables-file=${logdir}/tables.txt" "" "" "sbtest3 sbtest5"
echo "###################################################################################"
echo "Test: Partial backup and restore of partitioned tables"
echo "Create innodb partitioned tables"
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "DROP TABLE IF EXISTS sbtest1; DROP TABLE IF EXISTS sbtest2; DROP TABLE IF EXISTS sbtest3;" test
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE sbtest1 (id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k) ) PARTITION BY HASH(id) PARTITIONS 10;" test
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE sbtest2 (id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k) ) PARTITION BY RANGE(id) (PARTITION p0 VALUES LESS THAN (500), PARTITION p1 VALUES LESS THAN (1000), PARTITION p2 VALUES LESS THAN MAXVALUE);" test
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE sbtest3 (id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k) ) PARTITION BY KEY() PARTITIONS 5;" test
echo "Add data for innodb partitioned tables"
sysbench /usr/share/sysbench/oltp_insert.lua --tables=3 --mysql-db=test --mysql-user=root --threads=100 --db-driver=mysql --mysql-socket=${mysqldir}/socket.sock --time=5 run >/dev/null 2>&1
take_partial_backup "--tables=sbtest1,sbtest2,sbtest3 --tables-exclude=sbtest10" "" "" "sbtest1 sbtest2 sbtest3"
}
test_partial_table_backup_encrypt() {
# Test suite for partial table backup tests with encryption
echo "Test suite for partial table backup tests with encryption"
check_dependencies
echo "Test: Full backup and partial table restore"
if [ "$server_type" == "MS" ]; then
server_options="--innodb-undo-log-encrypt --innodb-redo-log-encrypt --default-table-encryption=ON --log-slave-updates --gtid-mode=ON --enforce-gtid-consistency --binlog-format=row --master_verify_checksum=ON --binlog_checksum=CRC32 --binlog-rotate-encryption-master-key-at-startup --table-encryption-privilege-check=ON"
elif [ "$server_type" == "PS" ]; then
server_options="--innodb-undo-log-encrypt --innodb-redo-log-encrypt --default-table-encryption=ON --innodb_encrypt_online_alter_logs=ON --innodb_temp_tablespace_encrypt=ON --log-slave-updates --gtid-mode=ON --enforce-gtid-consistency --binlog-format=row --master_verify_checksum=ON --binlog_checksum=CRC32 --encrypt-tmp-files --innodb_sys_tablespace_encrypt --binlog-rotate-encryption-master-key-at-startup --table-encryption-privilege-check=ON"
fi
create_keyring_component_files
initialize_db "${server_options} --binlog-encryption"
echo "Create a table with all data types"
"${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -e "CREATE TABLE IF NOT EXISTS alltypes (a INT, b TINYINT, c SMALLINT, d MEDIUMINT, e BIGINT, f DECIMAL, g NUMERIC, h FLOAT, i REAL, j DOUBLE, k BIT(16), l DATE, m TIME, n DATETIME, o TIMESTAMP, p YEAR, q CHAR, r VARCHAR(120), s BINARY(3), t VARBINARY(3), u BLOB, v TEXT, x ENUM('1', '2', '3'), y SET('a', 'b', 'c', 'd'), z TINYBLOB, aa MEDIUMBLOB, ab LONGBLOB, ac TINYTEXT, ad MEDIUMTEXT, ae LONGTEXT, af GEOMETRY SRID 0, ag JSON) ENCRYPTION='Y';" test
port_no=$("${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -Bse "select @@port;")
echo "Add data in the alltypes table"
${mysql_random_data_load_tool} test alltypes 10 --user root --password '' --host=127.0.0.1 --port=${port_no} >"${logdir}"/data_load_log 2>&1
"${mysqldir}"/bin/mysql -uroot -S"${mysqldir}"/socket.sock -e "UPDATE alltypes SET k = 'a', af = POINT(1,2), ag = '{\"key1\": \"value1\", \"key2\": \"value2\"}';" test
take_partial_backup "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "sbtest1 sbtest2 alltypes"
echo "###################################################################################"
echo "Test: Partial backup and restore of tables using a pattern and excluding some tables"
take_partial_backup "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin --tables=sbtest[1-5] --tables-exclude=sbtest10,sbtest5,sbtest4" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "sbtest1 sbtest2 sbtest3"
for table in sbtest10 sbtest5 sbtest4; do
if [[ -f "${backup_dir}"/full/test/"${table}".ibd ]]; then
echo "ERR: PXB took the backup of ${table} table. The ${table} table should be excluded from the backup."
exit 1
fi
done
echo "###################################################################################"
echo "Test: Partial backup and restore of tables using a text file"
echo "test.sbtest3">"${logdir}"/tables.txt
echo "test.sbtest5">>"${logdir}"/tables.txt
take_partial_backup "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin --tables-file=${logdir}/tables.txt" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "sbtest3 sbtest5"
echo "###################################################################################"
echo "Test: Partial backup and restore of partitioned tables"
echo "Create innodb partitioned tables"
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "DROP TABLE IF EXISTS sbtest1; DROP TABLE IF EXISTS sbtest2; DROP TABLE IF EXISTS sbtest3;" test
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE sbtest1 (id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k) ) PARTITION BY HASH(id) PARTITIONS 10;" test
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE sbtest2 (id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k) ) PARTITION BY RANGE(id) (PARTITION p0 VALUES LESS THAN (500), PARTITION p1 VALUES LESS THAN (1000), PARTITION p2 VALUES LESS THAN MAXVALUE);" test
${mysqldir}/bin/mysql -uroot -S${mysqldir}/socket.sock -e "CREATE TABLE sbtest3 (id int NOT NULL AUTO_INCREMENT, k int NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id), KEY k_1 (k) ) PARTITION BY KEY() PARTITIONS 5;" test
echo "Add data for innodb partitioned tables"
sysbench /usr/share/sysbench/oltp_insert.lua --tables=3 --mysql-db=test --mysql-user=root --threads=100 --db-driver=mysql --mysql-socket=${mysqldir}/socket.sock --time=5 run >/dev/null 2>&1
take_partial_backup "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin --tables=sbtest1,sbtest2,sbtest3 --tables-exclude=sbtest10" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "--component-keyring-config="${mysqldir}"/lib/plugin/component_keyring_file.cnf --xtrabackup-plugin-dir=${xtrabackup_dir}/../lib/plugin" "sbtest1 sbtest2 sbtest3"
}
echo "################################## Running Tests ##################################"
test_partial_table_backup
echo "###################################################################################"
test_partial_table_backup_encrypt
echo "###################################################################################"