forked from Percona-QA/percona-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
57_cross_upgrade.sh
executable file
·275 lines (221 loc) · 8.79 KB
/
57_cross_upgrade.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
#!/bin/bash
# Created by Ramesh Sivaraman, Percona LLC
# User Configurable Variables
SBENCH="sysbench"
PORT=$[50000 + ( $RANDOM % ( 9999 ) ) ]
WORKDIR=$1
ROOT_FS=$WORKDIR
SCRIPT_PWD=$(cd `dirname $0` && pwd)
LPATH="/usr/share/doc/sysbench/tests/db"
MYSQLD_START_TIMEOUT=200
if [ -z ${BUILD_NUMBER} ]; then
BUILD_NUMBER=1001
fi
WORKDIR="${ROOT_FS}/$BUILD_NUMBER"
if [ -z ${SDURATION} ]; then
SDURATION=100
fi
if [ -z ${TSIZE} ]; then
TSIZE=500
fi
if [ -z ${NUMT} ]; then
NUMT=16
fi
if [ -z ${TCOUNT} ]; then
TCOUNT=10
fi
cleanup(){
tar cvzf $ROOT_FS/results-${BUILD_NUMBER}.tar.gz $WORKDIR/logs || true
}
echoit(){
echo "[$(date +'%T')] $1"
if [ "${WORKDIR}" != "" ]; then echo "[$(date +'%T')] $1" >> ${WORKDIR}/upgrade_testing.log; fi
}
trap cleanup EXIT KILL
cd $ROOT_FS
if [ ! -d $ROOT_FS/test_db ]; then
git clone https://github.com/datacharmer/test_db.git
fi
MS57_TAR=`ls -1td mysql-5.7* | grep ".tar" | head -n1` || true
PS57_TAR=`ls -1td ?ercona-?erver-5.7* | grep ".tar" | head -n1` || true
MS57_11_TAR=`ls -1td mysql-5.7.11* | grep ".tar" | head -n1` || true
if [ ! -z $MS57_TAR ];then
tar -xzf $MS57_TAR
MS57_BASE=`ls -1td mysql-5.7* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$MS57_BASE/bin:$PATH"
else
wget http://downloads.mysql.com/archives/get/file/mysql-test-5.7.10-linux-glibc2.5-x86_64.tar.gz
wget http://downloads.mysql.com/archives/get/file/mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
MS_TEST_TAR=`ls -1td mysql-test-5.7* | grep -v ".tar" | head -n1`
MS57_TAR=`ls -1td mysql-5.7* | grep ".tar" | head -n1`
tar -xzf $MS57_TAR
tar -xzf $MS_TEST_TAR
MS57_BASE=`ls -1td mysql-5.7* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$MS57_BASE/bin:$PATH"
fi
if [ ! -z $PS57_TAR ];then
tar -xzf $PS57_TAR
PS57_BASE=`ls -1td ?ercona-?erver-5.7* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$PS57_BASE/bin:$PATH"
fi
if [ ! -z $MS57_11_TAR ];then
tar -xzf $MS57_11_TAR
MS57_11_BASE=`ls -1td mysql-5.7.11* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$MS57_11_BASE/bin:$PATH"
else
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-test-5.7.11-linux-glibc2.5-x86_64.tar.gz
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
MS_TEST_TAR=`ls -1td mysql-test-5.7.11* | grep -v ".tar" | head -n1`
MS57_11_TAR=`ls -1td mysql-5.7.11* | grep ".tar" | head -n1`
tar -xzf $MS57_11_TAR
tar -xzf $MS_TEST_TAR
MS57_11_BASE=`ls -1td mysql-5.7* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$MS57_11_BASE/bin:$PATH"
fi
WORKDIR="${ROOT_FS}/$BUILD_NUMBER"
MS57_BASEDIR="${ROOT_FS}/$MS57_BASE"
PS57_BASEDIR="${ROOT_FS}/$PS57_BASE"
MS57_11_BASEDIR="${ROOT_FS}/$MS57_11_BASE"
export MYSQL_VARDIR="$WORKDIR/mysqldir"
mkdir -p $MYSQL_VARDIR
mkdir -p $WORKDIR/logs
psdatadir="${MYSQL_VARDIR}/psdata"
mkdir -p $psdatadir
function create_emp_db()
{
DB_NAME=$1
SE_NAME=$2
SQL_FILE=$3
SOCKET=$4
pushd $ROOT_FS/test_db
cat $ROOT_FS/test_db/$SQL_FILE \
| sed -e "s|DROP DATABASE IF EXISTS employees|DROP DATABASE IF EXISTS ${DB_NAME}|" \
| sed -e "s|CREATE DATABASE IF NOT EXISTS employees|CREATE DATABASE IF NOT EXISTS ${DB_NAME}|" \
| sed -e "s|USE employees|USE ${DB_NAME}|" \
| sed -e "s|set default_storage_engine = InnoDB|set default_storage_engine = ${SE_NAME}|" \
> $ROOT_FS/test_db/${DB_NAME}_${SE_NAME}.sql
$MS57_BASEDIR/bin/mysql --socket=$SOCKET -u root < ${ROOT_FS}/test_db/${DB_NAME}_${SE_NAME}.sql || true
popd
}
pushd ${MS57_BASEDIR}/mysql-test/
set +e
perl mysql-test-run.pl \
--start-and-exit \
--vardir=$psdatadir \
--mysqld=--port=$PORT \
--mysqld=--innodb_file_per_table \
--mysqld=--default-storage-engine=InnoDB \
--mysqld=--binlog-format=ROW \
--mysqld=--log-bin=mysql-bin \
--mysqld=--server-id=101 \
--mysqld=--gtid-mode=ON \
--mysqld=--log-slave-updates \
--mysqld=--enforce-gtid-consistency \
--mysqld=--innodb_flush_method=O_DIRECT \
--mysqld=--core-file \
--mysqld=--secure-file-priv= \
--mysqld=--skip-name-resolve \
--mysqld=--log-error=$WORKDIR/logs/ms57.err \
--mysqld=--socket=$WORKDIR/ms57.sock \
--mysqld=--log-output=none \
1st
set -e
popd
echoit "Sysbench Run: Prepare stage"
$SBENCH --test=$LPATH/parallel_prepare.lua --report-interval=10 --mysql-engine-trx=yes --mysql-table-engine=innodb --oltp-table-size=$TSIZE --oltp_tables_count=$TCOUNT --mysql-db=test --mysql-user=root --num-threads=$NUMT --db-driver=mysql --mysql-socket=$WORKDIR/ms57.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_prepare.txt
echoit "Loading sakila test database"
$MS57_BASEDIR/bin/mysql --socket=$WORKDIR/ms57.sock -u root < ${SCRIPT_PWD}/sample_db/sakila.sql
echoit "Loading world test database"
$MS57_BASEDIR/bin/mysql --socket=$WORKDIR/ms57.sock -u root < ${SCRIPT_PWD}/sample_db/world.sql
echoit "Loading employees database with innodb engine.."
create_emp_db employee_1 innodb employees.sql $WORKDIR/ms57.sock
echoit "Loading employees partitioned database with innodb engine.."
create_emp_db employee_2 innodb employees_partitioned.sql $WORKDIR/ms57.sock
echoit "Loading employees database with myisam engine.."
create_emp_db employee_3 myisam employees.sql $WORKDIR/ms57.sock
$MS57_BASEDIR/bin/mysqladmin --socket=$WORKDIR/ms57.sock -u root shutdown
pushd ${PS57_BASEDIR}/mysql-test/
set +e
perl mysql-test-run.pl \
--start-and-exit \
--start-dirty \
--vardir=$psdatadir \
--mysqld=--port=$PORT \
--mysqld=--innodb_file_per_table \
--mysqld=--default-storage-engine=InnoDB \
--mysqld=--binlog-format=ROW \
--mysqld=--log-bin=mysql-bin \
--mysqld=--server-id=101 \
--mysqld=--gtid-mode=ON \
--mysqld=--log-slave-updates \
--mysqld=--enforce-gtid-consistency \
--mysqld=--innodb_flush_method=O_DIRECT \
--mysqld=--core-file \
--mysqld=--secure-file-priv= \
--mysqld=--skip-name-resolve \
--mysqld=--log-error=$WORKDIR/logs/ps57.err \
--mysqld=--socket=$WORKDIR/ps57.sock \
--mysqld=--log-output=none \
1st
set -e
popd
$PS57_BASEDIR/bin/mysql_upgrade -S $WORKDIR/ps57.sock -u root 2>&1 | tee $WORKDIR/logs/ps_mysql_upgrade.log
echoit "Loading sakila test database"
$MS57_BASEDIR/bin/mysql --socket=$WORKDIR/ps57.sock -u root < ${SCRIPT_PWD}/sample_db/sakila.sql
echoit "Loading world test database"
$MS57_BASEDIR/bin/mysql --socket=$WORKDIR/ps57.sock -u root < ${SCRIPT_PWD}/sample_db/world.sql
echoit "Loading employees database with innodb engine.."
create_emp_db employee_4 innodb employees.sql $WORKDIR/ps57.sock
echoit "Loading employees partitioned database with innodb engine.."
create_emp_db employee_5 innodb employees_partitioned.sql $WORKDIR/ps57.sock
echoit "Loading employees database with myisam engine.."
create_emp_db employee_6 myisam employees.sql $WORKDIR/ps57.sock
if grep -qi "ERROR" $WORKDIR/logs/ps57.err; then
echoit "Alert! Please check the error log.."
fi
echoit "Version info after cross upgrade (MS-5.7>PS-5.7)"
$PS57_BASEDIR/bin/mysql -S $WORKDIR/ps57.sock -u root -e "select @@version,@@version_comment;"
$PS57_BASEDIR/bin/mysqladmin --socket=$WORKDIR/ps57.sock -u root shutdown
PORT1=$[50000 + ( $RANDOM % ( 9999 ) ) ]
pushd ${MS57_11_BASEDIR}/mysql-test/
set +e
perl mysql-test-run.pl \
--start-and-exit \
--start-dirty \
--vardir=$psdatadir \
--mysqld=--port=$PORT \
--mysqld=--innodb_file_per_table \
--mysqld=--default-storage-engine=InnoDB \
--mysqld=--binlog-format=ROW \
--mysqld=--log-bin=mysql-bin \
--mysqld=--server-id=101 \
--mysqld=--gtid-mode=ON \
--mysqld=--log-slave-updates \
--mysqld=--enforce-gtid-consistency \
--mysqld=--innodb_flush_method=O_DIRECT \
--mysqld=--core-file \
--mysqld=--secure-file-priv= \
--mysqld=--skip-name-resolve \
--mysqld=--log-error=$WORKDIR/logs/ms57.err \
--mysqld=--socket=$WORKDIR/ms57.sock \
--mysqld=--log-output=none \
1st
set -e
popd
$MS57_11_BASEDIR/bin/mysql_upgrade -S $WORKDIR/ms57.sock -u root --force 2>&1 | tee $WORKDIR/logs/ms_mysql_upgrade.log
echoit "Loading sakila test database"
$MS57_11_BASEDIR/bin/mysql --socket=$WORKDIR/ms57.sock -u root < ${SCRIPT_PWD}/sample_db/sakila.sql
echoit "Loading world test database"
$MS57_11_BASEDIR/bin/mysql --socket=$WORKDIR/ms57.sock -u root < ${SCRIPT_PWD}/sample_db/world.sql
echoit "Loading employees database with innodb engine.."
create_emp_db employee_7 innodb employees.sql $WORKDIR/ms57.sock
echoit "Loading employees partitioned database with innodb engine.."
create_emp_db employee_8 innodb employees_partitioned.sql $WORKDIR/ms57.sock
echoit "Loading employees database with myisam engine.."
create_emp_db employee_9 myisam employees.sql $WORKDIR/ms57.sock
if grep -qi "ERROR" $WORKDIR/logs/ms57.err; then
echoit "Alert! Please check the error log.."
fi
echoit "Version info after cross upgrade (PS-5.7>MS-5.7)"
$MS57_11_BASEDIR/bin/mysql -S $WORKDIR/ms57.sock -u root -e "select @@version,@@version_comment;"
$MS57_11_BASEDIR/bin/mysqladmin --socket=$WORKDIR/ms57.sock -u root shutdown