~dbpercona/percona-qa/readme

431 by Raghavendra D Prabhu
Initial draft for PXC-129
1
#!/bin/bash -ue
2
3
# Author: Raghavendra Prabhu <raghavendra.prabhu@percona.com>
4
5
ulimit -c unlimited
6
export MTR_MAX_SAVE_CORE=5
7
8
set +e
9
echo "Killing existing mysqld"
10
pgrep -f mysqld
11
12
pkill -f mysqld
13
sleep 10
14
pgrep mysqld || pkill -9 -f mysqld
15
456 by Raghavendra D Prabhu
Fix for errors
16
set -e
431 by Raghavendra D Prabhu
Initial draft for PXC-129
17
sleep 5
18
694 by Raghavendra D Prabhu
a) Fix sysbench path b) Fix unset string
19
LPATH=${SPATH:-/usr/share/doc/sysbench/tests/db}
431 by Raghavendra D Prabhu
Initial draft for PXC-129
20
21
WORKDIR=$1
22
ROOT_FS=$WORKDIR
442 by Raghavendra D Prabhu
Updated sst_method
23
sst_method=${SST_METHOD:-rsync}
469 by Raghavendra D Prabhu
Fix the removal
24
thres=1
442 by Raghavendra D Prabhu
Updated sst_method
25
26
if [[ $sst_method == 'xtrabackup' ]];then 
27
    wget -q  http://www.percona.com/redir/downloads/XtraBackup/LATEST/binary/tarball/percona-xtrabackup-2.2.3-4982-Linux-x86_64.tar.gz
28
    tar xf percona-xtrabackup-2.2.3-4982-Linux-x86_64.tar.gz
29
    export PATH="$PATH:$PWD/percona-xtrabackup-2.2.3-Linux-x86_64/bin/"
30
    sst_method='xtrabackup-v2'
31
fi
431 by Raghavendra D Prabhu
Initial draft for PXC-129
32
478 by Raghavendra D Prabhu
Remove the temporary workaround
33
#pushd /tmp
34
#wget -q http://files.wnohang.net/files/libgalera_smm.so
35
#popd
475 by Raghavendra D Prabhu
Temporary workaround
36
431 by Raghavendra D Prabhu
Initial draft for PXC-129
37
cd $WORKDIR
38
444 by Raghavendra D Prabhu
Cleanup the script
39
VER2=$LATEST_VER
440 by Raghavendra D Prabhu
Switching the versions
40
VER1=$(basename $RELEASE_BIN | cut -d- -f4)
431 by Raghavendra D Prabhu
Initial draft for PXC-129
41
469 by Raghavendra D Prabhu
Fix the removal
42
if [[ $VER1 == $VER2 ]];then 
43
    thres=2
44
fi
45
431 by Raghavendra D Prabhu
Initial draft for PXC-129
46
count=$(ls -1ct Percona-XtraDB-Cluster-$VER1*.tar.gz | wc -l)
47
469 by Raghavendra D Prabhu
Fix the removal
48
if [[ $count -gt $thres ]];then 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
49
    for dirs in `ls -1ct Percona-XtraDB-Cluster-$VER1*.tar.gz | tail -n +2`;do 
446 by Raghavendra D Prabhu
Fix the script for sysbench
50
        rm -rf $dirs || true
431 by Raghavendra D Prabhu
Initial draft for PXC-129
51
    done 
52
fi
53
446 by Raghavendra D Prabhu
Fix the script for sysbench
54
find . -maxdepth 1 -type d -name 'Percona-XtraDB-Cluster-$VER1*' -exec rm -rf {} \+ || true 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
55
56
57
58
count=$(ls -1ct Percona-XtraDB-Cluster-$VER2*.tar.gz | wc -l)
59
469 by Raghavendra D Prabhu
Fix the removal
60
if [[ $count -gt $thres ]];then 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
61
    for dirs in `ls -1ct Percona-XtraDB-Cluster-$VER2*.tar.gz | tail -n +2`;do 
446 by Raghavendra D Prabhu
Fix the script for sysbench
62
        rm -rf $dirs || true 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
63
    done 
64
fi
65
446 by Raghavendra D Prabhu
Fix the script for sysbench
66
find . -maxdepth 1 -type d -name 'Percona-XtraDB-Cluster-$VER2*' -exec rm -rf {} \+ || true 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
67
68
69
echo "Removing older directories"
446 by Raghavendra D Prabhu
Fix the script for sysbench
70
find . -maxdepth 1 -type d -mtime +10 -exec rm -rf {} \+ || true 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
71
72
echo "Removing their symlinks"
73
find . -maxdepth 1 -type l -mtime +10 -delete
74
75
TAR=`ls -1ct Percona-XtraDB-Cluster-$VER2*.tar.gz | head -n1`
695 by Raghavendra D Prabhu
Fix the path(s)
76
BASE2="$(tar tf $TAR | head -1 | cut -d '/' -f1)"
447 by Raghavendra D Prabhu
Fix the versions
77
78
tar -xf $TAR
79
475 by Raghavendra D Prabhu
Temporary workaround
80
447 by Raghavendra D Prabhu
Fix the versions
81
TAR=`ls -1ct Percona-XtraDB-Cluster-$VER1*.tar.gz | head -n1`
695 by Raghavendra D Prabhu
Fix the path(s)
82
BASE1="$(tar tf $TAR | head -1 | cut -d '/' -f1)"
431 by Raghavendra D Prabhu
Initial draft for PXC-129
83
468 by Raghavendra D Prabhu
Fix comparison
84
if [[ $BASE1 == $BASE2 ]];then 
467 by Raghavendra D Prabhu
Account for equal versions
85
    TAR=`ls -1ct Percona-XtraDB-Cluster-$VER1*.tar.gz | tail -1`
695 by Raghavendra D Prabhu
Fix the path(s)
86
    BASE1="$(tar tf $TAR | head -1 | cut -d '/' -f1)"
467 by Raghavendra D Prabhu
Account for equal versions
87
fi
88
470 by Raghavendra D Prabhu
Add failsafe
89
90
if [[ $BASE1 == $BASE2 ]];then 
91
    echo "FATAL: Failed"
92
    exit 1
93
fi
94
431 by Raghavendra D Prabhu
Initial draft for PXC-129
95
tar -xf $TAR
478 by Raghavendra D Prabhu
Remove the temporary workaround
96
#cp -v /tmp/libgalera_smm.so $ROOT_FS/$BASE2/lib/galera3/
431 by Raghavendra D Prabhu
Initial draft for PXC-129
97
470 by Raghavendra D Prabhu
Add failsafe
98
431 by Raghavendra D Prabhu
Initial draft for PXC-129
99
100
# Parameter of parameterized build 
101
if [[ -n $SDURATION ]];then 
102
    export SYSBENCH_DURATION=$SDURATION
103
else 
104
    export SYSBENCH_DURATION=300
105
fi
106
107
108
109
WORKDIR="${ROOT_FS}/$BUILD_NUMBER"
444 by Raghavendra D Prabhu
Cleanup the script
110
111
for l in `seq $((BUILD_NUMBER - 2)) -1 1`;do 
112
    rm -rf $l || true
113
done
114
431 by Raghavendra D Prabhu
Initial draft for PXC-129
115
mkdir -p $WORKDIR/logs
116
117
MYSQL_BASEDIR1="${ROOT_FS}/$BASE1"
118
MYSQL_BASEDIR2="${ROOT_FS}/$BASE2"
438 by Raghavendra D Prabhu
Fix the bootstrapping
119
GALERA1="${MYSQL_BASEDIR1}/lib/libgalera_smm.so"
120
GALERA2="${MYSQL_BASEDIR2}/lib/libgalera_smm.so"
464 by Raghavendra D Prabhu
Fix galera paths
121
122
if [[ ! -e $GALERA1 ]];then 
123
    GALERA1="${MYSQL_BASEDIR1}/lib/galera3/libgalera_smm.so"
124
fi
125
126
if [[ ! -e $GALERA2 ]];then 
127
    GALERA2="${MYSQL_BASEDIR2}/lib/galera3/libgalera_smm.so"
128
fi
129
431 by Raghavendra D Prabhu
Initial draft for PXC-129
130
export MYSQL_VARDIR="$WORKDIR/mysqldir"
131
mkdir -p $MYSQL_VARDIR
132
694 by Raghavendra D Prabhu
a) Fix sysbench path b) Fix unset string
133
SDIR="$LPATH"
431 by Raghavendra D Prabhu
Initial draft for PXC-129
134
SRESULTS="$WORKDIR/sresults"
135
136
mkdir -p $SRESULTS
137
138
echo "Workdir: $WORKDIR"
139
echo "Basedirs: $MYSQL_BASEDIR1 $MYSQL_BASEDIR2"
140
141
142
143
  ADDR="127.0.0.1"
144
  RPORT=$(( RANDOM%21 + 10 ))
145
  RBASE1="$(( RPORT*1000 ))"
146
  echo "Setting RBASE to $RBASE1"
147
  RADDR1="$ADDR:$(( RBASE1 + 7 ))"
148
  LADDR1="$ADDR:$(( RBASE1 + 8 ))"
149
150
  RBASE2="$(( RBASE1 + 100 ))"
151
  RADDR2="$ADDR:$(( RBASE2 + 7 ))"
152
  LADDR2="$ADDR:$(( RBASE2 + 8 ))"
153
154
  SUSER=root
155
  SPASS=
156
157
  node1="${MYSQL_VARDIR}/node1"
158
  mkdir -p $node1
159
  node2="${MYSQL_VARDIR}/node2"
160
  mkdir -p $node2
161
162
EXTSTATUS=0
163
164
if [[ $MEM -eq 1 ]];then 
165
    MEMOPT="--mem"
166
else 
167
    MEMOPT=""
168
fi
169
444 by Raghavendra D Prabhu
Cleanup the script
170
cleanup(){
446 by Raghavendra D Prabhu
Fix the script for sysbench
171
    rm Percona-XtraDB-Cluster*.tar.gz*  || true
448 by Raghavendra D Prabhu
Fix for tar
172
    tar cvzf $ROOT_FS/results-${BUILD_NUMBER}.tar.gz $WORKDIR/logs || true
444 by Raghavendra D Prabhu
Cleanup the script
173
}
174
175
176
trap cleanup EXIT KILL
431 by Raghavendra D Prabhu
Initial draft for PXC-129
177
178
if [[ -n ${EXTERNALS:-} ]];then 
179
    EXTOPTS="$EXTERNALS"
180
else
181
    EXTOPTS=""
182
fi
183
432 by Raghavendra D Prabhu
Updates to compat script
184
if [[ $DIR -eq 1 ]];then 
185
    sockets="$node1/socket.sock,$node2/socket.sock"
186
elif [[ $DIR -eq 2 ]];then 
187
    sockets="$node2/socket.sock"
188
elif [[ $DIR -eq 3 ]];then 
189
    sockets="$node1/socket.sock"
190
fi
191
STABLE="test.sbtest1" 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
192
193
if [[ $BUILD_SOURCE == 'debug' ]];then 
194
    EXTOPTS+=" --mysqld=--skip-performance-schema "
195
fi
481 by Raghavendra D Prabhu
Add new debug options
196
GDEBUG=""
431 by Raghavendra D Prabhu
Initial draft for PXC-129
197
198
if [[ $DEBUG -eq 1 ]];then 
199
    DBG="--mysqld=--wsrep-debug=1"
454 by Raghavendra D Prabhu
Added another debug option
200
elif [[ $DEBUG -eq 2 ]];then 
201
    DBG=" --mysqld=--wsrep-debug=1 --mysqld=--wsrep-log-conflicts=ON "
481 by Raghavendra D Prabhu
Add new debug options
202
elif [[ $DEBUG -eq 3 ]];then 
203
    DBG=" --mysqld=--wsrep-debug=1 --mysqld=--wsrep-log-conflicts=ON"
204
    GDEBUG="; debug=1"
431 by Raghavendra D Prabhu
Initial draft for PXC-129
205
else 
206
    DBG=""
207
fi
208
695 by Raghavendra D Prabhu
Fix the path(s)
209
#export LD_LIBRARY_PATH="$MYSQL_BASEDIR1/lib"
694 by Raghavendra D Prabhu
a) Fix sysbench path b) Fix unset string
210
SBENCH="sysbench"
455 by Raghavendra D Prabhu
Cleanup the upgrade script
211
common=" --start-and-exit --nowarnings  \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
212
    --mysqld=--wsrep_sst_method=$sst_method \
213
    --mysqld=--wsrep_sst_auth=$SUSER:$SPASS \
214
    --mysqld=--wsrep_node_address=$ADDR \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
215
    --nodefault-myisam \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
216
    --mysqld=--innodb_flush_method=O_DIRECT \
217
    --mysqld=--query_cache_type=0 \
218
    --mysqld=--query_cache_size=0 \
219
    --mysqld=--innodb_flush_log_at_trx_commit=0 \
220
    --mysqld=--innodb_buffer_pool_size=500M \
221
    --mysqld=--innodb_log_file_size=500M \
222
    --mysqld=--default-storage-engine=InnoDB \
223
    --mysqld=--loose-innodb \
224
    --mysqld=--sql-mode=no_engine_substitution \
225
    --mysqld=--skip-external-locking \
226
    --mysqld=--core-file \
227
    --mysqld=--skip-name-resolve \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
228
    --mysqld=--innodb_file_per_table  \
229
    --mysqld=--binlog-format=ROW \
230
    --mysqld=--wsrep-slave-threads=8 \
231
    --mysqld=--innodb_autoinc_lock_mode=2 "
232
233
u_common=" --mysqld=--skip-grant-tables \
234
        --mysqld=--innodb_file_per_table  \
235
        --mysqld=--binlog-format=ROW \
236
        --mysqld=--innodb_autoinc_lock_mode=2 \
463 by Raghavendra D Prabhu
Fix the provider
237
        --mysqld=--wsrep-provider=none \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
238
        --mysqld=--innodb_flush_method=O_DIRECT \
239
        --mysqld=--query_cache_type=0 \
240
        --mysqld=--query_cache_size=0 \
241
        --mysqld=--innodb_flush_log_at_trx_commit=0 \
242
        --mysqld=--innodb_buffer_pool_size=500M \
243
        --mysqld=--innodb_log_file_size=500M \
244
        --mysqld=--skip-name-resolve \
245
        --mysqld=--default-storage-engine=InnoDB \
246
        --mysqld=--loose-innodb \
247
        --mysqld=--sql-mode=no_engine_substitution \
248
        --mysqld=--skip-external-locking \
249
        --start-and-exit \
250
        --start-dirty \
251
        --nowarnings \
252
        --nodefault-myisam "
253
254
ver_and_row(){
255
    local sock=$1
256
    
257
258
    $MYSQL_BASEDIR1/bin/mysql -S $sock  -u root -e "show global variables like 'version';"
259
260
    $MYSQL_BASEDIR1/bin/mysql -S $sock  -u root -e "select count(*) from $STABLE;"
261
    $MYSQL_BASEDIR1/bin/mysql -S $sock  -u root -e "select count(*) from $STABLE;"
262
}
263
264
prepare()
265
{
266
    local sock=$1
267
    local log=$2
268
269
    echo "Sysbench Run: Prepare stage"
714 by Raghavendra D Prabhu
Update scripts for sysbench
270
    $SBENCH --test=$LPATH/parallel_prepare.lua --report-interval=10  --oltp-auto-inc=$AUTOINC --mysql-engine-trx=yes --mysql-table-engine=innodb \
465 by Raghavendra D Prabhu
Add new parameter - TCOUNT
271
        --oltp-table-size=$TSIZE --oltp_tables_count=$TCOUNT --mysql-db=test --mysql-user=root  --num-threads=$NUMT \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
272
        --db-driver=mysql --mysql-socket=$sock prepare 2>&1 | tee $log
716 by Raghavendra D Prabhu
Add database creation
273
274
    $MYSQL_BASEDIR1/bin/mysql  -S $sock -u root -e "create database testdb;" || true
455 by Raghavendra D Prabhu
Cleanup the upgrade script
275
}
276
277
rw_full()
278
{
279
280
    local sock=$1
281
    local log=$2
282
    echo "Sysbench Run: OLTP RW testing"
461 by Raghavendra D Prabhu
Fix path
283
    $SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --oltp-auto-inc=$AUTOINC --max-time=$SYSBENCH_DURATION --max-requests=1870000000 \
465 by Raghavendra D Prabhu
Add new parameter - TCOUNT
284
        --test=$SDIR/$STEST.lua --init-rng=on --oltp_index_updates=10 --oltp_non_index_updates=10 --oltp_distinct_ranges=15 --oltp_order_ranges=15 --oltp_tables_count=$TCOUNT --mysql-db=test \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
285
        --mysql-user=root --db-driver=mysql --mysql-socket=$sock  run 2>&1 | tee $log
286
}
287
288
rw_ist()
289
{
290
    local sock=$1
291
    local log=$2
292
293
    echo "Populating for IST"
294
    echo "Sysbench Run: OLTP RW testing"
461 by Raghavendra D Prabhu
Fix path
295
        $SBENCH --mysql-table-engine=innodb --num-threads=1 --report-interval=10 --oltp-auto-inc=$AUTOINC --max-time=10 --max-requests=1870000000 \
714 by Raghavendra D Prabhu
Update scripts for sysbench
296
            --test=$LPATH/oltp.lua --init-rng=on --oltp_index_updates=10 --oltp_non_index_updates=10 --oltp_distinct_ranges=15 --oltp_order_ranges=15 --oltp_tables_count=$TCOUNT --mysql-db=test \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
297
            --mysql-user=root --db-driver=mysql --mysql-socket=$sock  run 2>&1 | tee $log
298
}
299
300
get_script()
301
{
714 by Raghavendra D Prabhu
Update scripts for sysbench
302
303
    if [[ ! -e $SDIR/${STEST}.lua ]];then 
304
        pushd /tmp
305
306
        rm $STEST.lua || true
307
        wget -O $STEST.lua  http://files.wnohang.net/files/${STEST}.lua
308
        export SDIR=/tmp/
309
        popd
310
    fi
311
455 by Raghavendra D Prabhu
Cleanup the upgrade script
312
}
313
471 by Raghavendra D Prabhu
Add compat options
314
reset_compat()
315
{
316
    local gpath=$1
317
    if [[ $gpath == *galera3* ]];then 
318
        COMPAT="; socket.checksum=1"  
319
    else 
320
        COMPAT=""  
321
    fi
322
}
323
324
325
  reset_compat $GALERA1
455 by Raghavendra D Prabhu
Cleanup the upgrade script
326
  echo "Starting $VER1 node"
327
  pushd ${MYSQL_BASEDIR1}/mysql-test/
328
  perl mysql-test-run.pl \
329
    --mysqld=--basedir=${MYSQL_BASEDIR1} \
330
    --port-base=$RBASE1 \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
331
    $common \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
332
    --vardir=$node1 $DBG $MEMOPT $EXTOPTS \
333
    --mysqld=--wsrep-new-cluster \
334
    --mysqld=--wsrep-provider=$GALERA1 \
335
    --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
336
    --mysqld=--wsrep_sst_receive_address=$RADDR1 \
337
    --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
338
    --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${LADDR1}$COMPAT$GDEBUG" \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
339
    --mysqld=--socket=$node1/socket.sock \
340
    --mysqld=--log-error=$WORKDIR/logs/node1.err \
341
    --mysqld=--log-output=none \
342
    1st
343
  popd
344
345
455 by Raghavendra D Prabhu
Cleanup the upgrade script
346
  prepare $node1/socket.sock $WORKDIR/logs/sysbench_prepare.txt 
431 by Raghavendra D Prabhu
Initial draft for PXC-129
347
471 by Raghavendra D Prabhu
Add compat options
348
  reset_compat $GALERA2
431 by Raghavendra D Prabhu
Initial draft for PXC-129
349
  echo "Starting $VER2 node for SST"
350
    pushd ${MYSQL_BASEDIR2}/mysql-test/
351
    perl mysql-test-run.pl \
352
        --mysqld=--basedir=${MYSQL_BASEDIR2} \
353
        --port-base=$RBASE2 \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
354
        $common \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
355
        --vardir=$node2 $DBG $MEMOPT $EXTOPTS \
356
        --mysqld=--wsrep-provider=$GALERA2 \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
357
        --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
358
        --mysqld=--wsrep_sst_receive_address=$RADDR2 \
359
        --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
360
        --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${LADDR2}$COMPAT$GDEBUG" \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
361
        --mysqld=--socket=$node2/socket.sock \
432 by Raghavendra D Prabhu
Updates to compat script
362
        --mysqld=--log-error=$WORKDIR/logs/node2-sst.err \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
363
        --mysqld=--log-output=none \
364
        1st
455 by Raghavendra D Prabhu
Cleanup the upgrade script
365
    popd
431 by Raghavendra D Prabhu
Initial draft for PXC-129
366
367
    echo "Sleeping till SST is complete"
368
    sleep 10
369
455 by Raghavendra D Prabhu
Cleanup the upgrade script
370
    ver_and_row $node2/socket.sock 
371
    ver_and_row $node1/socket.sock
372
441 by Raghavendra D Prabhu
Upgrade the tables
373
431 by Raghavendra D Prabhu
Initial draft for PXC-129
374
    echo "Shutting down node2 after SST"
375
    ${MYSQL_BASEDIR1}/bin/mysqladmin  --socket=$node2/socket.sock -u root shutdown
376
455 by Raghavendra D Prabhu
Cleanup the upgrade script
377
378
    rw_ist $node1/socket.sock $WORKDIR/logs/sysbench_for_ist.txt 
379
380
381
431 by Raghavendra D Prabhu
Initial draft for PXC-129
382
    
383
    sleep 10
384
385
471 by Raghavendra D Prabhu
Add compat options
386
  reset_compat $GALERA2
431 by Raghavendra D Prabhu
Initial draft for PXC-129
387
    pushd ${MYSQL_BASEDIR2}/mysql-test/
432 by Raghavendra D Prabhu
Updates to compat script
388
    echo "Restarting for IST"
431 by Raghavendra D Prabhu
Initial draft for PXC-129
389
    perl mysql-test-run.pl \
390
        --mysqld=--basedir=${MYSQL_BASEDIR2} \
438 by Raghavendra D Prabhu
Fix the bootstrapping
391
        --start-dirty \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
392
        --port-base=$RBASE2 \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
393
        $common \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
394
        --vardir=$node2 $DBG $MEMOPT $EXTOPTS \
432 by Raghavendra D Prabhu
Updates to compat script
395
        --mysqld=--wsrep-provider=$GALERA2 \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
396
        --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
432 by Raghavendra D Prabhu
Updates to compat script
397
        --mysqld=--wsrep_sst_receive_address=$RADDR2 \
398
        --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
399
        --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${LADDR2}$COMPAT$GDEBUG" \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
400
        --mysqld=--socket=$node2/socket.sock \
432 by Raghavendra D Prabhu
Updates to compat script
401
        --mysqld=--log-error=$WORKDIR/logs/node2-ist.err \
431 by Raghavendra D Prabhu
Initial draft for PXC-129
402
        --mysqld=--log-output=none \
403
        1st
455 by Raghavendra D Prabhu
Cleanup the upgrade script
404
    popd
431 by Raghavendra D Prabhu
Initial draft for PXC-129
405
406
    sleep 10
407
455 by Raghavendra D Prabhu
Cleanup the upgrade script
408
    ver_and_row $node2/socket.sock 
409
    ver_and_row $node1/socket.sock
410
411
    get_script
431 by Raghavendra D Prabhu
Initial draft for PXC-129
412
718 by Raghavendra D Prabhu
Add || true for testdb
413
    $MYSQL_BASEDIR1/bin/mysql -S $node1/socket.sock  -u root -e "create database testdb;" || true
431 by Raghavendra D Prabhu
Initial draft for PXC-129
414
455 by Raghavendra D Prabhu
Cleanup the upgrade script
415
    rw_full $sockets  $WORKDIR/logs/sysbench_rw_run.txt 
416
477 by Raghavendra D Prabhu
Fix the comparison
417
    if [[ $VER1 > $VER2 ]];then 
455 by Raghavendra D Prabhu
Cleanup the upgrade script
418
        node_for_upgrade=$VER2 
419
        nodeu=$node2 
420
        pbase=$RBASE2
421
        baseu=$MYSQL_BASEDIR1
422
        ugalera="${baseu}/lib/libgalera_smm.so"
423
        listu=$LADDR2
424
        recvu=$RADDR2
425
    else 
426
        node_for_upgrade=$VER1 
427
        nodeu=$node1 
428
        pbase=$RBASE1
429
        baseu=$MYSQL_BASEDIR2
430
        ugalera="${baseu}/lib/libgalera_smm.so"
431
        listu=$LADDR1
432
        recvu=$RADDR1
433
    fi
474 by Raghavendra D Prabhu
Fix the galera paths
434
    if [[ ! -e $ugalera ]];then 
435
        ugalera="${baseu}/lib/galera3/libgalera_smm.so"
436
    fi
455 by Raghavendra D Prabhu
Cleanup the upgrade script
437
438
    echo "Shutting down $node_for_upgrade  for upgrade"
439
    $MYSQL_BASEDIR1/bin/mysqladmin  --socket=$nodeu/socket.sock -u root shutdown
445 by Raghavendra D Prabhu
Update the script for upgrade testing
440
462 by Raghavendra D Prabhu
Fix paths
441
    pushd ${baseu}/mysql-test/
445 by Raghavendra D Prabhu
Update the script for upgrade testing
442
    perl mysql-test-run.pl \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
443
        --mysqld=--basedir=$baseu \
444
        --port-base=$pbase \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
445
        $u_common \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
446
        --vardir=$nodeu $DBG $MEMOPT $EXTOPTS \
447
        --mysqld=--socket=$nodeu/socket.sock \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
448
        --mysqld=--log-error=$WORKDIR/logs/node1-upgrade.err \
449
        --mysqld=--log-output=none \
450
        1st
462 by Raghavendra D Prabhu
Fix paths
451
    popd
445 by Raghavendra D Prabhu
Update the script for upgrade testing
452
455 by Raghavendra D Prabhu
Cleanup the upgrade script
453
    $baseu/bin/mysql_upgrade -S $nodeu/socket.sock -u root 2>&1 | tee $WORKDIR/logs/mysql_upgrade.log
454
455
    echo "Shutting down $node_for_upgrade after upgrade"
456
    $MYSQL_BASEDIR1/bin/mysqladmin  --socket=$nodeu/socket.sock -u root shutdown
457
458
459
    echo "Starting $node_for_upgrade after upgrade"
460
461
471 by Raghavendra D Prabhu
Add compat options
462
  reset_compat $ugalera
455 by Raghavendra D Prabhu
Cleanup the upgrade script
463
  pushd ${baseu}/mysql-test/
445 by Raghavendra D Prabhu
Update the script for upgrade testing
464
  perl mysql-test-run.pl \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
465
    --mysqld=--basedir=$baseu \
466
    --port-base=$pbase \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
467
    $common \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
468
    --vardir=$nodeu $DBG $MEMOPT $EXTOPTS \
469
    --mysqld=--wsrep-provider=$ugalera \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
470
    --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
471
    --mysqld=--wsrep_sst_receive_address=$recvu \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
472
    --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
473
    --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${listu}$COMPAT$GDEBUG" \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
474
    --mysqld=--socket=$nodeu/socket.sock \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
475
    --mysqld=--log-error=$WORKDIR/logs/node1-postupgrade.err \
476
    --mysqld=--log-output=none \
477
    1st
478
  popd
479
480
455 by Raghavendra D Prabhu
Cleanup the upgrade script
481
    get_script
482
483
    rw_full $sockets  $WORKDIR/logs/sysbench_rw_run-2.txt 
484
485
482 by Raghavendra D Prabhu
Add some sleep
486
    sleep 100
455 by Raghavendra D Prabhu
Cleanup the upgrade script
487
    ver_and_row $node2/socket.sock 
488
    ver_and_row $node1/socket.sock
718 by Raghavendra D Prabhu
Add || true for testdb
489
    $MYSQL_BASEDIR1/bin/mysql -S $node1/socket.sock  -u root -e "drop database testdb;" || true
431 by Raghavendra D Prabhu
Initial draft for PXC-129
490
    $MYSQL_BASEDIR1/bin/mysql -S $node1/socket.sock  -u root -e "drop database test;"
491
482 by Raghavendra D Prabhu
Add some sleep
492
445 by Raghavendra D Prabhu
Update the script for upgrade testing
493
    echo "Shutting down node2 "
432 by Raghavendra D Prabhu
Updates to compat script
494
    $MYSQL_BASEDIR2/bin/mysqladmin  --socket=$node2/socket.sock -u root shutdown
495
496
    sleep 10 
497
445 by Raghavendra D Prabhu
Update the script for upgrade testing
498
    echo "Shutting down node1 "
432 by Raghavendra D Prabhu
Updates to compat script
499
    $MYSQL_BASEDIR2/bin/mysqladmin  --socket=$node1/socket.sock -u root shutdown
500
436 by Raghavendra D Prabhu
Updated for reverse testing
501
502
    echo "TESTING in reverse" 
503
445 by Raghavendra D Prabhu
Update the script for upgrade testing
504
436 by Raghavendra D Prabhu
Updated for reverse testing
505
  node3="${MYSQL_VARDIR}/node3"
506
  mkdir -p $node3
507
  node4="${MYSQL_VARDIR}/node4"
508
  mkdir -p $node4
509
438 by Raghavendra D Prabhu
Fix the bootstrapping
510
  MYSQL_BASEDIR1="${ROOT_FS}/$BASE2"
511
  MYSQL_BASEDIR2="${ROOT_FS}/$BASE1"
512
  GALERA1="${MYSQL_BASEDIR1}/lib/libgalera_smm.so"
513
  GALERA2="${MYSQL_BASEDIR2}/lib/libgalera_smm.so"
474 by Raghavendra D Prabhu
Fix the galera paths
514
    if [[ ! -e $GALERA1 ]];then 
515
        GALERA1="${MYSQL_BASEDIR1}/lib/galera3/libgalera_smm.so"
516
    fi
517
518
    if [[ ! -e $GALERA2 ]];then 
519
        GALERA2="${MYSQL_BASEDIR2}/lib/galera3/libgalera_smm.so"
520
    fi
445 by Raghavendra D Prabhu
Update the script for upgrade testing
521
522
if [[ $DIR -eq 1 ]];then 
523
    sockets="$node3/socket.sock,$node4/socket.sock"
524
elif [[ $DIR -eq 2 ]];then 
525
    sockets="$node4/socket.sock"
526
elif [[ $DIR -eq 3 ]];then 
527
    sockets="$node3/socket.sock"
528
fi
436 by Raghavendra D Prabhu
Updated for reverse testing
529
 
444 by Raghavendra D Prabhu
Cleanup the script
530
  VER1=$LATEST_VER
440 by Raghavendra D Prabhu
Switching the versions
531
  VER2=$(basename $RELEASE_BIN | cut -d- -f4)
436 by Raghavendra D Prabhu
Updated for reverse testing
532
533
  echo "Starting $VER1 node"
534
471 by Raghavendra D Prabhu
Add compat options
535
  reset_compat $GALERA1
436 by Raghavendra D Prabhu
Updated for reverse testing
536
  pushd ${MYSQL_BASEDIR1}/mysql-test/
537
  perl mysql-test-run.pl \
538
    --mysqld=--basedir=${MYSQL_BASEDIR1} \
539
    --port-base=$RBASE1 \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
540
    $common \
436 by Raghavendra D Prabhu
Updated for reverse testing
541
    --vardir=$node3 $DBG $MEMOPT $EXTOPTS \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
542
    --mysqld=--wsrep-new-cluster \
436 by Raghavendra D Prabhu
Updated for reverse testing
543
    --mysqld=--wsrep-provider=$GALERA1 \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
544
    --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
436 by Raghavendra D Prabhu
Updated for reverse testing
545
    --mysqld=--wsrep_sst_receive_address=$RADDR1 \
546
    --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
547
    --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${LADDR1}$COMPAT$GDEBUG" \
436 by Raghavendra D Prabhu
Updated for reverse testing
548
    --mysqld=--socket=$node3/socket.sock \
549
    --mysqld=--log-error=$WORKDIR/logs/node3.err \
550
    --mysqld=--log-output=none \
551
    1st
552
  popd
553
455 by Raghavendra D Prabhu
Cleanup the upgrade script
554
    prepare $node3/socket.sock $WORKDIR/logs/sysbench_prepare_r.txt 
436 by Raghavendra D Prabhu
Updated for reverse testing
555
471 by Raghavendra D Prabhu
Add compat options
556
  reset_compat $GALERA2
436 by Raghavendra D Prabhu
Updated for reverse testing
557
  echo "Starting $VER2 node for SST"
558
    pushd ${MYSQL_BASEDIR2}/mysql-test/
559
    perl mysql-test-run.pl \
560
        --mysqld=--basedir=${MYSQL_BASEDIR2} \
561
        --port-base=$RBASE2 \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
562
        $common \
436 by Raghavendra D Prabhu
Updated for reverse testing
563
        --vardir=$node4 $DBG $MEMOPT $EXTOPTS \
564
        --mysqld=--wsrep-provider=$GALERA2 \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
565
        --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
436 by Raghavendra D Prabhu
Updated for reverse testing
566
        --mysqld=--wsrep_sst_receive_address=$RADDR2 \
567
        --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
568
        --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${LADDR2}$COMPAT$GDEBUG" \
436 by Raghavendra D Prabhu
Updated for reverse testing
569
        --mysqld=--socket=$node4/socket.sock \
570
        --mysqld=--log-error=$WORKDIR/logs/node4-sst.err \
571
        --mysqld=--log-output=none \
572
        1st
455 by Raghavendra D Prabhu
Cleanup the upgrade script
573
    popd
436 by Raghavendra D Prabhu
Updated for reverse testing
574
575
    echo "Sleeping till SST is complete"
576
    sleep 10
577
455 by Raghavendra D Prabhu
Cleanup the upgrade script
578
    ver_and_row $node3/socket.sock 
579
    ver_and_row $node4/socket.sock
436 by Raghavendra D Prabhu
Updated for reverse testing
580
581
    echo "Shutting down node4 after SST"
582
    ${MYSQL_BASEDIR1}/bin/mysqladmin  --socket=$node4/socket.sock -u root shutdown
583
455 by Raghavendra D Prabhu
Cleanup the upgrade script
584
    rw_ist $node3/socket.sock $WORKDIR/logs/sysbench_for_ist_r.txt 
436 by Raghavendra D Prabhu
Updated for reverse testing
585
    sleep 10
586
471 by Raghavendra D Prabhu
Add compat options
587
  reset_compat $GALERA2
436 by Raghavendra D Prabhu
Updated for reverse testing
588
    pushd ${MYSQL_BASEDIR2}/mysql-test/
589
    echo "Restarting for IST"
590
    perl mysql-test-run.pl \
591
        --mysqld=--basedir=${MYSQL_BASEDIR2} \
438 by Raghavendra D Prabhu
Fix the bootstrapping
592
        --start-dirty \
436 by Raghavendra D Prabhu
Updated for reverse testing
593
        --port-base=$RBASE2 \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
594
        $common \
436 by Raghavendra D Prabhu
Updated for reverse testing
595
        --vardir=$node4 $DBG $MEMOPT $EXTOPTS \
596
        --mysqld=--wsrep-provider=$GALERA2 \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
597
        --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
436 by Raghavendra D Prabhu
Updated for reverse testing
598
        --mysqld=--wsrep_sst_receive_address=$RADDR2 \
599
        --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
600
        --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${LADDR2}$COMPAT$GDEBUG" \
436 by Raghavendra D Prabhu
Updated for reverse testing
601
        --mysqld=--socket=$node4/socket.sock \
602
        --mysqld=--log-error=$WORKDIR/logs/node4-ist.err \
603
        --mysqld=--log-output=none \
604
        1st
455 by Raghavendra D Prabhu
Cleanup the upgrade script
605
    popd
436 by Raghavendra D Prabhu
Updated for reverse testing
606
607
    sleep 10
608
455 by Raghavendra D Prabhu
Cleanup the upgrade script
609
    ver_and_row $node3/socket.sock 
610
    ver_and_row $node4/socket.sock
611
612
    get_script
436 by Raghavendra D Prabhu
Updated for reverse testing
613
718 by Raghavendra D Prabhu
Add || true for testdb
614
    $MYSQL_BASEDIR1/bin/mysql -S $node3/socket.sock  -u root -e "create database testdb;" || true
436 by Raghavendra D Prabhu
Updated for reverse testing
615
455 by Raghavendra D Prabhu
Cleanup the upgrade script
616
    rw_full $sockets  $WORKDIR/logs/sysbench_rw_run_r.txt 
617
477 by Raghavendra D Prabhu
Fix the comparison
618
    if [[ $VER1 > $VER2 ]];then 
455 by Raghavendra D Prabhu
Cleanup the upgrade script
619
        node_for_upgrade=$VER2 
620
        nodeu=$node4 
621
        pbase=$RBASE2
622
        baseu=$MYSQL_BASEDIR1
623
        ugalera="${baseu}/lib/libgalera_smm.so"
624
        listu=$LADDR2
625
        recvu=$RADDR2
626
    else 
627
        node_for_upgrade=$VER1 
628
        nodeu=$node2 
629
        pbase=$RBASE1
630
        baseu=$MYSQL_BASEDIR2
631
        ugalera="${baseu}/lib/libgalera_smm.so"
632
        listu=$LADDR1
633
        recvu=$RADDR1
634
    fi
474 by Raghavendra D Prabhu
Fix the galera paths
635
    if [[ ! -e $ugalera ]];then 
636
        ugalera="${baseu}/lib/galera3/libgalera_smm.so"
637
    fi
436 by Raghavendra D Prabhu
Updated for reverse testing
638
445 by Raghavendra D Prabhu
Update the script for upgrade testing
639
    echo "Shutting down node4 for upgrade"
455 by Raghavendra D Prabhu
Cleanup the upgrade script
640
    $baseu/bin/mysqladmin  --socket=$nodeu/socket.sock -u root shutdown
445 by Raghavendra D Prabhu
Update the script for upgrade testing
641
455 by Raghavendra D Prabhu
Cleanup the upgrade script
642
    pushd ${baseu}/mysql-test/
445 by Raghavendra D Prabhu
Update the script for upgrade testing
643
    perl mysql-test-run.pl \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
644
        --mysqld=--basedir=${baseu} \
645
        --port-base=$pbase \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
646
        $u_common \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
647
        --vardir=$nodeu $DBG $MEMOPT $EXTOPTS \
648
        --mysqld=--socket=$nodeu/socket.sock \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
649
        --mysqld=--log-error=$WORKDIR/logs/node4-upgrade.err \
650
        --mysqld=--log-output=none \
651
        1st
652
    popd
653
654
    $MYSQL_BASEDIR1/bin/mysql_upgrade -S $node4/socket.sock -u root 2>&1 | tee $WORKDIR/logs/mysql_upgrade_r.log
655
656
657
    echo "Shutting down node4 after upgrade"
658
    $MYSQL_BASEDIR1/bin/mysqladmin  --socket=$node4/socket.sock -u root shutdown
659
660
    echo "Starting node4 after upgrade"
661
471 by Raghavendra D Prabhu
Add compat options
662
  reset_compat $ugalera
455 by Raghavendra D Prabhu
Cleanup the upgrade script
663
  pushd ${baseu}/mysql-test/
445 by Raghavendra D Prabhu
Update the script for upgrade testing
664
  perl mysql-test-run.pl \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
665
    --mysqld=--basedir=${baseu} \
666
    --port-base=$pbase \
483 by Raghavendra D Prabhu
Moved common before EXTOPTS
667
    $common \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
668
    --vardir=$nodeu $DBG $MEMOPT $EXTOPTS \
669
    --mysqld=--wsrep-provider=$ugalera \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
670
    --mysqld=--wsrep_cluster_address=gcomm://$LADDR1,$LADDR2 \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
671
    --mysqld=--wsrep_sst_receive_address=$recvu \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
672
    --mysqld=--wsrep_node_incoming_address=$ADDR \
481 by Raghavendra D Prabhu
Add new debug options
673
    --mysqld=--wsrep_provider_options="gmcast.listen_addr=tcp://${listu}$COMPAT$GDEBUG" \
455 by Raghavendra D Prabhu
Cleanup the upgrade script
674
    --mysqld=--socket=$nodeu/socket.sock \
445 by Raghavendra D Prabhu
Update the script for upgrade testing
675
    --mysqld=--log-error=$WORKDIR/logs/node4-postupgrade.err \
676
    --mysqld=--log-output=none \
677
    1st
678
  popd
679
680
455 by Raghavendra D Prabhu
Cleanup the upgrade script
681
    get_script
682
452 by Raghavendra D Prabhu
Not drop database for second run
683
    
455 by Raghavendra D Prabhu
Cleanup the upgrade script
684
    rw_full $sockets  $WORKDIR/logs/sysbench_rw_run_r-2.txt 
482 by Raghavendra D Prabhu
Add some sleep
685
    sleep 100
455 by Raghavendra D Prabhu
Cleanup the upgrade script
686
687
    ver_and_row $node3/socket.sock 
688
    ver_and_row $node4/socket.sock
718 by Raghavendra D Prabhu
Add || true for testdb
689
    $MYSQL_BASEDIR1/bin/mysql -S $node3/socket.sock  -u root -e "drop database testdb;" || true
436 by Raghavendra D Prabhu
Updated for reverse testing
690
    $MYSQL_BASEDIR1/bin/mysql -S $node3/socket.sock  -u root -e "drop database test;"
691
692
    echo "Shutting down node4 after IST"
693
    $MYSQL_BASEDIR2/bin/mysqladmin  --socket=$node4/socket.sock -u root shutdown
694
695
    sleep 10 
696
697
    echo "Shutting down node3 after IST"
698
    $MYSQL_BASEDIR2/bin/mysqladmin  --socket=$node3/socket.sock -u root shutdown
699
431 by Raghavendra D Prabhu
Initial draft for PXC-129
700
  exit $EXTSTATUS