summaryrefslogtreecommitdiff
path: root/storage/innobase/include
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-12-132-1/+15
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-12-132-1/+15
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-12-132-1/+15
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.4 into 10.5Marko Mäkelä2022-12-132-2/+16
| | | |\ \ \ | | | | |/ /
| | | | * | Merge 10.3 into 10.4Marko Mäkelä2022-12-132-2/+16
| | | | |\ \ | | | | | |/
| | | | | * MDEV-28462 Race condition between instant alter and AHI accessThirunarayanan Balathandayuthapani2022-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - InnoDB AHI tries to access the concurrent instant alter column, leads to asan failure. Instant alter column should acquire the clustered index search latch in exclusive mode before changing the table cache definition. - Removed the default parameter for the function btr_search_drop_page_hash_index() - Addressed the DWITH_INNODB_AHI=0 compilation failure by passing two parameters from all callers of btr_search_drop_page_hash_index()
| | | | | * MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific ↵Daniel Black2022-11-111-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | error message Per fsp0types.h, SDI is on tablespace flags position 14 where MariaDB stores its pagesize. Flag at position 13, also in MariaDB pagesize flags, is a MySQL encryption flag. These are checked only if fsp_flags_is_valid fails, so valid MariaDB pages sizes don't become errors. The error message "Cannot reset LSNs in table" was rather specific and not always true to replaced with more generic error. ALTER TABLE tbl IMPORT TABLESPACE now reports Unsupported on MySQL tablespace (rather than index corrupted) along with a server error message. MySQL innodb Errors are with with UNSUPPORTED rather than CORRUPTED to avoid user anxiety. Reviewer: Marko Mäkelä
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-12-071-11/+8
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-12-071-11/+8
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-30148 Race condition between non-persistent statistics and purgeMarko Mäkelä2022-12-051-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_cur_t::open_random_leaf(): Replaces btr_cur_open_at_rnd_pos(). Acquire a shared latch on each page, and finally release all latches except the one on the leaf page. This fixes a race condition between the purge of history and btr_estimate_number_of_different_key_vals(), which turned out to only hold a buffer-fix on the randomly chosen leaf page. Typically, an assertion would fail in page_rec_is_supremum(). ibuf_contract(): Start from the beginning of the change buffer, to simplify the logic. Starting with commit b42294bc6409794bdbd2051b32fa079d81cea61d it does not matter much where the change buffer merge is being initiated. The race condition may have been introduced as early as mysql/mysql-server@ac74632293bea967b352d1b472abedeeaa921b98 from where it was copied to commit 2e814d4702d71a04388386a9f591d14a35980bfe. Reviewed by: Vladislav Lesin Tested by: Matthias Leich
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-11-303-109/+11
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-11-303-109/+11
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-30132 Crash after recovery, with InnoDB: Tried to read ...Marko Mäkelä2022-11-302-100/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | os_file_read(): Merged with os_file_read_no_error_handling(). Crashing on a partial page read is as unhelpful as crashing on a corrupted page read (commit 0b47c126e31cddda1e94588799599e138400bcf8). Report the file name if it is available via IORequest.
| | * | | | Cleanup: Remove fil_space_t::is_deferred()Marko Mäkelä2022-11-301-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | The public data member can be checked directly by the only caller.
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-11-281-9/+0
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-11-281-9/+0
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-21452 fixup: Remove PFS_NOT_INSTRUMENTEDMarko Mäkelä2022-11-241-9/+0
| | | | | |
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-11-211-37/+5
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Cleanup: Define less of bulk insert inlineMarko Mäkelä2022-11-211-38/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trx_mod_table_time_t::write_bulk(): Define non-inline. There are 2 callers, so this will avoid some code duplication. trx_t::bulk_insert_apply(): In the inline function, only check for the condition, and invoke the actual operation in the non-inline function trx_t::bulk_insert_apply_low().
| * | | | | MDEV-30047 innodb.insert_into_empty fails to delete bulk_storeMarko Mäkelä2022-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | InnoDB fails to remove bulk store when InnoDB bulk insert does partial rollback on multiple tables. This memory leak was revealed by a test case that was added in commit 505da21e336f1e46b655f78fc0ad42e6cf17494d (MDEV-27214). trx_t::bulk_rollback(): Delete the bulk_store. After this function finishes execution, trx_t::is_bulk_insert() will not hold and therefore trx_t::commit_cleanup() will not free the memory. Alternatively, we could define trx_mod_table_time_t::~trx_mod_table_time_t() { delete bulk_store; } but that would likely introduce a performance regression for the common transaction commit. Bulk insert is rarely used. This fix was developed by Thirunarayanan Balathandayuthapani.
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-11-1719-903/+503
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-11-1719-908/+502
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checksMarko Mäkelä2022-11-1713-545/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_cur_t: Zero-initialize all fields in the default constructor. btr_cur_t::index: Remove; it duplicated page_cur.index. Many functions: Remove arguments that were duplicating page_cur_t::index and page_cur_t::block. page_cur_open_level(), btr_pcur_open_level(): Replaces btr_cur_open_at_index_side() for dict_stats_analyze_index(). At the end, release all latches except the dict_index_t::lock and the buf_page_t::lock on the requested page. dict_stats_analyze_index(): Rely on mtr_t::rollback_to_savepoint() to release all uninteresting page latches. btr_search_guess_on_hash(): Simplify the logic, and invoke mtr_t::rollback_to_savepoint(). We will use plain C++ std::vector<mtr_memo_slot_t> for mtr_t::m_memo. In this way, we can avoid setting mtr_memo_slot_t::object to nullptr and instead just remove garbage from m_memo. mtr_t::rollback_to_savepoint(): Shrink the vector. We will be needing this in dict_stats_analyze_index(), where we will release page latches and only retain the index->lock in mtr_t::m_memo. mtr_t::release_last_page(): Release the last acquired page latch. Replaces btr_leaf_page_release(). mtr_t::release(const buf_block_t&): Release a single page latch. Used in btr_pcur_move_backward_from_page(). mtr_t::memo_release(): Replaced with mtr_t::release(). mtr_t::upgrade_buffer_fix(): Acquire a latch for a buffer-fixed page. This replaces the double bookkeeping in btr_cur_t::open_leaf(). Reviewed by: Vladislav Lesin
| | * | | | MDEV-29603: Implement btr_cur_t::open_leaf()Marko Mäkelä2022-11-168-273/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_cur_t::open_leaf(): Replaces btr_cur_open_at_index_side() for most calls, except dict_stats_analyze_index(), which is the only place where we need to open a page at the non-leaf level. Use btr_block_get() for better error handling. Also, use the enumeration type btr_latch_mode wherever possible. Reviewed by: Vladislav Lesin
| | * | | | Cleanup: Remove btr_pcur_t::old_storedMarko Mäkelä2022-11-162-27/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Boolean field btr_pcur_t::old_stored mostly duplicates old_rec. Let us remove it.
| | * | | | Cleanup: Remove an unnecessary page lookupMarko Mäkelä2022-11-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_cur_search_to_nth_level(): Simply acquire a latch on the already buffer-fixed page. There is no need to release the buffer-fix and re-lookup the page.
| | * | | | Cleanup: Remove BTR_MODIFY_EXTERNALMarko Mäkelä2022-11-161-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_blob_log_check_t::check(): Acquire an index U-latch upfront and pass the flag BTR_MODIFY_LEAF_ALREADY_LATCHED to the search.
| | * | | | Cleanup: Use BTR_INSERT_TREE for pessimistic insertMarko Mäkelä2022-11-162-10/+14
| | | | | |
| | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-11-144-67/+40
| | |\ \ \ \ | | | |/ / /
| | | * | | MDEV-29984 innodb_fast_shutdown=0 fails to report change buffer merge progressMarko Mäkelä2022-11-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ibuf.size, ibuf.max_size: Changed the type to Atomic_relaxed<ulint> in order to fix some (not all) race conditions. ibuf_contract(): Renamed from ibuf_merge_pages(ulint*). ibuf_merge(), ibuf_merge_all(): Removed. srv_shutdown(): Invoke log_free_check() and ibuf_contract(). Even though ibuf_contract() is not writing anything, it will trigger calls of ibuf_merge_or_delete_for_page(), which will write something. Because we cannot invoke log_free_check() at that low level, we must invoke it at the high level. srv_shutdown_print(): Replaces srv_shutdown_print_master_pending(). Report progress and remaining work every 15 seconds. For the change buffer merge, the remaining work is indicated by ibuf.size.
| | | * | | Cleanup: Remove a useless header fileMarko Mäkelä2022-11-143-63/+31
| | | | | |
| | | * | | MDEV-29982 Improve the InnoDB log overwrite error messageMarko Mäkelä2022-11-141-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The InnoDB write-ahead log ib_logfile0 is of fixed size, specified by innodb_log_file_size. If the tail of the log manages to overwrite the head (latest checkpoint) of the log, crash recovery will be broken. Let us clarify the messages about this, including adding a message on the completion of a log checkpoint that notes that the dangerous situation is over. To reproduce the dangerous scenario, we will introduce the debug injection label ib_log_checkpoint_avoid_hard, which will avoid log checkpoints even harder than the previous ib_log_checkpoint_avoid. log_t::overwrite_warned: The first known dangerous log sequence number. Set in log_close() and cleared in log_write_checkpoint_info(), which will output a "Crash recovery was broken" message.
| | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-11-101-4/+0
| | |\ \ \ \ | | | |/ / /
| | | * | | MDEV-21174 fixup: Remove mtr_t::release_page()Marko Mäkelä2022-11-101-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtr_t::release_page(): Remove. The function became unused in commit 56f6dab1d0e5a464ea49c1e5efb0032a0f5cea3e when the call was replaced with a call to mtr_t::memo_release().
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-11-096-84/+28
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.6 into 10.7Marko Mäkelä2022-11-096-84/+28
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-11-081-11/+8
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.4 into 10.5Marko Mäkelä2022-11-081-12/+9
| | | |\ \ \ | | | | |/ /
| | | | * | Merge 10.3 into 10.4Marko Mäkelä2022-11-081-10/+7
| | | | |\ \ | | | | | |/
| | | | | * MDEV-29905 Change buffer operations fail to check for log file overflowMarko Mäkelä2022-11-081-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Every operation that is going to write redo log is supposed to invoke log_free_check() before acquiring any latches. If there is a risk of log buffer overrun, a log checkpoint would be triggered by that call. ibuf_merge_space(), ibuf_merge_in_background(), ibuf_delete_for_discarded_space(): Invoke log_free_check() when the current thread is not holding any page latches. Unfortunately, in lower-level code called from ibuf_insert() or ibuf_merge_or_delete_for_page(), some page latches may be held and a call to log_free_check() could hang. ibuf_set_bitmap_for_bulk_load(): Use the caller's mini-transaction. The caller should have invoked log_free_check() while not holding any page latches.
| | | | * | MDEV-13564 follow-up: Correct a bogus commentMarko Mäkelä2022-11-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This fixes up commit e3c39c0be82e69acb813e7c5e0f2aea7d5546e31
| | * | | | MDEV-29504/MDEV-29849 TRUNCATE breaks FOREIGN KEY lockingMarko Mäkelä2022-11-082-17/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ha_innobase::referenced_by_foreign_key(): Protect the check with dict_sys.freeze(), to prevent races with TRUNCATE TABLE. The test innodb.instant_alter_crash has been adjusted for this additional locking. dict_table_is_referenced_by_foreign_key(): Removed (merged to the only caller). create_table_info_t::create_table(): Ignore missing indexes for FOREIGN KEY constraints if foreign_key_checks=0. create_table_info_t::create_table_update_dict(): Rewritten as a static function. Do not return any error. ha_innobase::create(): When trx!=nullptr and we are operating on a persistent table, do not rollback, commit, or release the data dictionary latch. ha_innobase::truncate(): Protect the entire critical section with an exclusive dict_sys.latch, so that ha_innobase::referenced_by_foreign_key() on referenced tables will return a consistent result. In case of a failure, invoke dict_load_foreigns() to restore also any FOREIGN KEY constraints. ha_innobase::free_foreign_key_create_info(): Define inline. lock_release(): Disregard innodb_evict_tables_on_commit_debug=ON when dict_sys.locked() holds. It would hold when fts_load_stopword() is invoked by create_table_info_t::create_table_update_dict(). dict_sys_t::locked(): Return whether the current thread is holding the exclusive dict_sys.latch. dict_sys_t::frozen_not_locked(): Return whether any thread is holding a shared dict_sys.latch. In the test main.mysql_upgrade, the InnoDB persistent statistics will no longer be recalculated in ha_innobase::open() as part of CHECK TABLE ... FOR UPGRADE. They were deleted earlier in the test. Tested by: Matthias Leich
| | * | | | MDEV-28797 Assertion `page_rec_is_user_rec(rec)' failed in ↵Thirunarayanan Balathandayuthapani2022-11-082-56/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PageBulk::getSplitRec - During alter operation of compressed table, page split operation chooses the first record of the page as split record and it leads to empty left page. This issue caused by the commit 77b3959b5c1528f33ada7aa4445cccf5b5e197b0 (MDEV-28457). page_rec_is_second(), page_rec_is_second_last(): Removed the functions since it is a deadcode.
| | * | | | MDEV-29853 Assertion `!strstr(table->name.m_name, "/FTS_") || ↵Thirunarayanan Balathandayuthapani2022-11-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | purge_sys.must_wait_FTS()' failed in trx_t::commit - Failing debug assertion is to indicate whether the purge thread is waiting when fts auxilary table is being dropped. But assertion fails if the table name contains FTS_. So in fts_drop_table(), InnoDB sets the auxilary table flag in transaction modified table list.
* | | | | | Merge 10.7 into 10.8Marko Mäkelä2022-11-0111-327/+203
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge branch '10.6' into 10.7Oleksandr Byelkin2022-10-293-39/+55
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-29843 Do not use asynchronous log_write_upto() for system THDsVladislav Vaintroub2022-10-251-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Non-blocking log_write_upto (MDEV-24341) was only designed for the client connections. Fix, so it is not be triggered for any system THD. Previously, an incomplete solution only excluded Innodb purge THDs, but not the slave for example. The hang in MDEV still remains somewhat a mystery though, it is not immediately clear how exactly condition variable can become corrupted. But it is clear that it can be avoided.
| | * | | | Merge 10.5 into 10.6Marko Mäkelä2022-10-252-32/+55
| | |\ \ \ \ | | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | To prevent ASAN heap-use-after-poison in the MDEV-16549 part of ./mtr --repeat=6 main.derived the initialization of Name_resolution_context was cleaned up.
| | | * | | Merge 10.4 into 10.5Marko Mäkelä2022-10-251-18/+13
| | | |\ \ \ | | | | |/ /
| | | | * | Merge 10.3 into 10.4Marko Mäkelä2022-10-251-18/+13
| | | | |\ \ | | | | | |/