1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-26 11:49:09 +03:00

57 Commits

Author SHA1 Message Date
Marko Mäkelä
12a91b57e2 Merge 10.11 into 11.2 2024-10-03 13:24:43 +03:00
Marko Mäkelä
63913ce5af Merge 10.6 into 10.11 2024-10-03 10:55:08 +03:00
Marko Mäkelä
d34289a3e2 Merge 10.11 into 11.1 2024-06-17 09:21:50 +03:00
Marko Mäkelä
b81d717387 Merge 10.6 into 10.11 2024-06-11 12:50:10 +03:00
mariadb-DebarunBanerjee
b12c14e3b4 MDEV-34265 Possible hang during IO burst with innodb_flush_sync enabled
When checkpoint age goes beyond the sync flush threshold and
buf_flush_sync_lsn is set, page cleaner enters into "furious flush"
stage to aggressively flush dirty pages from flush list and pull
checkpoint LSN above safe margin. In this stage, page cleaner skips
doing LRU flush and eviction.

In 10.6, all other threads entirely rely on page cleaner to generate
free pages. If free pages get over while page cleaner is busy in
"furious flush" stage, a session thread could wait for free page in the
middle of a min-transaction(mtr) while holding latches on other pages.

It, in turn, can prevent page cleaner to flush such pages preventing
checkpoint LSN to move forward creating a deadlock situation. Even
otherwise, it could create a stall and hang like situation for large BP
with plenty of dirty pages to flush before the stage could finish.

Fix: During furious flush, check and evict LRU pages after each flush
iteration.
2024-06-05 18:11:29 +05:30
Thirunarayanan Balathandayuthapani
58a0e1e3dd MDEV-34223 Innodb - add status variable for number of bulk inserts
- Added a counter innodb_num_bulk_insert_operation in
INFORMATION_SCHEMA.GLOBAL_STATUS. This counter is incremented
whenever a InnoDB undergoes bulk insert operation.

- Change the innodb_instant_alter_column to atomic variable.
2024-06-03 16:27:22 +05:30
Sergei Golubchik
f0a5412037 Merge branch '11.0' into 11.1 2024-05-13 09:52:30 +02:00
Sergei Golubchik
0aae11ac28 Merge branch '10.6' into 10.11 2024-04-30 16:56:49 +02:00
Thirunarayanan Balathandayuthapani
8c8b7da017 MDEV-33979 Disallow bulk insert operation during partition update statement
Problem:
========
- Partition update operation enables the bulk insert for the
transaction while moving the row between partitions. This leads
to debug assert failure while removing the row from one
of the partition.

Solution:
========
- Disallow the bulk insert operation for non-insert operation
of partition table.
2024-04-25 10:50:34 +05:30
Thirunarayanan Balathandayuthapani
c3460e6904 MDEV-33970 Assertion `!m.first->second.is_bulk_insert()' failed in trx_undo_report_row_operation()
In case of partition insert, InnoDB fails to end the bulk insert
for one of the partition. It leads to bulk insert operation for
the consecutive delete statement.

trx_t::bulk_insert_apply_for_table(): Irrespective of bulk insert
value, InnoDB should end the bulk insert for the table.
2024-04-23 16:26:02 +05:30
Thirunarayanan Balathandayuthapani
8a3755cc29 MDEV-33934 Assertion `!check_foreigns' failed in
bulk_insert_apply_for_table(dict_table_t*)

This issue is caused by
commit 188c5da72a0057e4572b1d7e4efcd0c39332a839 (MDEV-32453).

trx_t::bulk_insert_apply_for_table(): Remove the assert
check_unique_secondary and check_foreigns. InnoDB can
apply the bulk insert operation even after disabling
the check_foreigns and check_unique_secondary variable.
2024-04-19 11:05:44 +05:30
Thirunarayanan Balathandayuthapani
863f5996f2 MDEV-33868 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned
- This issue is caused by commit 188c5da72a0057e4572b1d7e4efcd0c39332a839 (MDEV-32453).
InnoDB fails to end the bulk insert for the table after
applying the bulk insert operation. This leads to assertion
during commit process.
2024-04-11 15:57:54 +05:30
Thirunarayanan Balathandayuthapani
188c5da72a MDEV-32453 Bulk insert fails to apply when trigger does insert operation
Reason:
=======
- InnoDB fails to apply the buffered insert operation if the
after insert trigger does change the same table. This behaviour
leads to empty table for the subsequent insert operation
and server abort.

Solution:
========
- InnoDB should apply buffered insert operation if
"after insert" trigger changes the same table.
2024-04-08 14:24:20 +05:30
Sergei Golubchik
05d850d4b3 Merge branch '11.0' into 11.1 2023-09-29 13:58:47 +02:00
Thirunarayanan Balathandayuthapani
bf3b787e02 MDEV-31835 Remove unnecessary extra HA_EXTRA_IGNORE_INSERT call
- This commit is different from 10.6 commit c438284863db2ccba8a04437c941a5c8a2d9225b.
Due to Commit 045757af4c301757ba449269351cc27b1691a7d6 (MDEV-24621),
InnoDB does buffer and pre-sort the records for each index, and build
the indexes one page at a time.

Multiple large insert ignore statment aborts the server during bulk
insert operation. Problem is that InnoDB merge record exceeds
the page size. To avoid this scenario, InnoDB should catch
too big record while buffering the insert operation itself.

row_merge_buf_encode(): returns length of the encoded index record

row_merge_buf_write(): Catches the DB_TOO_BIG_RECORD earlier and
returns error
2023-08-25 23:13:05 +05:30
Marko Mäkelä
cee9b3b850 Merge 11.0 into 11.1 2023-07-04 08:20:55 +03:00
Thirunarayanan Balathandayuthapani
73f78fb3b0 MDEV-31537 Bulk insert operation aborts the server for redundant table
- InnoDB bulk insert operation aborts the server for redundant
table. InnoDB miscalculates the record size in temporary file
for the redundant table. CHAR in redundant row format table
always fixed length, but in temporary file, it is variable-length
for variable-length character sets.
2023-06-28 15:26:22 +05:30
Junqi Xie
d20a96f9c1 MDEV-21921 Make transaction_isolation and transaction_read_only into system variables
In MariaDB, we have a confusing problem where:
* The transaction_isolation option can be set in a configuration file, but it cannot be set dynamically.
* The tx_isolation system variable can be set dynamically, but it cannot be set in a configuration file.

Therefore, we have two different names for the same thing in different contexts. This is needlessly confusing, and it complicates the documentation. The same thing applys for transaction_read_only.

MySQL 5.7 solved this problem by making them into system variables. https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-20.html

This commit takes a similar approach by adding new system variables and marking the original ones as deprecated. This commit also resolves some legacy problems related to SET STATEMENT and transaction_isolation.
2023-04-12 11:04:29 +10:00
Marko Mäkelä
dd2fe81122 Merge 10.6 into 10.8 2023-03-29 15:16:42 +03:00
Thirunarayanan Balathandayuthapani
e06c6046d2 MDEV-29545 InnoDB: Can't find record during replace stmt
Problem:
========
- InnoDB replace statement returns can't find record as result during
bulk insert operation. InnoDB returns DB_END_OF_INDEX blindly when
bulk transaction is visible to current transaction even though
the search tuple is inserted as a part of current replace statement.

Solution:
=========
row_search_mvcc(): InnoDB should allow the transaction to read
all the rows when innodb intends to do any locking on the
record even though bulk insert transaction changes are
visible to the current transaction
2023-03-24 15:20:21 +05:30
Marko Mäkelä
fa56adff75 Merge 10.6 into 10.8 2023-03-17 14:19:17 +02:00
Thirunarayanan Balathandayuthapani
18e4978edc MDEV-29975 InnoDB fails to release savepoint during bulk insert
- InnoDB does rollback the whole transaction and discards the
savepoint when there is a failure happens during bulk
insert operation. When server request to release the savepoint,
InnoDB should return DB_SUCCESS when it deals with bulk
insert operation
2023-03-17 16:41:27 +05:30
Thirunarayanan Balathandayuthapani
951d81d92e MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) during bulk insert
- cmp_rec_rec_simple() fails to detect duplicate key error for
bulk insert operation
2023-02-14 15:43:33 +05:30
Marko Mäkelä
cea50896d2 Merge 10.6 into 10.7 2023-01-24 14:35:36 +02:00
Marko Mäkelä
1bbf37e0db MDEV-515: Improve test coverage
Cover dict_index_t::clear() for TEMPORARY TABLE
2023-01-23 13:05:52 +02:00
Marko Mäkelä
8356fb68c3 Merge 10.6 into 10.7 2023-01-04 14:52:25 +02:00
Michael Roosz
b5a54e8a93 MDEV-30321: blob data corrupted by row_merge_write_blob_to_tmp_file() 2023-01-04 16:21:07 +05:30
Marko Mäkelä
fe38d7cad4 Remove redundant statements from a test 2023-01-04 10:04:58 +02:00
Marko Mäkelä
d5332086d7 Merge 10.6 into 10.7 2022-11-17 09:19:32 +02:00
Alexander Barkov
505da21e33 MDEV-27214 Import with disabled keys corrupts meta-data like rows, indexes, ...
This bug was previously fixed in 10.6.11 by:
   MDEV-28327 InnoDB persistent statistics fail to update after bulk insert

Adding MTR tests only.

Also, fixing the old test for MDEV-28327 to make "mtr" reliably pass
with/without --mysqld=--innodb-stats-persistent=0, and with different page sizes,
as suggested by Marko.
2022-11-11 14:46:16 +04:00
Marko Mäkelä
27eaa963ff Merge 10.6 into 10.7 2022-11-09 12:27:54 +02:00
Marko Mäkelä
e56c12b3cd Add an end marker to a test 2022-11-09 12:02:04 +02:00
Oleksandr Byelkin
1ebfa2af62 Merge branch '10.6' into 10.7 2022-10-29 19:22:04 +02:00
Thirunarayanan Balathandayuthapani
dd9da61dcf MDEV-29761 Bulk insert fails to rollback during insert..select
- InnoDB should do partial rollback when error happens during
buffered bulk insert write operation.
2022-10-25 12:14:09 +05:30
Thirunarayanan Balathandayuthapani
f70960c348 MDEV-28327 InnoDB persistent statistics fail to update after bulk insert
- Background statistics thread should keep the table in the
statistics queue itself when the table under bulk insert operation

dict_stats_analyze_index(): Set the maximum value for index_stats_t
if the table is in bulk operation

dict_stats_update(), dict_stats_update_transient_for_index(),
dict_stats_update_transient(): Returns DB_SUCCESS_LOCKED_REC
if the table under bulk insert operation

dict_stats_process_entry_from_recalc_pool(): Add the table
back to recalc pool if the table under bulk insert operation
2022-10-25 12:12:33 +05:30
Thirunarayanan Balathandayuthapani
7d4b2b9847 MDEV-29570 InnoDB fails to clean bulk buffer when server does rollback operation
- During bulk insert, server detects the error and does rollback
operation. At that time, InnoDB fails to clean up the bulk insert
buffer

trx_t::rollback_finish(): Removed the clean up of modified tables
from transaction

trx_t::commit_cleanup(): Free the bulk buffer for bulk insert operation

trx_t::commit(): Check whether modified table wasn't dropped only
for non-dictionary transaction
2022-09-28 18:41:00 +05:30
Thirunarayanan Balathandayuthapani
3330f8d156 MDEV-28400 Leak in trx_mod_time_t::start_bulk_insert()
- Change partition does undo logging of all rows unnecessarily and
it invokes bulk insert during DDL. Better to avoid the logging of undo
records during copy of the parititon.
2022-08-01 14:44:55 +05:30
Thirunarayanan Balathandayuthapani
3808ffbcb5 MDEV-28242 Assertion `!check_foreigns' failed in trx_t::check_bulk_buffer
If transaction does bulk insert and disables the foreign_key_check
then InnoDB fails with the assert failure. InnoDB has strict
assertion that check_foreigns and unique_secondary_check
should be enabled if the transaction does bulk insert
in innodb_prepare_commit_versioned().
2022-07-26 11:25:56 +05:30
Thirunarayanan Balathandayuthapani
011b332d81 MDEV-28037 Assertion `trx->bulk_insert' failed in innodb_prepare_commit_versioned
- Trigger statement initiate update statement after bulk insert
operation and leads to disable of bulk operation. During commit,
InnoDB expects transaction to be in bulk insert mode before
applying the bulk insert operation. InnoDB transaction should
apply all bulk insert operation before disabling bulk insert
operation.
2022-04-12 14:41:11 +05:30
Thirunarayanan Balathandayuthapani
db655e1310 MDEV-28237 Assertion `0' failed in row_upd_sec_index_entry on DELETE
- InnoDB bulk insert operation fails to rollback when it detect
DB_DUPLICATE_KEY error. It leads to orphaned records in primary
indexes. Consecutive update/delete operation assumes that record
should exist in secondary index and it leads to failure.
2022-04-04 19:34:59 +05:30
Thirunarayanan Balathandayuthapani
b678f8811b MDEV-28138 MariaDB Assertion Failed in mtr_buf_t::has_space
- After MDEV-24621, InnoDB does buffer the insert bulk operation
for all indexes expect spatial one. But it leads to search the
primary key lookup and it leads to failure. So InnoDB should avoid
bulk insert when table has spatial index involved.
2022-04-04 19:34:36 +05:30
Thirunarayanan Balathandayuthapani
c3ca729ba8 MDEV-27858 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in PageBulk::init
- InnoDB should check whether bulk transaction id set to its own
transaction id before start bulk insert operation.

- When bulk insert failure happens, InnoDB should set the error info
of the transaction.
2022-03-23 10:15:52 +05:30
Thirunarayanan Balathandayuthapani
03ed2e9d97 MDEV-27318 Assertion `data_size < srv_sort_buf_size' failed in row_merge_bulk_buf_add
InnoDB fails to add the tuple size which is greater than
innodb_sort_buffer_size. InnoDB should write the field
which are greater than 2000 bytes into the temporary file
and place the offset, length and make it as a new tuple.
InnoDB should buffer the newly created tuple without any
problem during bulk index
2022-01-12 17:37:06 +05:30
Thirunarayanan Balathandayuthapani
9f2a6bbe6b MDEV-27316 Assertion `!(index)->is_spatial()' failed
This issue is caused by MDEV-24621
(commit 045757af4c301757ba449269351cc27b1691a7d6).
InnoDB tries to insert the number of rows into an empty spatial
index table, but it fails to apply the buffered insert.
InnoDB should insert into the spatial index directly instead of
buffering the insert operation.
2021-12-24 14:40:52 +05:30
Thirunarayanan Balathandayuthapani
8c9cc2fb6e MDEV-26956 LeakSanitizer/Valgrind errors in trx_mod_table_time_t::start_bulk_insert upon adding system versioning
InnoDB fails to apply buffered insert operation for
'mysql/transaction_registry' table during system versioning DDL.
To avoid this, DDL calls extra(HA_EXTRA_IGNORE_INSERT) to
inform the InnoDB for applying the buffered insert operation.
2021-11-07 04:41:35 +05:30
Thirunarayanan Balathandayuthapani
d6e3cd6f23 MDEV-26947 UNIQUE column checks fail in InnoDB resulting in table corruption
InnoDB fails to rollback the bulk insert buffered operation when
trx_mark_sql_stat_end() encounters the DB_DUPLICATE_KEY error.
In this case, check table fails with secondary index row count
mismatch. InnoDB gives the error "ER_ERROR_DURING_COMMIT"
while encountering the DB_DUPLICATE_KEY in trx_mark_sql_stat_end()
2021-11-01 14:52:42 +05:30
Marko Mäkelä
e04bbf73dc MDEV-25496 Assertion 'trx->bulk_insert' failed on INSERT
row_get_prebuilt_insert_row(): Remove some fallback code that had been
added in commit 8ea923f55b7666a359ac2c54f6c10e8609d16846 (MDEV-24818).
It seems that after all, statement boundaries are being reliably
indicated by ha_innobase::start_stmt() or
(for partitioned tables) ha_innobase::external_lock().
2021-06-29 15:20:33 +03:00
Marko Mäkelä
98e3034eea MDEV-25534 Assertion lock_table_has...LOCK_IX
ha_innobase::start_stmt(): Always set m_prebuilt->sql_stat_start.

row_search_mvcc(): Cleanup: Simplify debug assertions.
2021-04-28 17:52:35 +03:00
Marko Mäkelä
1a647b700f MDEV-25487 Assertion failed in lock_rec_move
row_ins_clust_index_entry_low(): Do not enable bulk insert if
any record locks exist on the table. Bulk insert is assumed to
be covered only by an exclusive table lock, with no row-level
locking or undo logging.
2021-04-23 10:07:08 +03:00
Marko Mäkelä
de119fa2b6 MDEV-25297 Assertion: trx->roll_limit <= trx->undo_no in ROLLBACK TO SAVEPOINT
In commit 8ea923f55b7666a359ac2c54f6c10e8609d16846 (MDEV-24818)
when we optimized multi-statement INSERT transactions into empty tables,
we would roll back the entire transaction on any error. But, we would
fail to invalidate any SAVEPOINT that had been requested in the past.

trx_t::savepoints_discard(): Renamed from trx_roll_savepoints_free().

row_mysql_handle_errors(): If we were in bulk insert, invoke
trx_t::savepoints_discard(). In this way, a future attempt of
ROLLBACK TO SAVEPOINT will return an error.
2021-04-09 09:18:07 +03:00