Skip to content

Commit 1a73444

Browse files
committed
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
1 parent f3eb82f commit 1a73444

File tree

3 files changed

+26
-31
lines changed

3 files changed

+26
-31
lines changed

sql/sql_delete.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
305305

306306
THD_STAGE_INFO(thd, stage_init_update);
307307

308-
bool truncate_history= table_list->vers_conditions.is_set();
309-
if (truncate_history)
308+
bool delete_history= table_list->vers_conditions.is_set();
309+
if (delete_history)
310310
{
311311
if (table_list->is_view_or_derived())
312312
{
@@ -696,7 +696,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
696696
while (!(error=info.read_record()) && !thd->killed &&
697697
! thd->is_error())
698698
{
699-
if (record_should_be_deleted(thd, table, select, explain, truncate_history))
699+
if (record_should_be_deleted(thd, table, select, explain, delete_history))
700700
{
701701
table->file->position(table->record[0]);
702702
if (unlikely((error=
@@ -727,10 +727,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
727727
{
728728
if (delete_while_scanning)
729729
delete_record= record_should_be_deleted(thd, table, select, explain,
730-
truncate_history);
730+
delete_history);
731731
if (delete_record)
732732
{
733-
if (!truncate_history && table->triggers &&
733+
if (!delete_history && table->triggers &&
734734
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
735735
TRG_ACTION_BEFORE, FALSE))
736736
{
@@ -748,7 +748,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
748748
if (likely(!error))
749749
{
750750
deleted++;
751-
if (!truncate_history && table->triggers &&
751+
if (!delete_history && table->triggers &&
752752
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
753753
TRG_ACTION_AFTER, FALSE))
754754
{

storage/innobase/include/row0upd.h

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,6 @@ struct upd_node_t{
589589
/* column assignment list */
590590
ulint magic_n;
591591

592-
/** Also set row_start = CURRENT_TIMESTAMP/trx->id
593-
@param[in] trx transaction */
594-
void make_versioned_update(const trx_t* trx);
595-
/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
596-
Do not touch other fields at all.
597-
@param[in] trx transaction */
598-
void make_versioned_delete(const trx_t* trx);
599-
600592
private:
601593
/** Appends row_start or row_end field to update vector and sets a
602594
CURRENT_TIMESTAMP/trx->id value to it.
@@ -605,6 +597,24 @@ struct upd_node_t{
605597
@param[in] trx transaction
606598
@param[in] vers_sys_idx table->row_start or table->row_end */
607599
void make_versioned_helper(const trx_t* trx, ulint idx);
600+
601+
public:
602+
/** Also set row_start = CURRENT_TIMESTAMP/trx->id
603+
@param[in] trx transaction */
604+
void make_versioned_update(const trx_t* trx)
605+
{
606+
make_versioned_helper(trx, table->vers_start);
607+
}
608+
609+
/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
610+
Do not touch other fields at all.
611+
@param[in] trx transaction */
612+
void make_versioned_delete(const trx_t* trx)
613+
{
614+
update->n_fields = 0;
615+
is_delete = VERSIONED_DELETE;
616+
make_versioned_helper(trx, table->vers_end);
617+
}
608618
};
609619

610620
#define UPD_NODE_MAGIC_N 1579975

storage/innobase/row/row0upd.cc

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3485,7 +3485,8 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
34853485

34863486
dict_index_t* clust_index = dict_table_get_first_index(table);
34873487

3488-
/* row_create_update_node_for_mysql() pre-allocated this much */
3488+
/* row_create_update_node_for_mysql() pre-allocated this much.
3489+
At least one PK column always remains unchanged. */
34893490
ut_ad(update->n_fields < ulint(table->n_cols + table->n_v_cols));
34903491

34913492
update->n_fields++;
@@ -3505,19 +3506,3 @@ void upd_node_t::make_versioned_helper(const trx_t* trx, ulint idx)
35053506
dfield_set_data(&ufield->new_val, update->vers_sys_value, col->len);
35063507
}
35073508

3508-
/** Also set row_start = CURRENT_TIMESTAMP/trx->id
3509-
@param[in] trx transaction */
3510-
void upd_node_t::make_versioned_update(const trx_t* trx)
3511-
{
3512-
make_versioned_helper(trx, table->vers_start);
3513-
}
3514-
3515-
/** Only set row_end = CURRENT_TIMESTAMP/trx->id.
3516-
Do not touch other fields at all.
3517-
@param[in] trx transaction */
3518-
void upd_node_t::make_versioned_delete(const trx_t* trx)
3519-
{
3520-
update->n_fields = 0;
3521-
is_delete = VERSIONED_DELETE;
3522-
make_versioned_helper(trx, table->vers_end);
3523-
}

0 commit comments

Comments
 (0)