1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Bug#56452 Assertion failed: thd->transaction.stmt.is_empty() ||

thd->in_sub_stmt
      
In a precursor patch for Bug#52044 
(revid:bzr/kostja@stripped), a
number of reorganizations of code was made. In addition some
assertions were added to ensure the correct transactional state.
      
The reorganization had a small glitch so statements that was
active in the query cache was not followed by a
statement commit/rollback (this code was removed). A section
in the trans_commit_stmt/trans_rollback_stmt code is to
clear the thd->transaction.stmt list of affected storage
engines.  When a new statement is initiated, an assert
introduced by the 523044 patch checks if this list is cleared.
When the query cache is accessed, this list may be populated,
and since it's not committed it will not be cleared.
      
This fix adds explicit statement commit or rollback for
statements that is contained in the query cache.
This commit is contained in:
Magne Mahre
2010-10-06 11:01:24 +02:00
parent e53e16a885
commit 653f14c265
3 changed files with 36 additions and 0 deletions

View File

@ -341,6 +341,7 @@ TODO list:
#include "../storage/myisammrg/ha_myisammrg.h"
#include "../storage/myisammrg/myrg_def.h"
#include "probes_mysql.h"
#include "transaction.h"
#ifdef EMBEDDED_LIBRARY
#include "emb_qcache.h"
@ -1683,6 +1684,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
}
else
thd->lex->safe_to_cache_query= 0; // Don't try to cache this
/* End the statement transaction potentially started by engine. */
trans_rollback_stmt(thd);
goto err_unlock; // Parse query
}
else
@ -1724,6 +1727,13 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d",
thd->limit_found_rows = query->found_rows();
thd->status_var.last_query_cost= 0.0;
/*
End the statement transaction potentially started by an
engine callback. We ignore the return value for now,
since as long as EOF packet is part of the query cache
response, we can't handle it anyway.
*/
(void) trans_commit_stmt(thd);
if (!thd->stmt_da->is_set())
thd->stmt_da->disable_status();