Skip to content

Commit b35bcad

Browse files
committed
Merge pull request #94 from mohitj1988/PSTRESS-154
PSTRESS-154 - Add RR support in pstress How to use RR: GitHub: https://github.com/rr-debugger/rr Install and Build: https://github.com/rr-debugger/rr/wiki/Building-And-Installing
2 parents 3e0ed9d + 34d4ce1 commit b35bcad

File tree

6 files changed

+71
-6
lines changed

6 files changed

+71
-6
lines changed

pstress/pstress-run-57.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,9 @@ GRP_RPL_CLUSTER_RUN=0
185185
# Default GR configuration file for multi-node pstress runs #
186186
################################################################################
187187
GR_CLUSTER_CONFIG=${SCRIPT_PWD}/pstress-cluster-run.cfg
188+
189+
################################################################################
190+
# To record and replay crashes, run pstress in RR mode #
191+
# To enable set RR_MODE=1 #
192+
################################################################################
193+
RR_MODE=0

pstress/pstress-run-80.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,9 @@ GRP_RPL_CLUSTER_RUN=0
189189
# Default GR configuration file for multi-node pstress runs #
190190
################################################################################
191191
GR_CLUSTER_CONFIG=${SCRIPT_PWD}/pstress-cluster-run.cfg
192+
193+
################################################################################
194+
# To record and replay crashes, run pstress in RR mode #
195+
# To enable set RR_MODE=1 #
196+
################################################################################
197+
RR_MODE=0

pstress/pstress-run-PXC57.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,9 @@ PXC_WSREP_PROVIDER_ADD_RANDOM_WSREP_PROVIDER_CONFIG_OPTIONS=0
204204
# Maximum number of PXC wsrep provider (Galera) configuration options to add #
205205
################################################################################
206206
PXC_WSREP_PROVIDER_MAX_NR_OF_RND_OPTS_TO_ADD=2
207+
208+
################################################################################
209+
# To record and replay crashes, run pstress in RR mode #
210+
# To enable set RR_MODE=1 #
211+
################################################################################
212+
RR_MODE=0

pstress/pstress-run-PXC80.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,9 @@ PXC_WSREP_PROVIDER_ADD_RANDOM_WSREP_PROVIDER_CONFIG_OPTIONS=0
216216
# Maximum number of PXC wsrep provider (Galera) configuration options to add #
217217
################################################################################
218218
PXC_WSREP_PROVIDER_MAX_NR_OF_RND_OPTS_TO_ADD=2
219+
220+
################################################################################
221+
# To record and replay crashes, run pstress in RR mode #
222+
# To enable set RR_MODE=1 #
223+
################################################################################
224+
RR_MODE=0

pstress/pstress-run-rocksdb.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,9 @@ MYINIT=
152152
# Extra options to pass to mysqld during server start #
153153
################################################################################
154154
MYEXTRA=
155+
156+
################################################################################
157+
# To record and replay crashes, run pstress in RR mode #
158+
# To enable set RR_MODE=1 #
159+
################################################################################
160+
RR_MODE=0

pstress/pstress-run.sh

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,24 @@ EOF
176176
fi
177177
}
178178

179+
# Incase, user starts pstress in RR mode, check if RR is installed on the machine
180+
if [ $RR_MODE -eq 1 ]; then
181+
echoit "Running pstress in RR mode. It is expected that pstress executions will be slower"
182+
if [[ ! -e `which rr` ]];then
183+
echo "rr package is not installed. Exiting"
184+
echo "Install rr: https://github.com/rr-debugger/rr/wiki/Building-And-Installing"
185+
exit 1
186+
else
187+
perf_event_var=$(cat /proc/sys/kernel/perf_event_paranoid)
188+
if [ $perf_event_var -ne 1 ]; then
189+
echo "rr needs /proc/sys/kernel/perf_event_paranoid <=1, but it is $perf_event_var"
190+
echo "Change it to 1, consider running sudo sysctl -w kernel.perf_event_paranoid=1"
191+
echo "For more information https://github.com/rr-debugger/rr/wiki/Building-And-Installing"
192+
exit 1
193+
fi
194+
fi
195+
fi
196+
179197
# Find mysqld binary
180198
if [ -r ${BASEDIR}/bin/mysqld ]; then
181199
BIN=${BASEDIR}/bin/mysqld
@@ -480,15 +498,27 @@ pxc_startup(){
480498
sed -i "2i wsrep_cluster_address=gcomm://${PXC_LADDRS[1]},${PXC_LADDRS[2]},${PXC_LADDRS[3]}" ${DATADIR}/n3.cnf
481499

482500
get_error_socket_file 1
483-
${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n1.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA --wsrep-new-cluster > ${ERR_FILE} 2>&1 &
501+
if [ $RR_MODE -eq 1 ]; then
502+
rr ${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n1.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA --wsrep-new-cluster > ${ERR_FILE} 2>&1 &
503+
elif [ $RR_MODE -eq 0 ]; then
504+
${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n1.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA --wsrep-new-cluster > ${ERR_FILE} 2>&1 &
505+
fi
484506
pxc_startup_status 1
485507

486508
get_error_socket_file 2
487-
${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n2.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA > ${ERR_FILE} 2>&1 &
509+
if [ $RR_MODE -eq 1 ]; then
510+
rr ${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n2.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA > ${ERR_FILE} 2>&1 &
511+
elif [ $RR_MODE -eq 0 ]; then
512+
${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n2.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA > ${ERR_FILE} 2>&1 &
513+
fi
488514
pxc_startup_status 2
489515

490516
get_error_socket_file 3
491-
${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n3.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA > ${ERR_FILE} 2>&1 &
517+
if [ $RR_MODE -eq 1 ]; then
518+
rr ${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n3.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA > ${ERR_FILE} 2>&1 &
519+
elif [ $RR_MODE -eq 0 ]; then
520+
${BASEDIR}/bin/mysqld --defaults-file=${DATADIR}/n3.cnf $STARTUP_OPTION $MYEXTRA $PXC_MYEXTRA > ${ERR_FILE} 2>&1 &
521+
fi
492522
pxc_startup_status 3
493523

494524
if [ "$IS_STARTUP" == "startup" ]; then
@@ -905,6 +935,9 @@ pstress_test(){
905935
--log-output=none --log-error-verbosity=3 --log-error=${RUNDIR}/${TRIAL}/log/master.err"
906936
fi
907937

938+
if [ $RR_MODE -eq 1 ]; then
939+
CMD="rr $CMD"
940+
fi
908941
echo $CMD
909942
$CMD > ${RUNDIR}/${TRIAL}/log/master.err 2>&1 &
910943
MPID="$!"
@@ -1481,19 +1514,21 @@ elif [[ ${PXC} -eq 1 || ${GRP_RPL} -eq 1 ]]; then
14811514
if ${BASEDIR}/bin/mysqladmin -uroot -S${WORKDIR}/node1.template/node1_socket.sock ping > /dev/null 2>&1; then
14821515
echoit "PXC node1.template started" ;
14831516
else
1484-
echoit "Assert: PXC data template creation failed.."
1517+
echoit "Assert: PXC data template1 creation failed.."
14851518
exit 1
14861519
fi
1520+
sleep 2
14871521
if ${BASEDIR}/bin/mysqladmin -uroot -S${WORKDIR}/node2.template/node2_socket.sock ping > /dev/null 2>&1; then
14881522
echoit "PXC node2.template started" ;
14891523
else
1490-
echoit "Assert: PXC data template creation failed.."
1524+
echoit "Assert: PXC data template2 creation failed.."
14911525
exit 1
14921526
fi
1527+
sleep 2
14931528
if ${BASEDIR}/bin/mysqladmin -uroot -S${WORKDIR}/node3.template/node3_socket.sock ping > /dev/null 2>&1; then
14941529
echoit "PXC node3.template started" ;
14951530
else
1496-
echoit "Assert: PXC data template creation failed.."
1531+
echoit "Assert: PXC data template3 creation failed.."
14971532
exit 1
14981533
fi
14991534
echoit "Created PXC data templates for pstress run.."

0 commit comments

Comments
 (0)