summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-21921 Make transaction_isolation and transaction_read_only into system ↵Junqi Xie2023-04-1218-77/+77
| | | | | | | | | | | | | | 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.
* Merge 11.0 into 11.1Marko Mäkelä2023-03-292-0/+44
|\
| * Merge 10.11 into 11.0Marko Mäkelä2023-03-292-0/+44
| |\
| | * Merge 10.10 into 10.11Marko Mäkelä2023-03-292-0/+44
| | |\
| | | * Merge 10.9 into 10.10Marko Mäkelä2023-03-292-0/+44
| | | |\
| | | | * Merge 10.8 into 10.9Marko Mäkelä2023-03-292-0/+44
| | | | |\
| | | | | * Merge 10.6 into 10.8Marko Mäkelä2023-03-292-0/+44
| | | | | |\
| | | | | | * MDEV-29545 InnoDB: Can't find record during replace stmtThirunarayanan Balathandayuthapani2023-03-242-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | Merge 11.0 into 11.1Marko Mäkelä2023-03-1710-1/+87
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge 10.11 into 11.0Marko Mäkelä2023-03-1710-1/+87
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge 10.10 into 10.11Marko Mäkelä2023-03-175-0/+38
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge 10.9 into 10.10Marko Mäkelä2023-03-175-0/+38
| | | |\ \ \ \ | | | | |/ / /
| | | | * | | Merge 10.8 into 10.9Marko Mäkelä2023-03-175-0/+38
| | | | |\ \ \ | | | | | |/ /
| | | | | * | Merge 10.6 into 10.8Marko Mäkelä2023-03-175-0/+38
| | | | | |\ \ | | | | | | |/
| | | | | | * MDEV-30870 Undo tablespace name displays wrongly for I_S queriesThirunarayanan Balathandayuthapani2023-03-173-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - INNODB_SYS_TABLESPACES in information schema should display innodb_undo001, innodb_undo002 etc as tablespace name for undo tablespaces
| | | | | | * MDEV-29975 InnoDB fails to release savepoint during bulk insertThirunarayanan Balathandayuthapani2023-03-172-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
| | * | | | | Merge 10.10 into 10.11Marko Mäkelä2023-03-174-1/+46
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge 10.9 into 10.10Marko Mäkelä2023-03-174-1/+46
| | | |\ \ \ \ | | | | |/ / /
| | | | * | | Merge 10.8 into 10.9Marko Mäkelä2023-03-174-1/+46
| | | | |\ \ \ | | | | | |/ /
| | | | | * | Merge 10.6 into 10.8Marko Mäkelä2023-03-162-1/+2
| | | | | |\ \ | | | | | | |/
| | | | | | * MDEV-26827 Make page flushing even fasterMarko Mäkelä2023-03-162-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For more convenient monitoring of something that could greatly affect the volume of page writes, we add the status variable Innodb_buffer_pool_pages_split that was previously only available via information_schema.innodb_metrics as "innodb_page_splits". This was suggested by Axel Schwenke. buf_flush_page_count: Replaced with buf_pool.stat.n_pages_written. We protect buf_pool.stat (except n_page_gets) with buf_pool.mutex and remove unnecessary export_vars indirection. buf_pool.flush_list_bytes: Moved from buf_pool.stat.flush_list_bytes. Protected by buf_pool.flush_list_mutex. buf_pool_t::page_cleaner_status: Replaces buf_pool_t::n_flush_LRU_, buf_pool_t::n_flush_list_, and buf_pool_t::page_cleaner_is_idle. Protected by buf_pool.flush_list_mutex. We will exclusively broadcast buf_pool.done_flush_list by the buf_flush_page_cleaner thread, and only wait for it when communicating with buf_flush_page_cleaner. There is no need to keep a count of pending writes by the buf_pool.flush_list processing. A single flag suffices for that. Waits for page write completion can be performed by simply waiting on block->page.lock, or by invoking buf_dblwr.wait_for_page_writes(). buf_LRU_block_free_non_file_page(): Broadcast buf_pool.done_free and set buf_pool.try_LRU_scan when freeing a page. This would be executed also as part of buf_page_write_complete(). buf_page_write_complete(): Do not broadcast buf_pool.done_flush_list, and do not acquire buf_pool.mutex unless buf_pool.LRU eviction is needed. Let buf_dblwr count all writes to persistent pages and broadcast a condition variable when no outstanding writes remain. buf_flush_page_cleaner(): Prioritize LRU flushing and eviction right after "furious flushing" (lsn_limit). Simplify the conditions and reduce the hold time of buf_pool.flush_list_mutex. Refuse to shut down or sleep if buf_pool.ran_out(), that is, LRU eviction is needed. buf_pool_t::page_cleaner_wakeup(): Add the optional parameter for_LRU. buf_LRU_get_free_block(): Protect buf_lru_free_blocks_error_printed with buf_pool.mutex. Invoke buf_pool.page_cleaner_wakeup(true) to to ensure that buf_flush_page_cleaner() will process the LRU flush request. buf_do_LRU_batch(), buf_flush_list(), buf_flush_list_space(): Update buf_pool.stat.n_pages_written when submitting writes (while holding buf_pool.mutex), not when completing them. buf_page_t::flush(), buf_flush_discard_page(): Require that the page U-latch be acquired upfront, and remove buf_page_t::ready_for_flush(). buf_pool_t::delete_from_flush_list(): Remove the parameter "bool clear". buf_flush_page(): Count pending page writes via buf_dblwr. buf_flush_try_neighbors(): Take the block of page_id as a parameter. If the tablespace is dropped before our page has been written out, release the page U-latch. buf_pool_invalidate(): Let the caller ensure that there are no outstanding writes. buf_flush_wait_batch_end(false), buf_flush_wait_batch_end_acquiring_mutex(false): Replaced with buf_dblwr.wait_for_page_writes(). buf_flush_wait_LRU_batch_end(): Replaces buf_flush_wait_batch_end(true). buf_flush_list(): Remove some broadcast of buf_pool.done_flush_list. buf_flush_buffer_pool(): Invoke also buf_dblwr.wait_for_page_writes(). buf_pool_t::io_pending(), buf_pool_t::n_flush_list(): Remove. Outstanding writes are reflected by buf_dblwr.pending_writes(). buf_dblwr_t::init(): New function, to initialize the mutex and the condition variables, but not the backing store. buf_dblwr_t::is_created(): Replaces buf_dblwr_t::is_initialised(). buf_dblwr_t::pending_writes(), buf_dblwr_t::writes_pending: Keeps track of writes of persistent data pages. buf_flush_LRU(): Allow calls while LRU flushing may be in progress in another thread. Tested by Matthias Leich (correctness) and Axel Schwenke (performance)
| | | | | * | MDEV-30183 Assertion `!memcmp(rec_trx_id, old_pk_trx_id->data, 6 + 7)' ↵Thirunarayanan Balathandayuthapani2023-03-062-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | failed in row_log_table_apply_update - This failure caused by commit 358921ce32203a9a8dd277a5ba7ac177c9e79e53 row_ins_duplicate_online() should consider if the record is an exact match of the tuple when number of matching fields equals with number of unique fields + DB_TRX_ID + DB_ROLL_PTR
* | | | | | | MDEV-30545 Remove innodb_defragment and related parametersMarko Mäkelä2023-03-1125-1437/+0
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The deprecated parameters will be removed: innodb_defragment innodb_defragment_n_pages innodb_defragment_stats_accuracy innodb_defragment_fill_factor_n_recs innodb_defragment_fill_factor innodb_defragment_frequency The mysql.innodb_index_stats.stat_name values 'n_page_split' and 'n_pages_freed' will lose their special meaning. The related changes to OPTIMIZE TABLE in InnoDB will be removed as well. The parameter innodb_optimize_fulltext_only will retain its special meaning in OPTIMIZE TABLE. Tested by: Matthias Leich
* | | | | | Merge 10.11 into 11.0Marko Mäkelä2023-02-2810-6/+125
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.10 into 10.11Marko Mäkelä2023-02-2810-6/+125
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.9 into 10.10Marko Mäkelä2023-02-2810-6/+125
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.8 into 10.9Marko Mäkelä2023-02-2810-6/+125
| | | |\ \ \ | | | | |/ /
| | | | * | Merge 10.6 into 10.8Marko Mäkelä2023-02-2810-6/+125
| | | | |\ \ | | | | | |/
| | | | | * Merge 10.5 into 10.6Marko Mäkelä2023-02-278-6/+33
| | | | | |\
| | | | | | * MDEV-30671 InnoDB undo log truncation fails to wait for purge of historyMarko Mäkelä2023-02-248-8/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is not safe to invoke trx_purge_free_segment() or execute innodb_undo_log_truncate=ON before all undo log records in the rollback segment has been processed. A prominent failure that would occur due to premature freeing of undo log pages is that trx_undo_get_undo_rec() would crash when trying to copy an undo log record to fetch the previous version of a record. If trx_undo_get_undo_rec() was not invoked in the unlucky time frame, then the symptom would be that some committed transaction history is never removed. This would be detected by CHECK TABLE...EXTENDED that was impleented in commit ab0190101b0587e0e03b2d75a967050b9a85fd1b. Such a garbage collection leak should be possible even when using innodb_undo_log_truncate=OFF, just involving trx_purge_free_segment(). trx_rseg_t::needs_purge: Change the type from Boolean to a transaction identifier, noting the most recent non-purged transaction, or 0 if everything has been purged. On transaction start, we initialize this to 1 more than the transaction start ID. On recovery, the field may be adjusted to the transaction end ID (TRX_UNDO_TRX_NO) if it is larger. The field TRX_UNDO_NEEDS_PURGE becomes write-only; only some debug assertions that would validate the value. The field reflects the old inaccurate Boolean field trx_rseg_t::needs_purge. trx_undo_mem_create_at_db_start(), trx_undo_lists_init(), trx_rseg_mem_restore(): Remove the parameter max_trx_id. Instead, store the maximum in trx_rseg_t::needs_purge, where trx_rseg_array_init() will find it. trx_purge_free_segment(): Contiguously hold a lock on trx_rseg_t to prevent any concurrent allocation of undo log. trx_purge_truncate_rseg_history(): Only invoke trx_purge_free_segment() if the rollback segment is empty and there are no pending transactions associated with it. trx_purge_truncate_history(): Only proceed with innodb_undo_log_truncate=ON if trx_rseg_t::needs_purge indicates that all history has been purged. Tested by: Matthias Leich
| | | | | * | MDEV-27701 Race on trx->lock.wait_lock between lock_rec_move() and ↵Vlad Lesin2023-02-202-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lock_sys_t::cancel() The initial issue was in assertion failure, which checked the equality of lock to cancel with trx->lock.wait_lock in lock_sys_t::cancel(). If we analyze lock_sys_t::cancel() code from the perspective of trx->lock.wait_lock racing, we won't find the error there, except the cases when we need to reload it after the corresponding latches acquiring. So the fix is just to remove the assertion and reload trx->lock.wait_lock after acquiring necessary latches. Reviewed by: Marko Mäkelä <marko.makela@mariadb.com>
* | | | | | | MDEV-30544 Deprecate innodb_defragment and related parametersMarko Mäkelä2023-02-218-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a little used option innodb_defragment that would make OPTIMIZE TABLE not rebuild the table as usual for InnoDB, but instead cause the index B-trees to be optimized in place. This option uses excessive locking (exclusively locking index trees). It never covered SPATIAL INDEX or FULLTEXT INDEX. Storage space was never reclaimed. Because this option is not particularly useful and causes a maintenance burden (most recently in commit de4030e4d49805a7ded5c0bfee01cc3fd7623522), it is best to deprecate it, to prepare for its removal.
* | | | | | | Merge 10.11 into 11.0Marko Mäkelä2023-02-1615-8/+133
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge 10.10 into 10.11Marko Mäkelä2023-02-169-4/+94
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge 10.9 into 10.10Marko Mäkelä2023-02-169-4/+94
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge 10.8 into 10.9Marko Mäkelä2023-02-169-4/+94
| | | |\ \ \ \ | | | | |/ / /
| | | | * | | Merge 10.6 into 10.8Marko Mäkelä2023-02-162-2/+11
| | | | |\ \ \ | | | | | |/ /
| | | | | * | Merge 10.5 into 10.6Marko Mäkelä2023-02-162-2/+11
| | | | | |\ \ | | | | | | |/
| | | | | | * MDEV-30552 fixup: Fix the test for non-debugMarko Mäkelä2023-02-162-2/+11
| | | | | | |
| | | | * | | Merge 10.6 into 10.8Marko Mäkelä2023-02-164-2/+43
| | | | |\ \ \ | | | | | |/ /
| | | | | * | Merge 10.5 into 10.6Marko Mäkelä2023-02-144-2/+43
| | | | | |\ \ | | | | | | |/
| | | | | | * MDEV-30552 InnoDB recovery crashes when error handling scenarioThirunarayanan Balathandayuthapani2023-02-142-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - InnoDB fails to reset the after_apply variable before applying the redo log in last batch during multi-batch recovery.
| | | | | | * MDEV-30551 InnoDB recovery hangs when buffer pool ran out of memoryThirunarayanan Balathandayuthapani2023-02-142-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - During non-last batch of multi-batch recovery, InnoDB holds log_sys.mutex and preallocates the block which may intiate page flush, which may initiate log flush, which requires log_sys.mutex to acquire again. This leads to assert failure. So InnoDB recovery should release log_sys.mutex before preallocating the block.
| | | | * | | MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) during bulk insertThirunarayanan Balathandayuthapani2023-02-143-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - cmp_rec_rec_simple() fails to detect duplicate key error for bulk insert operation
| | | | * | | Merge 10.6 into 10.8Marko Mäkelä2023-02-102-2/+4
| | | | |\ \ \ | | | | | |/ /
| | | | | * | Merge branch '10.6.12' into 10.6Oleksandr Byelkin2023-02-062-2/+4
| | | | | |\ \
| | | | | | * | Implement multiple-signal debug_syncVicențiu Ciorbaru2023-02-032-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch is inspired from MySQL. Instead of using a single String to hold the current active debug_sync signal, use a Hash_set to store LEX_STRINGS. This patch ensures that a signal can not be lost, by being overwritten by another thread via set DEBUG_SYNC = '... SIGNAL ...'; All signals are kepts "alive" until they are consumed by a wait event. This requires updating test cases that assume the GLOBAL signal is never consumed. Follow-up work needed: Port the additional syntax that allows one to set multiple signals and also conditionally deactivate signals when waiting.
| * | | | | | | Merge branch '10.10' into 10.11mariadb-10.11.2Oleksandr Byelkin2023-02-016-4/+35
| |\ \ \ \ \ \ \ | | |/ / / / / /
| | * | | | | | Merge branch '10.9' into 10.10mariadb-10.10.3Oleksandr Byelkin2023-02-012-0/+31
| | |\ \ \ \ \ \ | | | |/ / / / /
| | | * | | | | Merge branch '10.8' into 10.9mariadb-10.9.5Oleksandr Byelkin2023-02-012-0/+31
| | | |\ \ \ \ \ | | | | |/ / / /