mirror of
https://github.com/MariaDB/server.git
synced 2025-04-02 05:15:33 +02:00
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
This commit is contained in:
parent
f3eb82f048
commit
1a73444d57
3 changed files with 26 additions and 31 deletions
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue