Skip to content

Commit 71a7b79

Browse files
committed
Added asssert to init_of_queries() to make it more safe
Part of review of 10.4 code by Sergei. Other things: - Changed return type if is_active() from my_bool to bool as this is only used by C++ code.
1 parent bb2c958 commit 71a7b79

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sql/sql_class.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,7 @@ void THD::init_for_queries()
13861386
We don't need to call ha_enable_transaction() as we can't have
13871387
any active transactions that has to be committed
13881388
*/
1389+
DBUG_ASSERT(transaction.is_empty());
13891390
transaction.on= TRUE;
13901391

13911392
reset_root_defaults(mem_root, variables.query_alloc_block_size,

sql/sql_class.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2630,10 +2630,14 @@ class THD: public THD_count, /* this must be first */
26302630
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
26312631
DBUG_VOID_RETURN;
26322632
}
2633-
my_bool is_active()
2633+
bool is_active()
26342634
{
26352635
return (all.ha_list != NULL);
26362636
}
2637+
bool is_empty()
2638+
{
2639+
return all.is_empty() && stmt.is_empty();
2640+
}
26372641
st_transactions()
26382642
{
26392643
bzero((char*)this, sizeof(*this));

0 commit comments

Comments
 (0)