forked from Percona-QA/percona-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pxc-async-repl-test.sh
executable file
·1014 lines (884 loc) · 55.3 KB
/
pxc-async-repl-test.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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/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"
PXC_START_TIMEOUT=200
cd $WORKDIR
# For local run - User Configurable Variables
if [ -z ${BUILD_NUMBER} ]; then
BUILD_NUMBER=1001
fi
if [ -z ${SDURATION} ]; then
SDURATION=30
fi
if [ -z ${SST_METHOD} ]; then
SST_METHOD=rsync
fi
if [ -z ${TSIZE} ]; then
TSIZE=500
fi
if [ -z ${NUMT} ]; then
NUMT=16
fi
if [ -z ${TCOUNT} ]; then
TCOUNT=10
fi
#Kill existing mysqld process
ps -ef | grep 'n[0-9].sock' | grep ${BUILD_NUMBER} | grep -v grep | awk '{print $2}' | xargs kill -9 >/dev/null 2>&1 || true
cleanup(){
tar cvzf $ROOT_FS/results-${BUILD_NUMBER}.tar.gz $WORKDIR/logs || true
}
trap cleanup EXIT KILL
if [[ $SST_METHOD == xtrabackup ]];then
SST_METHOD=xtrabackup-v2
TAR=`ls -1ct percona-xtrabackup*.tar.gz | head -n1`
tar -xf $TAR
BBASE=`ls -1td ?ercona-?trabackup* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$BBASE/bin:$PATH"
fi
PXC_TAR=`ls -1td ?ercona-?tra??-?luster* | grep ".tar" | head -n1`
if [ ! -z $PXC_TAR ];then
tar -xzf $PXC_TAR
PXCBASE=`ls -1td ?ercona-?tra??-?luster* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$PXCBASE/bin:$PATH"
fi
PT_TAR=`ls -1td ?ercona-?oolkit* | grep ".tar" | head -n1`
if [ ! -z $PT_TAR ];then
tar -xzf $PT_TAR
PTBASE=`ls -1td ?ercona-?oolkit* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$PTBASE/bin:$PATH"
else
wget https://www.percona.com/downloads/percona-toolkit/2.2.16/tarball/percona-toolkit-2.2.16.tar.gz
PT_TAR=`ls -1td ?ercona-?oolkit* | grep ".tar" | head -n1`
tar -xzf $PT_TAR
PTBASE=`ls -1td ?ercona-?oolkit* | grep -v ".tar" | head -n1`
export PATH="$ROOT_FS/$PTBASE/bin:$PATH"
fi
# Keep (PS & QA) builds & results for ~40 days (~1/day)
BUILD_WIPE=$[ ${BUILD_NUMBER} - 40 ]
if [ -d ${BUILD_WIPE} ]; then rm -Rf ${BUILD_WIPE}; fi
# For Sysbench
if [[ "x${Host}" == "xubuntu-trusty-64bit" ]];then
export CFLAGS="-Wl,--no-undefined -lasan"
fi
if [[ ! -e `which sysbench` ]];then
echo "Sysbench not found"
exit 1
fi
echo "Note: Using sysbench at $(which sysbench)"
WORKDIR="${ROOT_FS}/$BUILD_NUMBER"
PXC_BASEDIR="${ROOT_FS}/$PXCBASE"
#mysql install db check
if [ "$(${PXC_BASEDIR}/bin/mysqld --version | grep -oe '5\.[567]' | head -n1)" == "5.7" ]; then
MID="${PXC_BASEDIR}/bin/mysqld --no-defaults --initialize-insecure --basedir=${PXC_BASEDIR}"
elif [ "$(${PXC_BASEDIR}/bin/mysqld --version | grep -oe '5\.[567]' | head -n1)" == "5.6" ]; then
MID="${PXC_BASEDIR}/scripts/mysql_install_db --no-defaults --basedir=${PXC_BASEDIR}"
fi
export MYSQL_VARDIR="$WORKDIR/mysqldir"
mkdir -p $MYSQL_VARDIR
mkdir -p $WORKDIR/logs
# User settings
SENDMAIL="/usr/sbin/sendmail"
ADDR="127.0.0.1"
RPORT=$(( RANDOM%21 + 10 ))
RBASE1="$(( RPORT*1000 ))"
echo "Setting RBASE to $RBASE1"
RADDR1="$ADDR:$(( RBASE1 + 7 ))"
LADDR1="$ADDR:$(( RBASE1 + 8 ))"
RBASE2="$(( RBASE1 + 100 ))"
RBASE3="$(( RBASE2 + 100 ))"
RBASE4="$(( RBASE3 + 100 ))"
RBASE5="$(( RBASE4 + 100 ))"
RBASE6="$(( RBASE5 + 100 ))"
RADDR2="$ADDR:$(( RBASE2 + 7 ))"
LADDR2="$ADDR:$(( RBASE2 + 8 ))"
RADDR3="$ADDR:$(( RBASE3 + 7 ))"
LADDR3="$ADDR:$(( RBASE3 + 8 ))"
SUSER=root
SPASS=
check_script(){
MPID=$1
if [ ${MPID} -ne 0 ]; then
echo "Assert! ${MPID} empty. Terminating!";
grep "ERROR" ${WORKDIR}/logs/*.err
exit 1;
fi
}
set_pxc_strict_mode(){
MODE=$1
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc1.sock -u root -e "set global pxc_strict_mode=$MODE"
}
function async_rpl_test(){
MYEXTRA_CHECK=$1
node1="${MYSQL_VARDIR}/node1"
node2="${MYSQL_VARDIR}/node2"
node3="${MYSQL_VARDIR}/node3"
psnode1="${MYSQL_VARDIR}/psnode1"
psnode2="${MYSQL_VARDIR}/psnode2"
psnode3="${MYSQL_VARDIR}/psnode3"
rm -Rf $node1 $node2 $node3 $psnode1 $psnode2 $psnode3
if [ "$(${PXC_BASEDIR}/bin/mysqld --version | grep -oe '5\.[567]' | head -n1)" != "5.7" ]; then
mkdir -p $node1 $node2 $node3 $psnode1 $psnode2 $psnode3
fi
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
MYEXTRA="--gtid-mode=ON --log-slave-updates --enforce-gtid-consistency"
fi
function pxc_start(){
STARTUP_OPTION="$1"
echo "Starting PXC node1"
${MID} --datadir=$node1 > ${WORKDIR}/logs/node1.err 2>&1 || exit 1;
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.1 \
--basedir=${PXC_BASEDIR} $STARTUP_OPTION --datadir=$node1 \
--loose-debug-sync-timeout=600 --skip-performance-schema \
--binlog-format=ROW --log-bin=mysql-bin --server-id=100 $MYEXTRA \
--innodb_file_per_table --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 \
--wsrep-provider=${PXC_BASEDIR}/lib/libgalera_smm.so \
--wsrep_cluster_address=gcomm:// \
--wsrep_node_incoming_address=$ADDR \
--wsrep_provider_options=gmcast.listen_addr=tcp://$LADDR1 \
--wsrep_sst_method=$SST_METHOD --wsrep_sst_auth=$SUSER:$SPASS \
--wsrep_node_address=$ADDR --innodb_flush_method=O_DIRECT \
--core-file --loose-new --sql-mode=no_engine_substitution \
--loose-innodb --secure-file-priv= --loose-innodb-status-file=1 \
--log-error=${WORKDIR}/logs/node1.err \
--socket=/tmp/pxc1.sock --log-output=none \
--port=$RBASE1 --wsrep_slave_threads=2 \
--master-info-repository=TABLE --relay-log-info-repository=TABLE > ${WORKDIR}/logs/node1.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc1.sock ping > /dev/null 2>&1; then
break
fi
done
if ! ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc1.sock ping > /dev/null 2>&1; then
echo "PXC startup failed.."
grep "ERROR" ${WORKDIR}/logs/node1.err
fi
sleep 10
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"FLUSH LOGS"
MASTER_LOG_FILE=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e "drop database if exists test;create database test;"
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
echo "CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE1, MASTER_USER='root', MASTER_AUTO_POSITION=1;" > $node1/rpl.sql
else
echo "CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE1, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE', MASTER_LOG_POS=4;" > $node1/rpl.sql
fi
echo "START SLAVE;" >> $node1/rpl.sql
echo "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=/tmp/pxc1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_prepare.txt
check_script $?
echo "Starting PXC node2"
${MID} --datadir=$node2 > ${WORKDIR}/logs/node2.err 2>&1 || exit 1;
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.2 \
--basedir=${PXC_BASEDIR} --datadir=$node2 \
--loose-debug-sync-timeout=600 --skip-performance-schema \
--binlog-format=ROW --log-bin=mysql-bin --server-id=101 $MYEXTRA \
--innodb_file_per_table --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 \
--wsrep-provider=${PXC_BASEDIR}/lib/libgalera_smm.so \
--wsrep_cluster_address=gcomm://$LADDR1 \
--wsrep_node_incoming_address=$ADDR \
--wsrep_provider_options=gmcast.listen_addr=tcp://$LADDR2 \
--wsrep_sst_method=$SST_METHOD --wsrep_sst_auth=$SUSER:$SPASS \
--wsrep_node_address=$ADDR --innodb_flush_method=O_DIRECT \
--core-file --loose-new --sql-mode=no_engine_substitution \
--loose-innodb --secure-file-priv= --loose-innodb-status-file=1 \
--log-error=${WORKDIR}/logs/node2.err \
--socket=/tmp/pxc2.sock --log-output=none \
--port=$RBASE2 --wsrep_slave_threads=2 \
--master-info-repository=TABLE --relay-log-info-repository=TABLE > ${WORKDIR}/logs/node2.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc2.sock ping > /dev/null 2>&1; then
break
fi
done
if ! ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc2.sock ping > /dev/null 2>&1; then
echo "PXC startup failed.."
grep "ERROR" ${WORKDIR}/logs/node2.err
fi
sleep 10
echo "Starting PXC node3"
${MID} --datadir=$node3 > ${WORKDIR}/logs/node3.err 2>&1 || exit 1;
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.2 \
--basedir=${PXC_BASEDIR} --datadir=$node3 \
--loose-debug-sync-timeout=600 --skip-performance-schema \
--binlog-format=ROW --log-bin=mysql-bin --server-id=102 $MYEXTRA \
--innodb_file_per_table --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 \
--wsrep-provider=${PXC_BASEDIR}/lib/libgalera_smm.so \
--wsrep_cluster_address=gcomm://$LADDR1,gcomm://$LADDR2 \
--wsrep_node_incoming_address=$ADDR \
--wsrep_provider_options=gmcast.listen_addr=tcp://$LADDR3 \
--wsrep_sst_method=$SST_METHOD --wsrep_sst_auth=$SUSER:$SPASS \
--wsrep_node_address=$ADDR --innodb_flush_method=O_DIRECT \
--core-file --loose-new --sql-mode=no_engine_substitution \
--loose-innodb --secure-file-priv= --loose-innodb-status-file=1 \
--log-error=${WORKDIR}/logs/node3.err \
--socket=/tmp/pxc3.sock --log-output=none \
--port=$RBASE3 --wsrep_slave_threads=2 \
--master-info-repository=TABLE --relay-log-info-repository=TABLE > ${WORKDIR}/logs/node3.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc3.sock ping > /dev/null 2>&1; then
break
fi
done
if ! ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc3.sock ping > /dev/null 2>&1; then
echo "PXC startup failed.."
grep "ERROR" ${WORKDIR}/logs/node3.err
fi
}
## Start PXC nodes
pxc_start
sleep 10
function ps_start(){
STARTUP_OPTION="$1"
echo "Starting independent PS node1.."
${MID} --datadir=$psnode1 > $WORKDIR/logs/psnode1.err 2>&1 || exit 1;
pushd ${PXC_BASEDIR}/mysql-test/
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.2 \
--basedir=${PXC_BASEDIR} $STARTUP_OPTION --datadir=$psnode1 \
--innodb_file_per_table --default-storage-engine=InnoDB \
--binlog-format=ROW --log-bin=mysql-bin --server-id=103 $MYEXTRA \
--innodb_flush_method=O_DIRECT --core-file --loose-new \
--sql-mode=no_engine_substitution --loose-innodb --secure-file-priv= \
--log-error=$WORKDIR/logs/psnode1.err \
--socket=/tmp/ps1.sock --init-file=$node1/rpl.sql --log-output=none \
--port=$RBASE4 --master-info-repository=TABLE --relay-log-info-repository=TABLE > $WORKDIR/logs/psnode1.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/ps1.sock ping > /dev/null 2>&1; then
break
fi
done
if ! ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/ps1.sock ping > /dev/null 2>&1; then
echo "PS startup failed.."
grep "ERROR" ${WORKDIR}/logs/psnode1.err
fi
echo "Starting independent PS node2.."
${MID} --datadir=$psnode2 > $WORKDIR/logs/psnode2.err 2>&1 || exit 1;
pushd ${PXC_BASEDIR}/mysql-test/
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.2 \
--basedir=${PXC_BASEDIR} $STARTUP_OPTION --datadir=$psnode2 \
--innodb_file_per_table --default-storage-engine=InnoDB \
--binlog-format=ROW --log-bin=mysql-bin --server-id=104 $MYEXTRA \
--innodb_flush_method=O_DIRECT --core-file --loose-new \
--sql-mode=no_engine_substitution --loose-innodb --secure-file-priv= \
--log-error=$WORKDIR/logs/psnode2.err \
--socket=/tmp/ps2.sock --log-output=none \
--port=$RBASE5 --master-info-repository=TABLE --relay-log-info-repository=TABLE > $WORKDIR/logs/psnode2.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/ps2.sock ping > /dev/null 2>&1; then
break
fi
done
if ! ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/ps2.sock ping > /dev/null 2>&1; then
echo "PS startup failed.."
grep "ERROR" ${WORKDIR}/logs/psnode2.err
fi
echo "Starting independent PS node3.."
${MID} --datadir=$psnode3 > $WORKDIR/logs/psnode3.err 2>&1 || exit 1;
pushd ${PXC_BASEDIR}/mysql-test/
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.2 \
--basedir=${PXC_BASEDIR} $STARTUP_OPTION --datadir=$psnode3 \
--innodb_file_per_table --default-storage-engine=InnoDB \
--binlog-format=ROW --log-bin=mysql-bin --server-id=105 $MYEXTRA \
--innodb_flush_method=O_DIRECT --core-file --loose-new \
--sql-mode=no_engine_substitution --loose-innodb --secure-file-priv= \
--log-error=$WORKDIR/logs/psnode3.err \
--socket=/tmp/ps3.sock --log-output=none \
--port=$RBASE6 --master-info-repository=TABLE --relay-log-info-repository=TABLE > $WORKDIR/logs/psnode3.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/ps3.sock ping > /dev/null 2>&1; then
break
fi
done
if ! ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/ps3.sock ping > /dev/null 2>&1; then
echo "PS startup failed.."
grep "ERROR" ${WORKDIR}/logs/psnode3.err
fi
sleep 5
#Creating dsns table for table checkum
echo "drop database if exists percona;create database percona;" | mysql -h${ADDR} -P$RBASE1 -uroot
echo "drop table if exists percona.dsns;create table percona.dsns(id int,parent_id int,dsn varchar(100), primary key(id));" | mysql -h${ADDR} -P$RBASE1 -uroot
echo "insert into percona.dsns (id,dsn) values (1,'h=${ADDR},P=$RBASE1,u=root'),(2,'h=${ADDR},P=$RBASE2,u=root'),(3,'h=${ADDR},P=$RBASE3,u=root');" | mysql -h${ADDR} -P$RBASE1 -uroot
}
## Start PS nodes
ps_start
function node1_master_test(){
echo "******************** $MYEXTRA_CHECK PXC node-1 as master ************************"
#OLTP RW run
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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 --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/pxc1.sock run 2>&1 | tee $WORKDIR/logs/sysbench_rw.log
check_script $?
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/psnode1.err"
exit 1
fi
sleep 5
while [ $SB_MASTER -gt 0 ]; do
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/psnode1.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d test --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns \
--no-check-binlog-format > $WORKDIR/logs/node1_master_checksum.log 2>&1
check_script $?
echo -e "\n1 pxc1. PXC node-1 as master: Checksum result.\n"
cat $WORKDIR/logs/node1_master_checksum.log
set_pxc_strict_mode ENFORCING
}
function node2_master_test(){
echo "******************** $MYEXTRA_CHECK PXC-node-2 becomes master (take over from node-1) ************************"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"stop slave; reset slave all"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"FLUSH LOGS"
MASTER_LOG_FILE=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE2, MASTER_USER='root', MASTER_AUTO_POSITION=1;"
else
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE2, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE', MASTER_LOG_POS=4;"
fi
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"START SLAVE;"
#OLTP RW run
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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 --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/pxc2.sock run 2>&1 | tee $WORKDIR/logs/sysbench_rw.log
check_script $?
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/psnode.err"
exit 1
fi
sleep 5
while [ $SB_MASTER -gt 0 ]; do
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/psnode.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d test --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns --no-check-binlog-format > $WORKDIR/logs/node2_master_checksum.log 2>&1
check_script $?
echo -e "\n2. pxc2. PXC-node-2 becomes master (took over from node-1): Checksum result.\n"
cat $WORKDIR/logs/node2_master_checksum.log
set_pxc_strict_mode ENFORCING
}
function node1_slave_test(){
echo "********************$MYEXTRA_CHECK PXC-as-slave (node-1) from independent master ************************"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e"FLUSH LOGS"
MASTER_LOG_FILE=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_AUTO_POSITION=1;"
else
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE', MASTER_LOG_POS=4;"
fi
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"START SLAVE;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e"create database if not exists ps_test_1"
#OLTP RW run
$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=ps_test_1 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_prepare.txt
check_script $?
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
# OLTP RW run
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=ps_test_1 --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/ps2.sock \
run 2>&1 | tee $WORKDIR/logs/sysbench_ps_rw.log
check_script $?
sleep 5
while [ $SB_MASTER -gt 0 ]; do
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d test,ps_test_1 --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns \
--no-check-binlog-format > $WORKDIR/logs/node1_slave_checksum.log 2>&1
check_script $?
echo -e "\n3. pxc3. PXC-as-slave (node-1) from independent master: Checksum result.\n"
cat $WORKDIR/logs/node1_slave_checksum.log
set_pxc_strict_mode ENFORCING
}
function node2_slave_test(){
echo "********************$MYEXTRA_CHECK PXC-as-slave (node-2) from independent master ************************"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e"FLUSH LOGS"
MASTER_LOG_FILE=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE6, MASTER_USER='root', MASTER_AUTO_POSITION=1;"
else
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE6, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE', MASTER_LOG_POS=4;"
fi
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"START SLAVE;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e"create database if not exists ps_test_2"
#OLTP RW run
$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=ps_test_2 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps3.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_prepare.txt
check_script $?
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node2.err"
exit 1
fi
# OLTP RW run
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=ps_test_2 --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/ps3.sock run 2>&1 | tee $WORKDIR/logs/sysbench_ps_rw.log
check_script $?
sleep 5
while [ $SB_MASTER -gt 0 ]; do
SB_MASTER=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node2.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d test,ps_test_1,ps_test_2 --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns \
--no-check-binlog-format > $WORKDIR/logs/node2_slave_checksum.log 2>&1
check_script $?
echo -e "\n4. PXC-as-slave (node-2) from independent master: Checksum result.\n"
cat $WORKDIR/logs/node2_slave_checksum.log
set_pxc_strict_mode ENFORCING
}
function pxc_master_slave_test(){
echo "********************$MYEXTRA_CHECK PXC - master - and - slave ************************"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"FLUSH LOGS"
MASTER_LOG_FILE=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
echo "Sysbench Run for replication master master test : Prepare stage"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e "drop database if exists master_test;create database master_test;"
$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=master_test --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/pxc2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_ps_prepare.txt
check_script $?
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE2, MASTER_USER='root', MASTER_AUTO_POSITION=1;"
else
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE2, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE', MASTER_LOG_POS=4;"
fi
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e"START SLAVE;"
#OLTP RW run
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=master_test --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/pxc2.sock \
run 2>&1 | tee $WORKDIR/logs/sysbench_ps_rw.log
check_script $?
SB_MASTER=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/ps3.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
sleep 5
while [ $SB_MASTER -gt 0 ]; do
SB_MASTER=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/ps3.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d test,ps_test_1,ps_test_2,master_test --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns \
--no-check-binlog-format > $WORKDIR/logs/pxc_master_slave_checksum.log 2>&1
check_script $?
echo -e "\n5. PXC - master - and - slave: Checksum result.\n"
cat $WORKDIR/logs/pxc_master_slave_checksum.log
set_pxc_strict_mode ENFORCING
}
function pxc_ps_master_slave_shuffle_test(){
echo "********************$MYEXTRA_CHECK PXC - master - and - slave shuffle test ************************"
echo "Stopping PXC node1 for shuffle test"
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc2.sock -u root shutdown > /dev/null 2>&1
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps1.sock run 2>&1 | tee $WORKDIR/logs/sysbench_ps_shuffle_rw.log
check_script $?
echo "Start PXC node2 for shuffle test"
${PXC_BASEDIR}/bin/mysqld --no-defaults --defaults-group-suffix=.2 \
--basedir=${PXC_BASEDIR} --datadir=$node2 \
--loose-debug-sync-timeout=600 --skip-performance-schema \
--binlog-format=ROW --log-bin=mysql-bin --server-id=101 $MYEXTRA \
--innodb_file_per_table --innodb_autoinc_lock_mode=2 --innodb_locks_unsafe_for_binlog=1 \
--wsrep-provider=${PXC_BASEDIR}/lib/libgalera_smm.so \
--wsrep_cluster_address=gcomm://$LADDR1 \
--wsrep_node_incoming_address=$ADDR \
--wsrep_provider_options=gmcast.listen_addr=tcp://$LADDR2 \
--wsrep_sst_method=$SST_METHOD --wsrep_sst_auth=$SUSER:$SPASS \
--wsrep_node_address=$ADDR --innodb_flush_method=O_DIRECT \
--core-file --loose-new --sql-mode=no_engine_substitution \
--loose-innodb --secure-file-priv= --loose-innodb-status-file=1 \
--log-error=${WORKDIR}/logs/node2.err \
--socket=/tmp/pxc2.sock --log-output=none \
--port=$RBASE2 --wsrep_slave_threads=2 \
--master-info-repository=TABLE --relay-log-info-repository=TABLE > ${WORKDIR}/logs/node2.err 2>&1 &
for X in $(seq 0 ${PXC_START_TIMEOUT}); do
sleep 1
if ${PXC_BASEDIR}/bin/mysqladmin -uroot -S/tmp/pxc2.sock ping > /dev/null 2>&1; then
break
fi
done
sleep 10
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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 --mysql-user=root --db-driver=mysql --mysql-socket=/tmp/pxc2.sock \
run 2>&1 | tee $WORKDIR/logs/sysbench_ps_shuffle_rw.log
check_script $?
SB_MASTER=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node2.err"
exit 1
fi
sleep 5
while [ $SB_MASTER -gt 0 ]; do
SB_MASTER=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_MASTER" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node2.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d test --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns \
--no-check-binlog-format > $WORKDIR/logs/pxc_master_slave_shuffle_checksum.log 2>&1
check_script $?
echo -e "\n6. PXC shuffle master - and - slave : Checksum result.\n"
cat $WORKDIR/logs/pxc_master_slave_shuffle_checksum.log
set_pxc_strict_mode ENFORCING
}
function pxc_msr_test(){
echo "********************$MYEXTRA_CHECK PXC - multi source replication test ************************"
#Shutdown PXC/PS servers for MSR test
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc1.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc2.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc3.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps1.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps2.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps3.sock -u root shutdown
# Start PXC and PS servers
rm -Rf $node1 $node2 $node3 $psnode1 $psnode2 $psnode3
if [ "$(${PXC_BASEDIR}/bin/mysqld --version | grep -oe '5\.[567]' | head -n1)" != "5.7" ]; then
mkdir -p $node1 $node2 $node3 $psnode1 $psnode2 $psnode3
fi
pxc_start
ps_start
echo "Sysbench Run for replication master master test : Prepare stage"
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc1.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc2.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc3.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/ps1.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/ps2.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/ps3.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"FLUSH LOGS"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e"FLUSH LOGS"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e"FLUSH LOGS"
MASTER_LOG_FILE_PS1=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
MASTER_LOG_FILE_PS2=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
MASTER_LOG_FILE_PS3=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e "drop database if exists msr_db_master1;create database msr_db_master1;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e "drop database if exists msr_db_master2;create database msr_db_master2;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps3.sock -e "drop database if exists msr_db_master3;create database msr_db_master3;"
# Sysbench dataload for MSR test
$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=msr_db_master1 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_msr_db_master1_prepare.txt
check_script $?
$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=msr_db_master2 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_msr_db_master2_prepare.txt
check_script $?
$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=msr_db_master3 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps3.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_msr_db_master3_prepare.txt
check_script $?
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE4, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'master1';"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'master2';"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE6, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'master3';"
else
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE4, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE_PS1', MASTER_LOG_POS=4 FOR CHANNEL 'master1';"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE_PS2', MASTER_LOG_POS=4 FOR CHANNEL 'master2';"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE6, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE_PS3', MASTER_LOG_POS=4 FOR CHANNEL 'master3';"
fi
# ${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE4, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'master1';"
# ${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'master2';"
# ${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE6, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'master3';"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"START SLAVE;"
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=msr_db_master1 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps1.sock run 2>&1 | tee $WORKDIR/logs/sysbench_ps_channel1_rw.log
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=msr_db_master2 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock run 2>&1 | tee $WORKDIR/logs/sysbench_ps_channel2_rw.log
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=msr_db_master3 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps3.sock run 2>&1 | tee $WORKDIR/logs/sysbench_ps_channel3_rw.log
check_script $?
SB_CHANNEL1=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show slave status for channel 'master1'\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
SB_CHANNEL2=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show slave status for channel 'master2'\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
SB_CHANNEL3=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show slave status for channel 'master3'\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_CHANNEL1" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
if ! [[ "$SB_CHANNEL2" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
if ! [[ "$SB_CHANNEL3" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
sleep 5
while [ $SB_CHANNEL3 -gt 0 ]; do
SB_CHANNEL3=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show slave status for channel 'master3'\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_CHANNEL3" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node1.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d msr_db_master1,msr_db_master2,msr_db_master3 --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns --no-check-binlog-format > $WORKDIR/logs/pxc_msr_checksum.log 2>&1
check_script $?
echo -e "\n7. PXC - multi source replication: Checksum result.\n"
cat $WORKDIR/logs/pxc_msr_checksum.log
set_pxc_strict_mode ENFORCING
}
function pxc_mtr_test(){
echo "********************$MYEXTRA_CHECK PXC - multi thread replication test ************************"
#Shutdown PXC/PS servers for MSR test
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc1.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc2.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc3.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps1.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps2.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps3.sock -u root shutdown
# Start PXC and PS servers
rm -Rf $node1 $node2 $node3 $psnode1 $psnode2 $psnode3
if [ "$(${PXC_BASEDIR}/bin/mysqld --version | grep -oe '5\.[567]' | head -n1)" != "5.7" ]; then
mkdir -p $node1 $node2 $node3 $psnode1 $psnode2 $psnode3
fi
EXTRA="--slave-parallel-workers=5"
pxc_start $EXTRA
ps_start $EXTRA
echo "Sysbench Run for replication master master test : Prepare stage"
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc1.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc2.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/pxc3.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/ps1.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/ps2.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
$PXC_BASEDIR/bin/mysql --socket=/tmp/ps3.sock -u root -e "STOP SLAVE; RESET SLAVE ALL" || true
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e"FLUSH LOGS"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e"FLUSH LOGS"
MASTER_LOG_FILE_N1=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
MASTER_LOG_FILE_PS2=`${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -Bse "show master logs" | awk '{print $1}' | tail -1`
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e "drop database if exists mtr_db_pxc1;create database mtr_db_pxc1;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e "drop database if exists mtr_db_pxc2;create database mtr_db_pxc2;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e "drop database if exists mtr_db_pxc3;create database mtr_db_pxc3;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e "drop database if exists mtr_db_pxc4;create database mtr_db_pxc4;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc1.sock -e "drop database if exists mtr_db_pxc5;create database mtr_db_pxc5;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e "drop database if exists mtr_db_ps1;create database mtr_db_ps1;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e "drop database if exists mtr_db_ps2;create database mtr_db_ps2;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e "drop database if exists mtr_db_ps3;create database mtr_db_ps3;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e "drop database if exists mtr_db_ps4;create database mtr_db_ps4;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps2.sock -e "drop database if exists mtr_db_ps5;create database mtr_db_ps5;"
# Sysbench dataload for MTR test
$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=mtr_db_pxc1 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_pxc1_prepare.txt
check_script $?
$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=mtr_db_pxc2 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_pxc2_prepare.txt
check_script $?
$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=mtr_db_pxc3 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_pxc3_prepare.txt
check_script $?
$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=mtr_db_pxc4 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_pxc4_prepare.txt
check_script $?
$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=mtr_db_pxc5 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_pxc5_prepare.txt
check_script $?
$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=mtr_db_ps1 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_ps1_prepare.txt
check_script $?
$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=mtr_db_ps2 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_ps2_prepare.txt
check_script $?
$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=mtr_db_ps3 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_ps3_prepare.txt
check_script $?
$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=mtr_db_ps4 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_ps4_prepare.txt
check_script $?
$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=mtr_db_ps5 --mysql-user=root --num-threads=$NUMT --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock prepare 2>&1 | tee $WORKDIR/logs/sysbench_mtr_db_ps5_prepare.txt
check_script $?
if [ "$MYEXTRA_CHECK" == "GTID" ]; then
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE1, MASTER_USER='root', MASTER_AUTO_POSITION=1;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_AUTO_POSITION=1;"
else
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE1, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE_N1', MASTER_LOG_POS=4;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"CHANGE MASTER TO MASTER_HOST='${ADDR}', MASTER_PORT=$RBASE5, MASTER_USER='root', MASTER_LOG_FILE='$MASTER_LOG_FILE_PS2', MASTER_LOG_POS=4;"
fi
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/ps1.sock -e"START SLAVE;"
${PXC_BASEDIR}/bin/mysql -uroot --socket=/tmp/pxc2.sock -e"START SLAVE;"
# Sysbench RW MTR test run...
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_pxc1 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock run > $WORKDIR/logs/sysbench_mtr_db_pxc1_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_pxc2 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock run > $WORKDIR/logs/sysbench_mtr_db_pxc2_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_pxc3 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock run > $WORKDIR/logs/sysbench_mtr_db_pxc3_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_pxc4 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock run > $WORKDIR/logs/sysbench_mtr_db_pxc4_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_pxc5 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/pxc1.sock run > $WORKDIR/logs/sysbench_mtr_db_pxc5_rw.log 2>&1 &
check_script $?
# Sysbench RW MTR test run...
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_ps1 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock run > $WORKDIR/logs/sysbench_mtr_db_ps1_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_ps2 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock run > $WORKDIR/logs/sysbench_mtr_db_ps2_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_ps3 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock run > $WORKDIR/logs/sysbench_mtr_db_ps3_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_ps4 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock run > $WORKDIR/logs/sysbench_mtr_db_ps4_rw.log 2>&1 &
check_script $?
$SBENCH --mysql-table-engine=innodb --num-threads=$NUMT --report-interval=10 --max-time=$SDURATION --max-requests=1870000000 \
--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=mtr_db_ps5 --mysql-user=root --db-driver=mysql \
--mysql-socket=/tmp/ps2.sock run > $WORKDIR/logs/sysbench_mtr_db_ps5_rw.log 2>&1 &
check_script $?
SB_PS=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
SB_PXC=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_PXC" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node2.err"
exit 1
fi
if ! [[ "$SB_PS" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/psnode1.err"
exit 1
fi
sleep 5
while [ $SB_PXC -gt 0 ]; do
SB_PXC=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/ps1.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_PXC" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/node2.err"
exit 1
fi
sleep 5
done
while [ $SB_PS -gt 0 ]; do
SB_PS=`$PXC_BASEDIR/bin/mysql -uroot --socket=/tmp/pxc2.sock -Bse "show slave status\G" | grep Seconds_Behind_Master | awk '{ print $2 }'`
if ! [[ "$SB_PS" =~ ^[0-9]+$ ]]; then
echo "Slave is not started yet. Please check error log : $WORKDIR/logs/psnode1.err"
exit 1
fi
sleep 5
done
sleep 5
set_pxc_strict_mode DISABLED
pt-table-checksum h=${ADDR},P=$RBASE1,u=root -d mtr_db_pxc1,mtr_db_pxc2,mtr_db_pxc3,mtr_db_pxc4,mtr_db_pxc5,mtr_db_ps1,mtr_db_ps2,mtr_db_ps3,mtr_db_ps4,mtr_db_ps5 --recursion-method dsn=h=${ADDR},P=$RBASE1,u=root,D=percona,t=dsns --no-check-binlog-format > $WORKDIR/logs/pxc_mtr_checksum.log 2>&1
check_script $?
echo -e "\n8. PXC - multi thread replication: Checksum result.\n"
cat $WORKDIR/logs/pxc_mtr_checksum.log
set_pxc_strict_mode ENFORCING
}
node1_master_test
node2_master_test
node1_slave_test
node2_slave_test
pxc_master_slave_test
pxc_ps_master_slave_shuffle_test
pxc_msr_test
pxc_mtr_test
}
echo "**************** ASYNC REPLICATION TEST RUN WITH GTID ***************"
async_rpl_test GTID
#Shutdown PXC/PS servers
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc1.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc2.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/pxc3.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps1.sock -u root shutdown
$PXC_BASEDIR/bin/mysqladmin --socket=/tmp/ps2.sock -u root shutdown