MDEV-11236 Failing assertion: state == TRX_STATE_NOT_STARTED

trx_state_eq(): Add the parameter bool relaxed=false, to
allow trx->state==TRX_STATE_NOT_STARTED where a different
state is expected, if an error has been reported.

trx_release_savepoint_for_mysql(): Pass relaxed=true to
trx_state_eq(). That is, allow the transaction to be idle
when ROLLBACK TO SAVEPOINT is attempted after an error
has been reported to the client.
This commit is contained in:
Marko Mäkelä 2016-12-02 16:25:47 +02:00
commit f1b80d8ef1
8 changed files with 107 additions and 9 deletions

View file

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, MariaDB Corporation. All Rights Reserved.
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
@ -36,10 +37,14 @@ ibool
trx_state_eq(
/*=========*/
const trx_t* trx, /*!< in: transaction */
trx_state_t state) /*!< in: state;
trx_state_t state, /*!< in: state;
if state != TRX_STATE_NOT_STARTED
asserts that
trx->state != TRX_STATE_NOT_STARTED */
bool relaxed)
/*!< in: whether to allow
trx->state == TRX_STATE_NOT_STARTED
after an error has been reported */
{
#ifdef UNIV_DEBUG
switch (trx->state) {
@ -57,7 +62,9 @@ trx_state_eq(
case TRX_STATE_NOT_STARTED:
/* This state is not allowed for running transactions. */
ut_a(state == TRX_STATE_NOT_STARTED);
ut_a(state == TRX_STATE_NOT_STARTED
|| (relaxed
&& thd_get_error_number(trx->mysql_thd)));
ut_ad(!trx->in_rw_trx_list);
ut_ad(!trx->in_ro_trx_list);
return(state == trx->state);