summaryrefslogtreecommitdiff
path: root/storage/innobase/include/trx0trx.h
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-04-24 12:31:24 +0530
committerMarko Mäkelä <marko.makela@mariadb.com>2019-04-24 11:46:14 +0300
commitd5da8ae04d57556f517c0f03afeafe73c6cc75d1 (patch)
treed12ada3a85fbb66d7807a0daf1d755c5cfa4dae3 /storage/innobase/include/trx0trx.h
parentcb8d888c42aa9504db2df686f0e963b99079e287 (diff)
downloadmariadb-git-d5da8ae04d57556f517c0f03afeafe73c6cc75d1.tar.gz
MDEV-15772 Potential list overrun during XA recovery
InnoDB could return the same list again and again if the buffer passed to trx_recover_for_mysql() is smaller than the number of transactions that InnoDB recovered in XA PREPARE state. We introduce the transaction state TRX_PREPARED_RECOVERED, which is like TRX_PREPARED, but will be set during trx_recover_for_mysql() so that each transaction will only be returned once. Because init_server_components() is invoking ha_recover() twice, we must reset the state of the transactions back to TRX_PREPARED after returning the complete list, so that repeated traversals will see the complete list again, instead of seeing an empty list. Without this tweak, the test main.tc_heuristic_recover would hang in MariaDB 10.1.
Diffstat (limited to 'storage/innobase/include/trx0trx.h')
-rw-r--r--storage/innobase/include/trx0trx.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 4ade245f03e..9cbc7987eff 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -741,6 +742,8 @@ struct trx_struct{
#define TRX_ACTIVE 1
#define TRX_COMMITTED_IN_MEMORY 2
#define TRX_PREPARED 3 /* Support for 2PC/XA */
+#define TRX_PREPARED_RECOVERED 4 /* XA PREPARE transaction that
+ was returned to ha_recover() */
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
#define TRX_QUE_RUNNING 0 /* transaction is running */