Skip to content

Commit

Permalink
Added asssert to init_of_queries() to make it more safe
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
montywi committed Sep 25, 2020
1 parent bb2c958 commit 71a7b79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ void THD::init_for_queries()
We don't need to call ha_enable_transaction() as we can't have
any active transactions that has to be committed
*/
DBUG_ASSERT(transaction.is_empty());
transaction.on= TRUE;

reset_root_defaults(mem_root, variables.query_alloc_block_size,
Expand Down
6 changes: 5 additions & 1 deletion sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -2630,10 +2630,14 @@ class THD: public THD_count, /* this must be first */
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
DBUG_VOID_RETURN;
}
my_bool is_active()
bool is_active()
{
return (all.ha_list != NULL);
}
bool is_empty()
{
return all.is_empty() && stmt.is_empty();
}
st_transactions()
{
bzero((char*)this, sizeof(*this));
Expand Down

0 comments on commit 71a7b79

Please sign in to comment.