summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2019-07-23 13:37:18 +0300
committerAleksey Midenkov <midenok@gmail.com>2019-07-25 21:11:06 +0300
commit1a73444d577ee54ac3ecf752e8436091e932d212 (patch)
tree9a0a7008606c9af4af925e8de2dc0466770b59a0
parentf3eb82f048d342c11fc3869eca2e6faed9a4835d (diff)
downloadmariadb-git-1a73444d577ee54ac3ecf752e8436091e932d212.tar.gz
Cleanups: DELETE HISTORY [MDEV-19814]
* Made make_versioned_*() proxies inline; * Renamed truncate_history to delete_history Part of: MDEV-19814 Server crash in row_upd_del_mark_clust_rec or Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' failed in upd_node_t::make_versioned_helper
-rw-r--r--sql/sql_delete.cc12
-rw-r--r--storage/innobase/include/row0upd.h26
-rw-r--r--storage/innobase/row/row0upd.cc19
3 files changed, 26 insertions, 31 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 0ab80fe7cb8..d31fc127e3c 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -305,8 +305,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
THD_STAGE_INFO(thd, stage_init_update);
- bool truncate_history= table_list->vers_conditions.is_set();
- if (truncate_history)
+ bool delete_history= table_list->vers_conditions.is_set();
+ if (delete_history)
{
if (table_list->is_view_or_derived())
{
@@ -696,7 +696,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
while (!(error=info.read_record()) && !thd->killed &&
! thd->is_error())
{
- if (record_should_be_deleted(thd, table, select, explain, truncate_history))
+ if (record_should_be_deleted(thd, table, select, explain, delete_history))
{
table->file->position(table->record[0]);
if (unlikely((error=
@@ -727,10 +727,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{
if (delete_while_scanning)
delete_record= record_should_be_deleted(thd, table, select, explain,
- truncate_history);
+ delete_history);
if (delete_record)
{
- if (!truncate_history && table->triggers &&
+ if (!delete_history && table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE))
{
@@ -748,7 +748,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (likely(!error))
{
deleted++;
- if (!truncate_history && table->triggers &&
+ if (!delete_history && table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE))
{
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index e00ffda082d..7d716f960c5 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -589,14 +589,6 @@ struct upd_node_t{
/* column assignment list */
ulint magic_n;
- /** Also set row_start = CURRENT_TIMESTAMP/trx->id
- @param[in] trx transaction */
- void make_versioned_update(const trx_t* trx);
- /** Only set row_end = CURRENT_TIMESTAMP/trx->id.
- Do not touch other fields at all.
- @param[in] trx transaction */
- void make_versioned_delete(const trx_t* trx);
-
private:
/** Appends row_start or row_end field to update vector and sets a
CURRENT_TIMESTAMP/trx->id value to it.
@@ -605,6 +597,24 @@ private:
@param[in] trx transaction
@param[in] vers_sys_idx table->row_start or table->row_end */
void make_versioned_helper(const trx_t* trx, ulint idx);
+
+public:
+ /** Also set row_start = CURRENT_TIMESTAMP/trx->id
+ @param[in] trx transaction */
+ void make_versioned_update(const trx_t* trx)
+ {
+ make_versioned_helper(trx, table->vers_start);
+ }
+
+ /** Only set row_end = CURRENT_TIMESTAMP/trx->id.
+ Do not touch other fields at all.
+ @param[in] trx transaction */
+ void make_versioned_delete(const trx_t* trx)
+ {
+ update->n_fields = 0;
+ is_delete = VERSIONED_DELETE;
+ make_versioned_helper(trx, table->vers_end);
+ }
};
#define UPD_NODE_MAGIC_N 1579975
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index c9ad752e96d..c22d422ed86 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -3485,7 +3485,8 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
dict_index_t* clust_index = dict_table_get_first_index(table);
- /* row_create_update_node_for_mysql() pre-allocated this much */
+ /* row_create_update_node_for_mysql() pre-allocated this much.
+ At least one PK column always remains unchanged. */
ut_ad(update->n_fields < ulint(table->n_cols + table->n_v_cols));
update->n_fields++;
@@ -3505,19 +3506,3 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
dfield_set_data(&ufield->new_val, update->vers_sys_value, col->len);
}
-/** Also set row_start = CURRENT_TIMESTAMP/trx->id
-@param[in] trx transaction */
-void upd_node_t::make_versioned_update(const trx_t* trx)
-{
- make_versioned_helper(trx, table->vers_start);
-}
-
-/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
-Do not touch other fields at all.
-@param[in] trx transaction */
-void upd_node_t::make_versioned_delete(const trx_t* trx)
-{
- update->n_fields = 0;
- is_delete = VERSIONED_DELETE;
- make_versioned_helper(trx, table->vers_end);
-}