From 34bed41f0df2a3a0af127932f95a1ff297812594 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 23 Apr 2019 20:21:58 +0530 Subject: - Addressed marko's review comments. --- mysql-test/r/xa_debug.result | 254 ------------------------- mysql-test/suite/innodb/r/xa_debug.result | 306 ++++++++++++++++++++++++++++++ mysql-test/suite/innodb/t/xa_debug.test | 33 ++++ mysql-test/t/xa_debug.test | 31 --- storage/innobase/include/trx0trx.h | 16 +- storage/innobase/trx/trx0trx.c | 31 +-- storage/xtradb/include/trx0trx.h | 16 +- storage/xtradb/trx/trx0trx.c | 31 +-- 8 files changed, 351 insertions(+), 367 deletions(-) delete mode 100644 mysql-test/r/xa_debug.result create mode 100644 mysql-test/suite/innodb/r/xa_debug.result create mode 100644 mysql-test/suite/innodb/t/xa_debug.test delete mode 100644 mysql-test/t/xa_debug.test diff --git a/mysql-test/r/xa_debug.result b/mysql-test/r/xa_debug.result deleted file mode 100644 index f35f966de9f..00000000000 --- a/mysql-test/r/xa_debug.result +++ /dev/null @@ -1,254 +0,0 @@ -call mtr.add_suppression("Found 50 prepared XA transactions"); -create table t1 (a int) engine=innodb; -insert into t1 values(1); -test50 -xa start 'test50'; -insert into t1 values(1); -xa end 'test50'; -xa prepare 'test50'; -test49 -xa start 'test49'; -insert into t1 values(1); -xa end 'test49'; -xa prepare 'test49'; -test48 -xa start 'test48'; -insert into t1 values(1); -xa end 'test48'; -xa prepare 'test48'; -test47 -xa start 'test47'; -insert into t1 values(1); -xa end 'test47'; -xa prepare 'test47'; -test46 -xa start 'test46'; -insert into t1 values(1); -xa end 'test46'; -xa prepare 'test46'; -test45 -xa start 'test45'; -insert into t1 values(1); -xa end 'test45'; -xa prepare 'test45'; -test44 -xa start 'test44'; -insert into t1 values(1); -xa end 'test44'; -xa prepare 'test44'; -test43 -xa start 'test43'; -insert into t1 values(1); -xa end 'test43'; -xa prepare 'test43'; -test42 -xa start 'test42'; -insert into t1 values(1); -xa end 'test42'; -xa prepare 'test42'; -test41 -xa start 'test41'; -insert into t1 values(1); -xa end 'test41'; -xa prepare 'test41'; -test40 -xa start 'test40'; -insert into t1 values(1); -xa end 'test40'; -xa prepare 'test40'; -test39 -xa start 'test39'; -insert into t1 values(1); -xa end 'test39'; -xa prepare 'test39'; -test38 -xa start 'test38'; -insert into t1 values(1); -xa end 'test38'; -xa prepare 'test38'; -test37 -xa start 'test37'; -insert into t1 values(1); -xa end 'test37'; -xa prepare 'test37'; -test36 -xa start 'test36'; -insert into t1 values(1); -xa end 'test36'; -xa prepare 'test36'; -test35 -xa start 'test35'; -insert into t1 values(1); -xa end 'test35'; -xa prepare 'test35'; -test34 -xa start 'test34'; -insert into t1 values(1); -xa end 'test34'; -xa prepare 'test34'; -test33 -xa start 'test33'; -insert into t1 values(1); -xa end 'test33'; -xa prepare 'test33'; -test32 -xa start 'test32'; -insert into t1 values(1); -xa end 'test32'; -xa prepare 'test32'; -test31 -xa start 'test31'; -insert into t1 values(1); -xa end 'test31'; -xa prepare 'test31'; -test30 -xa start 'test30'; -insert into t1 values(1); -xa end 'test30'; -xa prepare 'test30'; -test29 -xa start 'test29'; -insert into t1 values(1); -xa end 'test29'; -xa prepare 'test29'; -test28 -xa start 'test28'; -insert into t1 values(1); -xa end 'test28'; -xa prepare 'test28'; -test27 -xa start 'test27'; -insert into t1 values(1); -xa end 'test27'; -xa prepare 'test27'; -test26 -xa start 'test26'; -insert into t1 values(1); -xa end 'test26'; -xa prepare 'test26'; -test25 -xa start 'test25'; -insert into t1 values(1); -xa end 'test25'; -xa prepare 'test25'; -test24 -xa start 'test24'; -insert into t1 values(1); -xa end 'test24'; -xa prepare 'test24'; -test23 -xa start 'test23'; -insert into t1 values(1); -xa end 'test23'; -xa prepare 'test23'; -test22 -xa start 'test22'; -insert into t1 values(1); -xa end 'test22'; -xa prepare 'test22'; -test21 -xa start 'test21'; -insert into t1 values(1); -xa end 'test21'; -xa prepare 'test21'; -test20 -xa start 'test20'; -insert into t1 values(1); -xa end 'test20'; -xa prepare 'test20'; -test19 -xa start 'test19'; -insert into t1 values(1); -xa end 'test19'; -xa prepare 'test19'; -test18 -xa start 'test18'; -insert into t1 values(1); -xa end 'test18'; -xa prepare 'test18'; -test17 -xa start 'test17'; -insert into t1 values(1); -xa end 'test17'; -xa prepare 'test17'; -test16 -xa start 'test16'; -insert into t1 values(1); -xa end 'test16'; -xa prepare 'test16'; -test15 -xa start 'test15'; -insert into t1 values(1); -xa end 'test15'; -xa prepare 'test15'; -test14 -xa start 'test14'; -insert into t1 values(1); -xa end 'test14'; -xa prepare 'test14'; -test13 -xa start 'test13'; -insert into t1 values(1); -xa end 'test13'; -xa prepare 'test13'; -test12 -xa start 'test12'; -insert into t1 values(1); -xa end 'test12'; -xa prepare 'test12'; -test11 -xa start 'test11'; -insert into t1 values(1); -xa end 'test11'; -xa prepare 'test11'; -test10 -xa start 'test10'; -insert into t1 values(1); -xa end 'test10'; -xa prepare 'test10'; -test9 -xa start 'test9'; -insert into t1 values(1); -xa end 'test9'; -xa prepare 'test9'; -test8 -xa start 'test8'; -insert into t1 values(1); -xa end 'test8'; -xa prepare 'test8'; -test7 -xa start 'test7'; -insert into t1 values(1); -xa end 'test7'; -xa prepare 'test7'; -test6 -xa start 'test6'; -insert into t1 values(1); -xa end 'test6'; -xa prepare 'test6'; -test5 -xa start 'test5'; -insert into t1 values(1); -xa end 'test5'; -xa prepare 'test5'; -test4 -xa start 'test4'; -insert into t1 values(1); -xa end 'test4'; -xa prepare 'test4'; -test3 -xa start 'test3'; -insert into t1 values(1); -xa end 'test3'; -xa prepare 'test3'; -test2 -xa start 'test2'; -insert into t1 values(1); -xa end 'test2'; -xa prepare 'test2'; -test1 -xa start 'test1'; -insert into t1 values(1); -xa end 'test1'; -xa prepare 'test1'; -drop table t1; diff --git a/mysql-test/suite/innodb/r/xa_debug.result b/mysql-test/suite/innodb/r/xa_debug.result new file mode 100644 index 00000000000..9aac422c4d4 --- /dev/null +++ b/mysql-test/suite/innodb/r/xa_debug.result @@ -0,0 +1,306 @@ +call mtr.add_suppression("Found 50 prepared XA transactions"); +create table t1 (a int) engine=innodb; +insert into t1 values(1); +test50 +xa start 'test50'; +insert into t1 values(1); +xa end 'test50'; +xa prepare 'test50'; +test49 +xa start 'test49'; +insert into t1 values(1); +xa end 'test49'; +xa prepare 'test49'; +test48 +xa start 'test48'; +insert into t1 values(1); +xa end 'test48'; +xa prepare 'test48'; +test47 +xa start 'test47'; +insert into t1 values(1); +xa end 'test47'; +xa prepare 'test47'; +test46 +xa start 'test46'; +insert into t1 values(1); +xa end 'test46'; +xa prepare 'test46'; +test45 +xa start 'test45'; +insert into t1 values(1); +xa end 'test45'; +xa prepare 'test45'; +test44 +xa start 'test44'; +insert into t1 values(1); +xa end 'test44'; +xa prepare 'test44'; +test43 +xa start 'test43'; +insert into t1 values(1); +xa end 'test43'; +xa prepare 'test43'; +test42 +xa start 'test42'; +insert into t1 values(1); +xa end 'test42'; +xa prepare 'test42'; +test41 +xa start 'test41'; +insert into t1 values(1); +xa end 'test41'; +xa prepare 'test41'; +test40 +xa start 'test40'; +insert into t1 values(1); +xa end 'test40'; +xa prepare 'test40'; +test39 +xa start 'test39'; +insert into t1 values(1); +xa end 'test39'; +xa prepare 'test39'; +test38 +xa start 'test38'; +insert into t1 values(1); +xa end 'test38'; +xa prepare 'test38'; +test37 +xa start 'test37'; +insert into t1 values(1); +xa end 'test37'; +xa prepare 'test37'; +test36 +xa start 'test36'; +insert into t1 values(1); +xa end 'test36'; +xa prepare 'test36'; +test35 +xa start 'test35'; +insert into t1 values(1); +xa end 'test35'; +xa prepare 'test35'; +test34 +xa start 'test34'; +insert into t1 values(1); +xa end 'test34'; +xa prepare 'test34'; +test33 +xa start 'test33'; +insert into t1 values(1); +xa end 'test33'; +xa prepare 'test33'; +test32 +xa start 'test32'; +insert into t1 values(1); +xa end 'test32'; +xa prepare 'test32'; +test31 +xa start 'test31'; +insert into t1 values(1); +xa end 'test31'; +xa prepare 'test31'; +test30 +xa start 'test30'; +insert into t1 values(1); +xa end 'test30'; +xa prepare 'test30'; +test29 +xa start 'test29'; +insert into t1 values(1); +xa end 'test29'; +xa prepare 'test29'; +test28 +xa start 'test28'; +insert into t1 values(1); +xa end 'test28'; +xa prepare 'test28'; +test27 +xa start 'test27'; +insert into t1 values(1); +xa end 'test27'; +xa prepare 'test27'; +test26 +xa start 'test26'; +insert into t1 values(1); +xa end 'test26'; +xa prepare 'test26'; +test25 +xa start 'test25'; +insert into t1 values(1); +xa end 'test25'; +xa prepare 'test25'; +test24 +xa start 'test24'; +insert into t1 values(1); +xa end 'test24'; +xa prepare 'test24'; +test23 +xa start 'test23'; +insert into t1 values(1); +xa end 'test23'; +xa prepare 'test23'; +test22 +xa start 'test22'; +insert into t1 values(1); +xa end 'test22'; +xa prepare 'test22'; +test21 +xa start 'test21'; +insert into t1 values(1); +xa end 'test21'; +xa prepare 'test21'; +test20 +xa start 'test20'; +insert into t1 values(1); +xa end 'test20'; +xa prepare 'test20'; +test19 +xa start 'test19'; +insert into t1 values(1); +xa end 'test19'; +xa prepare 'test19'; +test18 +xa start 'test18'; +insert into t1 values(1); +xa end 'test18'; +xa prepare 'test18'; +test17 +xa start 'test17'; +insert into t1 values(1); +xa end 'test17'; +xa prepare 'test17'; +test16 +xa start 'test16'; +insert into t1 values(1); +xa end 'test16'; +xa prepare 'test16'; +test15 +xa start 'test15'; +insert into t1 values(1); +xa end 'test15'; +xa prepare 'test15'; +test14 +xa start 'test14'; +insert into t1 values(1); +xa end 'test14'; +xa prepare 'test14'; +test13 +xa start 'test13'; +insert into t1 values(1); +xa end 'test13'; +xa prepare 'test13'; +test12 +xa start 'test12'; +insert into t1 values(1); +xa end 'test12'; +xa prepare 'test12'; +test11 +xa start 'test11'; +insert into t1 values(1); +xa end 'test11'; +xa prepare 'test11'; +test10 +xa start 'test10'; +insert into t1 values(1); +xa end 'test10'; +xa prepare 'test10'; +test9 +xa start 'test9'; +insert into t1 values(1); +xa end 'test9'; +xa prepare 'test9'; +test8 +xa start 'test8'; +insert into t1 values(1); +xa end 'test8'; +xa prepare 'test8'; +test7 +xa start 'test7'; +insert into t1 values(1); +xa end 'test7'; +xa prepare 'test7'; +test6 +xa start 'test6'; +insert into t1 values(1); +xa end 'test6'; +xa prepare 'test6'; +test5 +xa start 'test5'; +insert into t1 values(1); +xa end 'test5'; +xa prepare 'test5'; +test4 +xa start 'test4'; +insert into t1 values(1); +xa end 'test4'; +xa prepare 'test4'; +test3 +xa start 'test3'; +insert into t1 values(1); +xa end 'test3'; +xa prepare 'test3'; +test2 +xa start 'test2'; +insert into t1 values(1); +xa end 'test2'; +xa prepare 'test2'; +test1 +xa start 'test1'; +insert into t1 values(1); +xa end 'test1'; +xa prepare 'test1'; +xa recover; +formatID gtrid_length bqual_length data +1 6 0 test50 +1 6 0 test43 +1 6 0 test22 +1 6 0 test14 +1 6 0 test27 +1 6 0 test24 +1 6 0 test26 +1 5 0 test2 +1 6 0 test31 +1 6 0 test30 +1 6 0 test42 +1 6 0 test49 +1 5 0 test4 +1 5 0 test5 +1 6 0 test17 +1 6 0 test35 +1 6 0 test10 +1 5 0 test9 +1 5 0 test6 +1 6 0 test41 +1 6 0 test34 +1 6 0 test37 +1 6 0 test12 +1 6 0 test45 +1 6 0 test44 +1 6 0 test33 +1 6 0 test36 +1 6 0 test39 +1 6 0 test48 +1 6 0 test13 +1 6 0 test21 +1 6 0 test15 +1 6 0 test38 +1 6 0 test11 +1 6 0 test16 +1 5 0 test7 +1 6 0 test40 +1 6 0 test47 +1 6 0 test29 +1 6 0 test28 +1 6 0 test18 +1 5 0 test3 +1 5 0 test1 +1 6 0 test19 +1 6 0 test25 +1 6 0 test32 +1 6 0 test46 +1 6 0 test20 +1 5 0 test8 +1 6 0 test23 +drop table t1; diff --git a/mysql-test/suite/innodb/t/xa_debug.test b/mysql-test/suite/innodb/t/xa_debug.test new file mode 100644 index 00000000000..4c2f1e1fd4e --- /dev/null +++ b/mysql-test/suite/innodb/t/xa_debug.test @@ -0,0 +1,33 @@ +-- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/not_embedded.inc + +call mtr.add_suppression("Found 50 prepared XA transactions"); +create table t1 (a int) engine=innodb; +insert into t1 values(1); + +let $trial = 50; +while ($trial) +{ +--connect (con$trial, localhost, root,,) +let $st_pre = `select concat('test', $trial)`; +echo $st_pre; +eval xa start '$st_pre'; +insert into t1 values(1); +eval xa end '$st_pre'; +eval xa prepare '$st_pre'; +dec $trial; +} + +connection default; +# Kill and restart the server. +-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +-- shutdown_server 0 +-- source include/wait_until_disconnected.inc + +-- exec echo "restart:--debug_dbug=+d,min_xa_len" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +-- enable_reconnect +-- source include/wait_until_connected_again.inc +-- disable_reconnect +xa recover; +drop table t1; diff --git a/mysql-test/t/xa_debug.test b/mysql-test/t/xa_debug.test deleted file mode 100644 index 92ff0e5b50c..00000000000 --- a/mysql-test/t/xa_debug.test +++ /dev/null @@ -1,31 +0,0 @@ --- source include/have_innodb.inc --- source include/not_embedded.inc -call mtr.add_suppression("Found 50 prepared XA transactions"); -create table t1 (a int) engine=innodb; -insert into t1 values(1); - -let $trial = 50; -while ($trial) -{ ---connect (con$trial, localhost, root,,) -let $st_pre = `select concat('test', $trial)`; -echo $st_pre; -eval xa start '$st_pre'; -insert into t1 values(1); -eval xa end '$st_pre'; -eval xa prepare '$st_pre'; -dec $trial; -} - -connection default; -# Kill and restart the server. --- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --- shutdown_server 0 --- source include/wait_until_disconnected.inc - --- exec echo "restart:--debug_dbug=+d,min_xa_len" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --- enable_reconnect --- source include/wait_until_connected_again.inc --- disable_reconnect - -drop table t1; diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 38a281985dc..9fa087bdc43 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -48,18 +48,6 @@ extern ulint trx_n_mysql_transactions; the kernel mutex */ extern ulint trx_n_prepared; -/** Reset the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_reset_xid_list(trx_t* trx); - -/** Set the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_set_xid_list(trx_t* trx); - -/** Get the xid list value of transaction. -@return true if prepared transaction is in xid list. */ -UNIV_INTERN ibool trx_get_xid_list(const trx_t* trx); - /********************************************************************//** Releases the search latch if trx has reserved it. */ UNIV_INTERN @@ -741,8 +729,8 @@ struct trx_struct{ /*------------------------------*/ char detailed_error[256]; /*!< detailed error message for last error, or empty. */ - /* True, if it is present in xid list. */ - ibool is_in_xid_list; + /* True, if it is present in recovered list. */ + ibool ha_recovered; }; #define TRX_MAX_N_THREADS 32 /* maximum number of diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c index 795261687ce..b753676b0a2 100644 --- a/storage/innobase/trx/trx0trx.c +++ b/storage/innobase/trx/trx0trx.c @@ -189,7 +189,7 @@ trx_create( trx->n_autoinc_rows = 0; - trx_reset_xid_list(trx); + trx->ha_recovered = FALSE; /* Remember to free the vector explicitly. */ trx->autoinc_locks = ib_vector_create( @@ -1757,27 +1757,6 @@ trx_mark_sql_stat_end( trx->last_sql_stat_start.least_undo_no = trx->undo_no; } -/** Reset the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_reset_xid_list(trx_t* trx) -{ - trx->is_in_xid_list = FALSE; -} - -/** Set the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_set_xid_list(trx_t* trx) -{ - trx->is_in_xid_list = TRUE; -} - -/** Get the xid list value of transaction -@return true if prepared transaction is in xid list. */ -UNIV_INTERN ibool trx_get_xid_list(const trx_t* trx) -{ - return trx->is_in_xid_list; -} - /**********************************************************************//** Prints info about a transaction to the given file. The caller must own the kernel mutex. */ @@ -2095,7 +2074,7 @@ trx_recover_for_mysql( while (trx) { if (trx->conc_state == TRX_PREPARED - && trx_get_xid_list(trx) == FALSE) { + && trx->ha_recovered == FALSE) { xid_list[count] = trx->xid; if (count == 0) { @@ -2119,7 +2098,7 @@ trx_recover_for_mysql( count++; - trx_set_xid_list(trx); + trx->ha_recovered = TRUE; if (count == len) { break; @@ -2135,9 +2114,7 @@ trx_recover_for_mysql( trx != NULL; trx = UT_LIST_GET_NEXT(trx_list, trx)) { - if (trx_get_xid_list(trx) == TRUE) { - trx_reset_xid_list(trx); - } + trx->ha_recovered = FALSE; } } diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index c3e9faf2c10..be37055c04c 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -48,18 +48,6 @@ extern ulint trx_n_mysql_transactions; the kernel mutex */ extern ulint trx_n_prepared; -/** Reset the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_reset_xid_list(trx_t* trx); - -/** Set the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_set_xid_list(trx_t* trx); - -/** Get the xid list value of transaction. -@return true if prepared transaction is in xid list. */ -UNIV_INTERN ibool trx_get_xid_list(const trx_t* trx); - /********************************************************************//** In XtraDB it is impossible for a transaction to own a search latch outside of InnoDB code, so there is nothing to release on demand. We keep this function to @@ -802,8 +790,8 @@ struct trx_struct{ #define DPAH_SIZE 8192 byte* distinct_page_access_hash; ibool take_stats; - /* True if it is present in xid list. */ - ibool is_in_xid_list; + /* True if it is present in recovered list. */ + ibool ha_recovered; }; #define TRX_MAX_N_THREADS 32 /* maximum number of diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c index 7a91d8fb27f..50125f1940a 100644 --- a/storage/xtradb/trx/trx0trx.c +++ b/storage/xtradb/trx/trx0trx.c @@ -333,7 +333,7 @@ trx_create( trx->autoinc_locks = ib_vector_create( mem_heap_create(sizeof(ib_vector_t) + sizeof(void*) * 4), 4); - trx_reset_xid_list(trx); + trx->ha_recovered = FALSE; return(trx); } @@ -2015,27 +2015,6 @@ trx_mark_sql_stat_end( trx->last_sql_stat_start.least_undo_no = trx->undo_no; } -/** Reset the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_reset_xid_list(trx_t* trx) -{ - trx->is_in_xid_list = FALSE; -} - -/** Set the xid list variable in transaction -@param[in,out] trx prepared transaction. */ -UNIV_INTERN void trx_set_xid_list(trx_t* trx) -{ - trx->is_in_xid_list = TRUE; -} - -/** Get the xid list value of transaction -@return true if prepared transaction is in xid list. */ -UNIV_INTERN ibool trx_get_xid_list(const trx_t* trx) -{ - return trx->is_in_xid_list; -} - /**********************************************************************//** Prints info about a transaction to the given file. The caller must own the kernel mutex. */ @@ -2382,7 +2361,7 @@ trx_recover_for_mysql( while (trx) { if (trx->state == TRX_PREPARED - && trx_get_xid_list(trx) == FALSE) { + && trx->ha_recovered == FALSE) { xid_list[count] = trx->xid; if (count == 0) { @@ -2406,7 +2385,7 @@ trx_recover_for_mysql( count++; - trx_set_xid_list(trx); + trx->ha_recovered = TRUE; if (count == len) { break; @@ -2421,9 +2400,7 @@ trx_recover_for_mysql( trx != NULL; trx = UT_LIST_GET_NEXT(trx_list, trx)) { - if (trx_get_xid_list(trx) == TRUE) { - trx_reset_xid_list(trx); - } + trx->ha_recovered = FALSE; } } -- cgit v1.2.1