mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
MDEV-35237 Bulk insert fails to apply buffered operation during CREATE..SELECT statement
Problem: ======= - InnoDB fails to write the buffered insert operation during create..select operation. This happens when bulk_insert in transaction is reset to false while unlocking a source table. Fix: === - InnoDB should apply the previous buffered changes to all tables if we encounter any statement other than pure INSERT or INSERT..SELECT statement in ha_innobase::external_lock() and start_stmt(). - Remove the function bulk_insert_apply_for_table() start_stmt(), external_lock(): Assert that trx->duplicates should be enabled during bulk insert operation
This commit is contained in:
parent
63a7e4c96b
commit
db3be9b434
5 changed files with 37 additions and 26 deletions
|
|
@ -15902,20 +15902,17 @@ ha_innobase::start_stmt(
|
|||
if (trx->is_bulk_insert()) {
|
||||
/* Allow a subsequent INSERT into an empty table
|
||||
if !unique_checks && !foreign_key_checks. */
|
||||
ut_ad(!trx->duplicates);
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
trx->bulk_insert_apply_for_table(m_prebuilt->table);
|
||||
trx->bulk_insert_apply();
|
||||
trx->end_bulk_insert();
|
||||
if (!trx->bulk_insert) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Trigger could've initiated another stmt.
|
||||
So apply all bulk operation and mark as
|
||||
end bulk insert for all tables */
|
||||
trx->bulk_insert_apply();
|
||||
trx->end_bulk_insert();
|
||||
trx->bulk_insert = false;
|
||||
trx->last_sql_stat_start.least_undo_no = trx->undo_no;
|
||||
}
|
||||
|
|
@ -16096,11 +16093,13 @@ ha_innobase::external_lock(
|
|||
if (trx->is_bulk_insert()) {
|
||||
/* Allow a subsequent INSERT into an empty table
|
||||
if !unique_checks && !foreign_key_checks. */
|
||||
ut_ad(!trx->duplicates);
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
default:
|
||||
trx->bulk_insert_apply_for_table(m_prebuilt->table);
|
||||
trx->bulk_insert_apply();
|
||||
trx->end_bulk_insert();
|
||||
if (!trx->bulk_insert) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue