Back to home page

Enduro/X

 
 

    


0001 #!/bin/bash
0002 ##
0003 ## @brief TMSRV / XA drive re-connect checks
0004 ##
0005 ## @file run-recon.sh
0006 ##
0007 ## -----------------------------------------------------------------------------
0008 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0009 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0010 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0011 ## This software is released under one of the following licenses:
0012 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0013 ## See LICENSE file for full text.
0014 ## -----------------------------------------------------------------------------
0015 ## AGPL license:
0016 ## 
0017 ## This program is free software; you can redistribute it and/or modify it under
0018 ## the terms of the GNU Affero General Public License, version 3 as published
0019 ## by the Free Software Foundation;
0020 ##
0021 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0022 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0023 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0024 ## for more details.
0025 ##
0026 ## You should have received a copy of the GNU Affero General Public License along 
0027 ## with this program; if not, write to the Free Software Foundation, Inc., 
0028 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0029 ##
0030 ## -----------------------------------------------------------------------------
0031 ## A commercial use license is available from Mavimax, Ltd
0032 ## contact@mavimax.com
0033 ## -----------------------------------------------------------------------------
0034 ##
0035 
0036 export TESTNAME="test087_tmsrv"
0037 
0038 PWD=`pwd`
0039 if [ `echo $PWD | grep $TESTNAME ` ]; then
0040     # Do nothing 
0041     echo > /dev/null
0042 else
0043     # started from parent folder
0044     pushd .
0045     echo "Doing cd"
0046     cd $TESTNAME
0047 fi;
0048 
0049 #
0050 # Load shared run functions
0051 #
0052 source ./funcs.sh
0053 
0054 #
0055 # Configure for retry
0056 #
0057 export NDRX_XA_FLAGS="RECON:*:3:100"
0058 
0059 #
0060 # Firstly test with join
0061 #
0062 buildprograms "";
0063 
0064 echo ""
0065 echo "************************************************************************"
0066 echo "Start RECON"
0067 echo "************************************************************************"
0068 
0069 cat << EOF > lib1.rets
0070 xa_open_entry:0:1:0
0071 xa_close_entry:0:1:0
0072 xa_start_entry:-7:2:0
0073 xa_end_entry:-7:2:0
0074 xa_rollback_entry:-7:2:8
0075 xa_prepare_entry:-7:2:-7
0076 xa_commit_entry:0:1:0
0077 xa_recover_entry:0:1:0
0078 xa_forget_entry:-7:2:0
0079 xa_complete_entry:0:1:0
0080 xa_open_entry:0:1:0
0081 xa_close_entry:0:1:0
0082 xa_start_entry:0:1:0
0083 EOF
0084 
0085 cat << EOF > lib2.rets
0086 xa_open_entry:0:1:0
0087 xa_close_entry:0:1:0
0088 xa_start_entry:0:1:0
0089 xa_end_entry:0:1:0
0090 xa_rollback_entry:0:1:0
0091 xa_prepare_entry:0:1:0
0092 xa_commit_entry:0:1:0
0093 xa_recover_entry:0:1:0
0094 xa_forget_entry:0:1:0
0095 xa_complete_entry:0:1:0
0096 xa_open_entry:0:1:0
0097 xa_close_entry:0:1:0
0098 xa_start_entry:0:1:0
0099 EOF
0100 
0101 # start only here, as we want fresh tables...
0102 xadmin start -y || go_out 1
0103 
0104 ERR=`NDRX_CCTAG="RM1" ./atmiclt87 2>&1`
0105 RET=$?
0106 # print the stuff
0107 echo "[$ERR]"
0108 
0109 if [ "X$RET" == "X0" ]; then
0110     echo "atmiclt87 must fail"
0111     go_out 1
0112 fi
0113 
0114 if [[ $ERR != *"TPEABORT"* ]]; then
0115     echo "Expected TPEABORT"
0116     go_out 1
0117 fi
0118 
0119 
0120 #
0121 # Get the final readings...
0122 # 
0123 xadmin stop -y
0124 
0125 # clt: 1 - at boot
0126 # clt: 2 - restart of xa_start
0127 # clt: 2 - restart of xa_end
0128 # srv: 1 - at boot
0129 # srv: 2 - restart of xa_start
0130 # srv: 2 - restart of end
0131 # tms: 3 - at boot (3x threads, incl background?)
0132 # tms: 0 - at prep ( connection closed)
0133 # tms: 3 - rollback (reconn + 2x attempts)
0134 # tms: 2 - forget
0135 # tms: 3 - prep attempts
0136 verify_ulog "RM1" "xa_open" "21";
0137 verify_ulog "RM1" "xa_close" "21";
0138 
0139 # clt 3x start + join after call
0140 # srv 3x start
0141 #
0142 verify_ulog "RM1" "xa_start" "7";
0143 
0144 #
0145 # End must match the start count
0146 #
0147 verify_ulog "RM1" "xa_end" "7";
0148 verify_ulog "RM1" "xa_prepare" "4";
0149 #
0150 # (1x reconnect (for counter))
0151 # 1 org attempt
0152 # 2 re-conn, second attempt OK, gives 8
0153 # 
0154 verify_ulog "RM1" "xa_rollback" "3";
0155 verify_ulog "RM1" "xa_forget" "3";
0156 verify_ulog "RM1" "xa_commit" "0";
0157 verify_logfiles "log1" "0";
0158 
0159 #
0160 # clt - 1x
0161 # srv - 1x
0162 # tms - 2x (main + thread)
0163 # the same for close.
0164 #
0165 verify_ulog "RM2" "xa_open" "4";
0166 verify_ulog "RM2" "xa_close" "4";
0167 verify_ulog "RM2" "xa_prepare" "0";
0168 verify_ulog "RM2" "xa_commit" "0";
0169 verify_ulog "RM2" "xa_rollback" "1";
0170 verify_ulog "RM2" "xa_forget" "0";
0171 verify_logfiles "log2" "0";
0172 
0173 
0174 echo ""
0175 echo "************************************************************************"
0176 echo "COMMIT Retry"
0177 echo "************************************************************************"
0178 
0179 cat << EOF > lib1.rets
0180 xa_open_entry:0:1:0
0181 xa_close_entry:0:1:0
0182 xa_start_entry:0:1:0
0183 xa_end_entry:0:1:0
0184 xa_rollback_entry:0:1:0
0185 xa_prepare_entry:0:1:0
0186 xa_commit_entry:-7:2:0
0187 xa_recover_entry:0:1:0
0188 xa_forget_entry:0:1:0
0189 xa_complete_entry:0:1:0
0190 xa_open_entry:0:1:0
0191 xa_close_entry:0:1:0
0192 xa_start_entry:0:1:0
0193 EOF
0194 
0195 cat << EOF > lib2.rets
0196 xa_open_entry:0:1:0
0197 xa_close_entry:0:1:0
0198 xa_start_entry:0:1:0
0199 xa_end_entry:0:1:0
0200 xa_rollback_entry:0:1:0
0201 xa_prepare_entry:0:1:0
0202 xa_commit_entry:0:1:0
0203 xa_recover_entry:0:1:0
0204 xa_forget_entry:0:1:0
0205 xa_complete_entry:0:1:0
0206 xa_open_entry:0:1:0
0207 xa_close_entry:0:1:0
0208 xa_start_entry:0:1:0
0209 EOF
0210 
0211 clean_ulog;
0212 xadmin start -y || go_out 1
0213 
0214 NDRX_CCTAG="RM1" ./atmiclt87
0215 RET=$?
0216 
0217 if [ "X$RET" != "X0" ]; then
0218     echo "Build atmiclt87 failed"
0219     go_out 1
0220 fi
0221 
0222 #
0223 # Get the final readings...
0224 # 
0225 xadmin stop -y
0226 
0227 #verify results ops...
0228 
0229 # clt: 1
0230 # sv: 1
0231 # tms: 3 (normal)
0232 # tms: 2 (retry)
0233 verify_ulog "RM1" "xa_open" "7";
0234 verify_ulog "RM1" "xa_close" "7";
0235 verify_ulog "RM1" "xa_prepare" "1";
0236 verify_ulog "RM1" "xa_commit" "3";
0237 verify_ulog "RM1" "xa_rollback" "0";
0238 verify_ulog "RM1" "xa_forget" "0";
0239 verify_logfiles "log1" "0"
0240 # check number of suspends (1 - call suspend, 1 - sever end, 1 - client end)
0241 verify_ulog "RM1" "xa_end" "3";
0242 
0243 verify_ulog "RM2" "xa_prepare" "1";
0244 verify_ulog "RM2" "xa_commit" "1";
0245 verify_ulog "RM2" "xa_rollback" "0";
0246 verify_ulog "RM2" "xa_forget" "0";
0247 verify_logfiles "log2" "0"
0248 
0249 echo ""
0250 echo "************************************************************************"
0251 echo "RECOVER Retry"
0252 echo "************************************************************************"
0253 
0254 cat << EOF > lib1.rets
0255 xa_open_entry:0:1:0
0256 xa_close_entry:0:1:0
0257 xa_start_entry:0:1:0
0258 xa_end_entry:0:1:0
0259 xa_rollback_entry:0:1:0
0260 xa_prepare_entry:0:1:0
0261 xa_commit_entry:0:1:0
0262 xa_recover_entry:-7:2:0
0263 xa_forget_entry:0:1:0
0264 xa_complete_entry:0:1:0
0265 xa_open_entry:0:1:0
0266 xa_close_entry:0:1:0
0267 xa_start_entry:0:1:0
0268 EOF
0269 
0270 cat << EOF > lib2.rets
0271 xa_open_entry:0:1:0
0272 xa_close_entry:0:1:0
0273 xa_start_entry:0:1:0
0274 xa_end_entry:0:1:0
0275 xa_rollback_entry:0:1:0
0276 xa_prepare_entry:0:1:0
0277 xa_commit_entry:0:1:0
0278 xa_recover_entry:-7:2:0
0279 xa_forget_entry:0:1:0
0280 xa_complete_entry:0:1:0
0281 xa_open_entry:0:1:0
0282 xa_close_entry:0:1:0
0283 xa_start_entry:0:1:0
0284 EOF
0285 
0286 clean_ulog;
0287 xadmin start -y || go_out 1
0288 
0289 NDRX_CCTAG="RM1" tmrecovercl
0290 RET=$?
0291 
0292 if [ "X$RET" != "X0" ]; then
0293     echo "Build atmiclt87 failed"
0294     go_out 1
0295 fi
0296 
0297 #
0298 # Get the final readings...
0299 # 
0300 xadmin stop -y
0301 
0302 #
0303 # tms: 3x std opens (main, bgthr, worker)
0304 # tms: 2x recons on recover
0305 # tms: 1x atmisv con
0306 #
0307 verify_ulog "RM1" "xa_open" "6";
0308 verify_ulog "RM1" "xa_close" "6";
0309 verify_ulog "RM1" "xa_prepare" "0";
0310 verify_ulog "RM1" "xa_commit" "0";
0311 verify_ulog "RM1" "xa_rollback" "0";
0312 verify_ulog "RM1" "xa_forget" "0";
0313 # 
0314 # 1x Org attempt
0315 # 2x retries
0316 #
0317 verify_ulog "RM1" "xa_recover" "3";
0318 verify_logfiles "log1" "0"
0319 verify_ulog "RM1" "xa_end" "0";
0320 
0321 verify_ulog "RM2" "xa_open" "6";
0322 verify_ulog "RM2" "xa_close" "6";
0323 verify_ulog "RM2" "xa_prepare" "0";
0324 verify_ulog "RM2" "xa_commit" "0";
0325 verify_ulog "RM2" "xa_rollback" "0";
0326 verify_ulog "RM2" "xa_forget" "0";
0327 verify_ulog "RM2" "xa_recover" "3";
0328 verify_logfiles "log2" "0"
0329 
0330 echo ""
0331 echo "************************************************************************"
0332 echo "OPEN/CLOSE Retry (system does not start...)"
0333 echo "************************************************************************"
0334 
0335 cat << EOF > lib1.rets
0336 xa_open_entry:-5:2:0
0337 xa_close_entry:-7:2:0
0338 xa_start_entry:0:1:0
0339 xa_end_entry:0:1:0
0340 xa_rollback_entry:0:1:0
0341 xa_prepare_entry:0:1:0
0342 xa_commit_entry:0:1:0
0343 xa_recover_entry:0:1:0
0344 xa_forget_entry:0:1:0
0345 xa_complete_entry:0:1:0
0346 xa_open_entry:0:1:0
0347 xa_close_entry:0:1:0
0348 xa_start_entry:0:1:0
0349 EOF
0350 
0351 cat << EOF > lib2.rets
0352 xa_open_entry:-5:1:0
0353 xa_close_entry:-7:1:0
0354 xa_start_entry:0:1:0
0355 xa_end_entry:0:1:0
0356 xa_rollback_entry:0:1:0
0357 xa_prepare_entry:0:1:0
0358 xa_commit_entry:0:1:0
0359 xa_recover_entry:0:1:0
0360 xa_forget_entry:0:1:0
0361 xa_complete_entry:0:1:0
0362 xa_open_entry:0:1:0
0363 xa_close_entry:0:1:0
0364 xa_start_entry:0:1:0
0365 EOF
0366 
0367 clean_ulog;
0368 xadmin start -y || go_out 1
0369 
0370 ERR=`NDRX_CCTAG="RM1" ./atmiclt87 2>&1`
0371 RET=$?
0372 # print the stuff
0373 echo "[$ERR]"
0374 
0375 if [ "X$RET" == "X0" ]; then
0376     echo "atmiclt87 must fail"
0377     go_out 1
0378 fi
0379 
0380 if [[ $ERR != *"TPERMERR"* ]]; then
0381     echo "Expected TPERMERR"
0382     go_out 1
0383 fi
0384 
0385 xadmin stop -y
0386 
0387 echo ""
0388 echo "************************************************************************"
0389 echo "Prepare Retry, other err -> TPEABORT"
0390 echo "************************************************************************"
0391 
0392 cat << EOF > lib1.rets
0393 xa_open_entry:0:1:0
0394 xa_close_entry:0:1:0
0395 xa_start_entry:0:1:0
0396 xa_end_entry:0:1:0
0397 xa_rollback_entry:0:1:0
0398 xa_prepare_entry:-3:1:0
0399 xa_commit_entry:0:2:0
0400 xa_recover_entry:0:1:0
0401 xa_forget_entry:0:1:0
0402 xa_complete_entry:0:1:0
0403 xa_open_entry:0:1:0
0404 xa_close_entry:0:1:0
0405 xa_start_entry:0:1:0
0406 EOF
0407 
0408 cat << EOF > lib2.rets
0409 xa_open_entry:0:1:0
0410 xa_close_entry:0:1:0
0411 xa_start_entry:0:1:0
0412 xa_end_entry:0:1:0
0413 xa_rollback_entry:0:1:0
0414 xa_prepare_entry:0:1:0
0415 xa_commit_entry:0:1:0
0416 xa_recover_entry:0:1:0
0417 xa_forget_entry:0:1:0
0418 xa_complete_entry:0:1:0
0419 xa_open_entry:0:1:0
0420 xa_close_entry:0:1:0
0421 xa_start_entry:0:1:0
0422 EOF
0423 
0424 clean_ulog;
0425 xadmin start -y || go_out 1
0426 
0427 ERR=`NDRX_CCTAG="RM1" ./atmiclt87 2>&1`
0428 RET=$?
0429 # print the stuff
0430 echo "[$ERR]"
0431 
0432 if [ "X$RET" == "X0" ]; then
0433     echo "atmiclt87 must fail"
0434     go_out 1
0435 fi
0436 
0437 if [[ $ERR != *"TPEABORT"* ]]; then
0438     echo "Expected TPEABORT"
0439     go_out 1
0440 fi
0441 
0442 #
0443 # Get the final readings...
0444 # 
0445 xadmin stop -y
0446 
0447 echo ""
0448 echo "************************************************************************"
0449 echo "Prepare Retry, other err configred recon"
0450 echo "************************************************************************"
0451 
0452 cat << EOF > lib1.rets
0453 xa_open_entry:0:1:0
0454 xa_close_entry:0:1:0
0455 xa_start_entry:0:1:0
0456 xa_end_entry:0:1:0
0457 xa_rollback_entry:0:1:0
0458 xa_prepare_entry:-3:1:0
0459 xa_commit_entry:0:1:0
0460 xa_recover_entry:0:1:0
0461 xa_forget_entry:0:1:0
0462 xa_complete_entry:0:1:0
0463 xa_open_entry:0:1:0
0464 xa_close_entry:0:1:0
0465 xa_start_entry:0:1:0
0466 EOF
0467 
0468 cat << EOF > lib2.rets
0469 xa_open_entry:0:1:0
0470 xa_close_entry:0:1:0
0471 xa_start_entry:0:1:0
0472 xa_end_entry:0:1:0
0473 xa_rollback_entry:0:1:0
0474 xa_prepare_entry:0:1:0
0475 xa_commit_entry:0:1:0
0476 xa_recover_entry:0:1:0
0477 xa_forget_entry:0:1:0
0478 xa_complete_entry:0:1:0
0479 xa_open_entry:0:1:0
0480 xa_close_entry:0:1:0
0481 xa_start_entry:0:1:0
0482 EOF
0483 
0484 export NDRX_XA_FLAGS="RECON:*:3:100:-3,-7"
0485 clean_ulog;
0486 xadmin start -y || go_out 1
0487 
0488 NDRX_CCTAG="RM1" ./atmiclt87
0489 RET=$?
0490 
0491 if [ "X$RET" != "X0" ]; then
0492     echo "Build atmiclt87 failed"
0493     go_out 1
0494 fi
0495 
0496 
0497 go_out 0
0498 
0499 # vim: set ts=4 sw=4 et smartindent: