summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-05-04 14:20:14 +0300
committerMonty <monty@mariadb.org>2020-05-23 12:29:10 +0300
commitd1d472646d578608791dcd33c13ca6b2472e31b2 (patch)
treeaf65d684a565414beb5ca0f8fad79aa03adefdd3 /sql/sql_delete.cc
parent7ae812cf2c904b5c070bccd91131f9fc16649bc4 (diff)
downloadmariadb-git-d1d472646d578608791dcd33c13ca6b2472e31b2.tar.gz
Change THD->transaction to a pointer to enable multiple transactions
All changes (except one) is of type thd->transaction. -> thd->transaction-> thd->transaction points by default to 'thd->default_transaction' This allows us to 'easily' have multiple active transactions for a THD object, like when reading data from the mysql.proc table
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 039ed417078..071fd2ab8ac 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -878,11 +878,11 @@ cleanup:
transactional_table= table->file->has_transactions();
if (!transactional_table && deleted > 0)
- thd->transaction.stmt.modified_non_trans_table=
- thd->transaction.all.modified_non_trans_table= TRUE;
+ thd->transaction->stmt.modified_non_trans_table=
+ thd->transaction->all.modified_non_trans_table= TRUE;
/* See similar binlogging code in sql_update.cc, for comments */
- if (likely((error < 0) || thd->transaction.stmt.modified_non_trans_table))
+ if (likely((error < 0) || thd->transaction->stmt.modified_non_trans_table))
{
if (WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{
@@ -911,7 +911,7 @@ cleanup:
}
}
}
- DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
+ DBUG_ASSERT(transactional_table || !deleted || thd->transaction->stmt.modified_non_trans_table);
if (likely(error < 0) ||
(thd->lex->ignore && !thd->is_error() && !thd->is_fatal_error))
@@ -1332,7 +1332,7 @@ int multi_delete::send_data(List<Item> &values)
{
deleted++;
if (!table->file->has_transactions())
- thd->transaction.stmt.modified_non_trans_table= TRUE;
+ thd->transaction->stmt.modified_non_trans_table= TRUE;
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE))
@@ -1368,17 +1368,17 @@ void multi_delete::abort_result_set()
/* the error was handled or nothing deleted and no side effects return */
if (error_handled ||
- (!thd->transaction.stmt.modified_non_trans_table && !deleted))
+ (!thd->transaction->stmt.modified_non_trans_table && !deleted))
DBUG_VOID_RETURN;
/* Something already deleted so we have to invalidate cache */
if (deleted)
query_cache_invalidate3(thd, delete_tables, 1);
- if (thd->transaction.stmt.modified_non_trans_table)
- thd->transaction.all.modified_non_trans_table= TRUE;
- thd->transaction.all.m_unsafe_rollback_flags|=
- (thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
+ if (thd->transaction->stmt.modified_non_trans_table)
+ thd->transaction->all.modified_non_trans_table= TRUE;
+ thd->transaction->all.m_unsafe_rollback_flags|=
+ (thd->transaction->stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
/*
If rows from the first table only has been deleted and it is
@@ -1400,7 +1400,7 @@ void multi_delete::abort_result_set()
DBUG_VOID_RETURN;
}
- if (thd->transaction.stmt.modified_non_trans_table)
+ if (thd->transaction->stmt.modified_non_trans_table)
{
/*
there is only side effects; to binlog with the error
@@ -1538,7 +1538,7 @@ int multi_delete::do_table_deletes(TABLE *table, SORT_INFO *sort_info,
}
}
if (last_deleted != deleted && !table->file->has_transactions())
- thd->transaction.stmt.modified_non_trans_table= TRUE;
+ thd->transaction->stmt.modified_non_trans_table= TRUE;
end_read_record(&info);
@@ -1566,10 +1566,10 @@ bool multi_delete::send_eof()
/* reset used flags */
THD_STAGE_INFO(thd, stage_end);
- if (thd->transaction.stmt.modified_non_trans_table)
- thd->transaction.all.modified_non_trans_table= TRUE;
- thd->transaction.all.m_unsafe_rollback_flags|=
- (thd->transaction.stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
+ if (thd->transaction->stmt.modified_non_trans_table)
+ thd->transaction->all.modified_non_trans_table= TRUE;
+ thd->transaction->all.m_unsafe_rollback_flags|=
+ (thd->transaction->stmt.m_unsafe_rollback_flags & THD_TRANS::DID_WAIT);
/*
We must invalidate the query cache before binlog writing and
@@ -1580,7 +1580,7 @@ bool multi_delete::send_eof()
query_cache_invalidate3(thd, delete_tables, 1);
}
if (likely((local_error == 0) ||
- thd->transaction.stmt.modified_non_trans_table))
+ thd->transaction->stmt.modified_non_trans_table))
{
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
{