mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-31835 Remove unnecesary extra HA_EXTRA_IGNORE_INSERT call
- HA_EXTRA_IGNORE_INSERT call is being called for every inserted row,
and on partitioned tables on every row * every partition.
This leads to slowness during load..data operation
- Under bulk operation, multiple insert statement error handling
will end up emptying the table. This behaviour introduced by the
commit 8ea923f55b
(MDEV-24818).
This makes the HA_EXTRA_IGNORE_INSERT call redundant. We can
use the same behavior for insert..ignore statement as well.
- Removed the extra call HA_EXTRA_IGNORE_INSERT as the solution
to improve the performance of load command.
This commit is contained in:
@@ -218,9 +218,7 @@ enum ha_extra_function {
|
||||
/** Start writing rows during ALTER TABLE...ALGORITHM=COPY. */
|
||||
HA_EXTRA_BEGIN_ALTER_COPY,
|
||||
/** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */
|
||||
HA_EXTRA_END_ALTER_COPY,
|
||||
/** IGNORE is being used for the insert statement */
|
||||
HA_EXTRA_IGNORE_INSERT
|
||||
HA_EXTRA_END_ALTER_COPY
|
||||
};
|
||||
|
||||
/* Compatible option, to be deleted in 6.0 */
|
||||
|
@@ -9474,7 +9474,6 @@ int ha_partition::extra(enum ha_extra_function operation)
|
||||
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
|
||||
case HA_EXTRA_BEGIN_ALTER_COPY:
|
||||
case HA_EXTRA_END_ALTER_COPY:
|
||||
case HA_EXTRA_IGNORE_INSERT:
|
||||
DBUG_RETURN(loop_partitions(extra_cb, &operation));
|
||||
default:
|
||||
{
|
||||
|
@@ -2176,9 +2176,6 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink)
|
||||
goto after_trg_or_ignored_err;
|
||||
}
|
||||
|
||||
/* Notify the engine about insert ignore operation */
|
||||
if (info->handle_duplicates == DUP_ERROR && info->ignore)
|
||||
table->file->extra(HA_EXTRA_IGNORE_INSERT);
|
||||
after_trg_n_copied_inc:
|
||||
info->copied++;
|
||||
thd->record_first_successful_insert_id_in_cur_stmt(table->file->insert_id_for_cur_row);
|
||||
|
@@ -11301,9 +11301,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In case of alter ignore, notify the engine about it. */
|
||||
if (ignore)
|
||||
to->file->extra(HA_EXTRA_IGNORE_INSERT);
|
||||
DEBUG_SYNC(thd, "copy_data_between_tables_before");
|
||||
found_count++;
|
||||
mysql_stage_set_work_completed(thd->m_stage_progress_psi, found_count);
|
||||
|
@@ -15732,13 +15732,6 @@ ha_innobase::extra(
|
||||
case HA_EXTRA_RESET_STATE:
|
||||
reset_template();
|
||||
trx->duplicates = 0;
|
||||
/* fall through */
|
||||
case HA_EXTRA_IGNORE_INSERT:
|
||||
/* HA_EXTRA_IGNORE_INSERT is very similar to
|
||||
HA_EXTRA_IGNORE_DUP_KEY, but with one crucial difference:
|
||||
we want !trx->duplicates for INSERT IGNORE so that
|
||||
row_ins_duplicate_error_in_clust() will acquire a
|
||||
shared lock instead of an exclusive lock. */
|
||||
stmt_boundary:
|
||||
trx->end_bulk_insert(*m_prebuilt->table);
|
||||
trx->bulk_insert = false;
|
||||
|
@@ -596,9 +596,6 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation)
|
||||
inspected = "HA_EXTRA_NO_AUTOINC_LOCKING";
|
||||
break;
|
||||
#endif
|
||||
case HA_EXTRA_IGNORE_INSERT:
|
||||
inspected = "HA_EXTRA_IGNORE_INSERT";
|
||||
break;
|
||||
}
|
||||
return inspected;
|
||||
}
|
||||
|
Reference in New Issue
Block a user