summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-24660 MYSQL_BIN_LOG::cleanup(): Assertion `b->xid_count == 0'bb-10.10-MDEV-28883Andrei2022-08-092-1/+3
| | | | | | | | | The assert fired at shutdown time to indicate a missed decrement to the count. The counter could not have been decremented because the binlog background thread had already gone. Fixed with relocation the binlog background thread exit in the server shutdown module.
* MDEV-29189 Crash of the second execution of SF using DELETE/UPDATEIgor Babaev2022-07-293-0/+78
| | | | | | | | | | | | This bug caused a crash of the server at the second execution of a stored function that used DELETE or UPDATE statement if the first execution of this function reported an error encountered after the prepare phase. This happened because in such cases the executed DELETE/UPDATE statement remained marked as prepared. As a result the second execution of SF missed the prepare phase for the statement altogether and the statement could not be executed properly. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* Assertion failure with UPDATE of view using MERGE tableIgor Babaev2022-07-293-8/+21
| | | | The problem was caused by an assertion that is not valid anymore.
* MDEV-28965 Assertion failure when preparing UPDATE with derived table in WHEREIgor Babaev2022-07-1127-88/+1107
| | | | | | | | | | | | | | | This patch fixes not only the assertion failure in the function Field_iterator_table_ref::set_field_iterator() but also: - fixes the problem of forced materialization of derived tables used in subqueries contained in WHERE clauses of single-table and multi-table UPDATE and DELETE statements - fixes the problem of MDEV-17954 that prevented execution of multi-table DELETE statements if they use in their WHERE clauses references to the tables that are updated. The patch must be considered a complement to the patch for MDEV-28883. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* MDEV-28883 Re-design the upper level of handling UPDATE and DELETE statementsIgor Babaev2022-06-2738-1287/+1454
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces a new way of handling UPDATE and DELETE commands at the top level after the parsing phase. This new way of processing update and delete statements can be seen in the implementation of the prepare() and execute() methods from the new Sql_cmd_dml class. This class derived from the Sql_cmd class can be considered as an interface class for processing such commands as SELECT, INSERT, UPDATE, DELETE and other comands manipulating data in tables. With this patch processing of update and delete statements after parsing proceeds by the following schema: - precheck of the access rights is performed for the used tables - the used tables are opened - context analysis phase is performed for the statement - the used tables are locked - the statement is optimized and executed - clean-up is performed for the statement The implementation of the method Sql_cmd_dml::execute() adheres this schema. The virtual functions of the class Sql_cmd_dml used for precheck of the access rights, context analysis, optimization and execution allow to adjust this schema for processing data manipulation statements of any types. This schema of processing data manipulation statements is taken from the current MySQL code. Moreover the definition the class Sql_cmd_dml introduced in this patch is almost a full replica of such class in the existing MySQL. However the implementation of the derived classes for update and delete statements is quite different. This implementation employs the JOIN class for all kinds of update and delete statements. It allows to perform main bulk of context analysis actions by the function JOIN::prepare(). This guarantees that characteristics and properties of the statement tree discovered for optimization phase when doing context analysis are the same for single-table and multi-table updates and deletes. With this patch the following functions are gone: mysql_prepare_update(), mysql_multi_update_prepare(), mysql_update(), mysql_multi_update(), mysql_prepare_delete(), mysql_multi_delete_prepare(), mysql_delete(). The code within these functions have been used as much as possible though. The functions mysql_test_update() and mysql_test_delete() are also not needed anymore. The method Sql_cmd_dml::prepare() serves processing - update/delete statement - PREPARE stmt FROM "<update/delete statement>" - EXECUTE stmt when stmt is prepared from update/delete statement. Approved by Oleksandr Byelkin <sanja@mariadb.com>
* Merge 10.9 into 10.10Marko Mäkelä2022-06-2324-162/+238
|\
| * Merge 10.8 into 10.9Marko Mäkelä2022-06-2317-158/+142
| |\
| | * Merge 10.7 into 10.8Marko Mäkelä2022-06-2317-158/+142
| | |\
| | | * Merge 10.6 into 10.7Marko Mäkelä2022-06-2317-160/+143
| | | |\
| | | | * MDEV-28923 atomic.rename_table occasionally failsMarko Mäkelä2022-06-231-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fil_name_process(): If the recovery of a tablespace was deferred, do invoke fil_ibd_load() even though the name in recv_spaces is not changing. This allows us to recover from a situation where there are many FILE_RENAME records, renaming a tablespace back and forth, and a FILE_MODIFY record that had been written by fil_names_clear(). Co-developed with: Thirunarayanan Balathandayuthapani
| | | | * Merge remote-tracking branch 'origin/10.5' into 10.6Vladislav Vaintroub2022-06-235-14/+73
| | | | |\
| | | | | * MDEV-28920 Rescheduling of innodb_stats_func() missingVladislav Vaintroub2022-06-231-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed tpool timer implementation on POSIX. Prior to this patch, under some specific rare circumstances (concurrency related), timer callback execution might be skipped.
| | | | | * MDEV-28858 Wrong result with table elimination combined with not_null_range_scanMonty2022-06-164-6/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug was that build_notnull_conds_for_range_scans() did not take into account the join_tab is not yet sorted with constant tables first. Fixed the bug by testing explicitely if a table is a const table.
| | | | * | MDEV-18976 fixup: encryption.innodb-redo-badkeyMarko Mäkelä2022-06-222-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When attempting to recover a database with an incorrect encryption key, the unencrypted page contents should be expected to differ from what was written before recovery. Let us suppress some more messages. This caused intermittent failures, depending on when the latest log checkpoint was triggered.
| | | | * | MDEV-22388 Corrupted undo log record leads to server crashMarko Mäkelä2022-06-229-130/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | trx_undo_rec_copy(): Return nullptr if the undo record is corrupted. trx_undo_rec_get_undo_no(): Define inline with the declaration. trx_purge_dummy_rec: Replaced with a -1 pointer. row_undo_rec_get(), UndorecApplier::apply_undo_rec(): Check if trx_undo_rec_copy() returned nullptr. trx_purge_get_next_rec(): Return nullptr upon encountering any corruption, to signal the end of purge.
| * | | | | Merge 10.8 into 10.9Marko Mäkelä2022-06-227-4/+96
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.7 into 10.8Marko Mäkelä2022-06-224-3/+29
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.6 into 10.7Marko Mäkelä2022-06-224-3/+29
| | | |\ \ \ | | | | |/ /
| | | | * | MDEV-28836 fixupMarko Mäkelä2022-06-224-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On GNU/Linux, even though the C11 aligned_alloc() appeared in GNU libc early on, some custom memory allocators did not implement it until recently. For example, before gperftools/gperftools@d406f2285390c402e824dd28e6992f7f890dcdf9 the free() in tcmalloc would fail to free memory that was returned by aligned_alloc(), because the latter would map to the built-in allocator of libc. The Linux specific memalign() has a similar interface and is safer to use, because it has been available for a longer time. For AddressSanitizer, we will use aligned_alloc() so that the constraint on size can be enforced. buf_tmp_reserve_compression_buf(): When HAVE_ALIGNED_ALLOC holds, round up the size to be an integer multiple of the alignment. pfs_malloc(): In the unit test stub, round up the size to be an integer multiple of the alignment.
| | * | | | MDEV-28882: Assertion `tmp >= 0' failed in best_access_pathSergei Petrunia2022-06-223-1/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Histogram_json_hb::range_selectivity() may return small negative numbers due to rounding errors in the histogram. Make sure the returned value is non-negative. Add an assert to catch negative values that are not small. (attempt #2)
* | | | | | Merge 10.9 into 10.10Marko Mäkelä2022-06-2136-496/+406
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.8 into 10.9Marko Mäkelä2022-06-2135-496/+405
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.7 into 10.8Marko Mäkelä2022-06-2135-496/+405
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.6 into 10.7Marko Mäkelä2022-06-2132-423/+299
| | | |\ \ \ | | | | |/ /
| | | | * | MDEV-28836: Memory alignment cleanupMarko Mäkelä2022-06-2122-150/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Table_cache_instance: Define the structure aligned at the CPU cache line, and remove a pad[] data member. Krunal Bauskar reported this to improve performance on ARMv8. aligned_malloc(): Wrapper for the Microsoft _aligned_malloc() and the ISO/IEC 9899:2011 <stdlib.h> aligned_alloc(). Note: The parameters are in the Microsoft order (size, alignment), opposite of aligned_alloc(alignment, size). Note: The standard defines that size must be an integer multiple of alignment. It is enforced by AddressSanitizer but not by GNU libc on Linux. aligned_free(): Wrapper for the Microsoft _aligned_free() and the standard free(). HAVE_ALIGNED_ALLOC: A new test. Unfortunately, support for aligned_alloc() may still be missing on some platforms. We will fall back to posix_memalign() for those cases. HAVE_MEMALIGN: Remove, along with any use of the nonstandard memalign(). PFS_ALIGNEMENT (sic): Removed; we will use CPU_LEVEL1_DCACHE_LINESIZE. PFS_ALIGNED: Defined using the C++11 keyword alignas. buf_pool_t::page_hash_table::create(), lock_sys_t::hash_table::create(): lock_sys_t::hash_table::resize(): Pad the allocation size to an integer multiple of the alignment. Reviewed by: Vladislav Vaintroub
| | | | * | MDEV-28870 InnoDB: Missing FILE_CREATE, FILE_DELETE or FILE_MODIFY before ↵Marko Mäkelä2022-06-215-263/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FILE_CHECKPOINT There was a race condition between log_checkpoint_low() and deleting or renaming data files. The scenario is as follows: 1. The buffer pool does not contain dirty pages. 2. A FILE_DELETE or FILE_RENAME record is written. 3. The checkpoint LSN will be moved ahead of the write of the record. 4. The server is killed before the file is actually renamed or deleted. We will prevent this race condition by ensuring that a log checkpoint cannot occur between the durable write and the file system operation: 1. Durably write the FILE_DELETE or FILE_RENAME record. 2. Perform the file system operation. 3. Allow any log checkpoint to proceed. mtr_t::commit_file(): Implement the DELETE or RENAME logic. fil_delete_tablespace(): Delegate some of the logic to mtr_t::commit_file(). fil_space_t::rename(): Delegate some logic to mtr_t::commit_file(). Remove the debug injection point fil_rename_tablespace_failure_2 because we do test RENAME failures without any debug injection. fil_name_write_rename_low(), fil_name_write_rename(): Remove. Tested by Matthias Leich
| | | | * | MDEV-28845 fixup: Prevent an infinite loopMarko Mäkelä2022-06-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buf_page_create_low(): Before retrying, release the exclusive page latch in order to prevent an infinite loop in buf_pool_t::corrupted_evict().
| | | | * | MDEV-28782 fixup: ./mtr --embeddedMarko Mäkelä2022-06-211-0/+17
| | | | | |
| | | | * | MDEV-28782 mariadb-tzinfo-to-sql to work in bootstrap modeDaniel Black2022-06-184-24/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Work around MDEV-28718 for now, but also optimize the interation of information_schema.SYSTEM_VARIABLES. Add test case to show that tzinfo data into bootstrap is desired functionality. Bug report thanks to Dan Lenski of AWS.
| | | * | | fix spider.variable_deprecation testSergei Golubchik2022-06-162-62/+76
| | | | | |
| | | * | | re-enable innodb.innodb_page_compressed testsSergei Golubchik2022-06-161-0/+5
| | | | | |
| * | | | | MDEV-28819 Statically compiled encryption plugins do not workVladislav Vaintroub2022-06-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Disable building hashicorp encryption plugin statically
* | | | | | Merge 10.9 into 10.10Marko Mäkelä2022-06-202-7/+4
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.8 into 10.9Marko Mäkelä2022-06-201-6/+3
| |\ \ \ \ \ | | |/ / / /
| | * | | | MDEV-28879 Assertion `l->lsn <= log_sys.get_lsn()' failed around ↵Marko Mäkelä2022-06-201-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | recv_recover_page recv_recover_page(): Correct a debug assertion to refer to recv_sys.lsn, which may be ahead of log_sys.lsn during non-final recovery batches. In commit 685d958e38b825ad9829be311f26729cccf37c46 (MDEV-14425) when some redundant LSN fields were removed, log_sys.log.scanned_lsn had been replaced with a reference to log_sys.lsn instead of the more appropriate recv_sys.lsn. recv_scan_log(): Remove a redundant call to log_sys.set_recovered_lsn(). It suffices to adjust the log_sys.lsn after parsing (and before starting to apply) records for the last batch. Note: Normally, log_sys.lsn must be the latest log sequence number. Before the final recovery batch, this may be safely violated, because log_write_up_to() will be a no-op. That function will be invoked by the buf_flush_page_cleaner thread to initiate writes of recovered pages.
| * | | | | Fix building the Hashicorp plugin on OpenBSD / NetBSD and DragonFlyBSDBrad Smith2022-06-181-1/+1
| | | | | |
* | | | | | MDEV-27809 Spider: remove #ifdef SPIDER_I_S_USE_SHOW_FOR_COLUMNYusuke Abe2022-06-202-34/+0
| | | | | | | | | | | | | | | | | | Reviewed by: Nayuta Yanagisawa
* | | | | | MDEV-27811 Spider: remove #ifdef SPIDER_MDEV_16246Yuichiro Suzuki2022-06-203-9/+0
| | | | | | | | | | | | | | | | | | Reviewed by: Nayuta Yanagisawa
* | | | | | Merge 10.9 into 10.10Marko Mäkelä2022-06-176-17/+38
|\ \ \ \ \ \ | |/ / / / /
| * | | | | Merge 10.8 into 10.9Marko Mäkelä2022-06-176-17/+38
| |\ \ \ \ \ | | |/ / / /
| | * | | | Merge 10.7 into 10.8Marko Mäkelä2022-06-166-17/+38
| | |\ \ \ \ | | | |/ / /
| | | * | | Merge 10.6 into 10.7Marko Mäkelä2022-06-166-25/+42
| | | |\ \ \ | | | | |/ /
| | | | * | Merge 10.5 into 10.6Marko Mäkelä2022-06-161-19/+19
| | | | |\ \ | | | | | |/
| | | | | * MDEV-28832 infinite loop in mariabackup if log LOG_HEADER_FORMAT field is 0Vlad Lesin2022-06-151-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | Avoid the loop with getting rid of back and forth jumping.
| | | | * | MDEV-28864 Assertion `trx_id <= create_id' failed in innodb_check_version()Marko Mäkelä2022-06-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ha_innobase::prepare_inplace_alter_table(): If the ALTER TABLE operation is no-op for InnoDB, do reset m_prebuilt->trx_id so that ha_innobase::table_version() will always report either 0 or the identifier of the transaction that would commit changes to the InnoDB data dictionary. The failure scenario involved a completed DROP INDEX followed by a no-op ALTER TABLE during which the server was killed. An effort to create a reproducible test failed.
| | | | * | MDEV-28845 InnoDB: Failing assertion: bpage->can_relocate() in buf0lru.ccMarko Mäkelä2022-06-154-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 0b47c126e31cddda1e94588799599e138400bcf8 (MDEV-13542) we treat all-zero pages as corrupted ones. During a stress test, a read-ahead of an all-zero page was triggered and the page read was completed concurrently with buf_page_create_low(). This caused the assertion to fail, because buf_page_create_low() was waiting for the page latch. buf_page_get_low(): Only invoke buf_pool_t::corrupted_evict() if the block was not already marked as corrupted. buf_page_create_low(): On page identifier mismatch, retry the buf_pool.page_hash lookup. buf_pool_t::corrupted_evict(): Set the state of the block to FREED so that a concurrent buf_page_get_low() will refuse to load the page. Wait for the page latch to be vacant before proceeding to remove the block from buf_pool.page_hash and buf_pool.LRU. page_id_t::set_corrupted(), page_id_t::is_corrupted(): Accessors for indicating a corrupted page identifier. Tested by Matthias Leich
| | | | * | MDEV-13542 fixup: Relax an assertionMarko Mäkelä2022-06-151-0/+1
| | | | | |
* | | | | | Merge branch '10.9' into 10.10Sergei Golubchik2022-06-1716-79/+163
|\ \ \ \ \ \ | |/ / / / /
| * | | | | fix sporadic versioning.rpl_row failuresSergei Golubchik2022-06-161-0/+1
| | | | | |
| * | | | | fixes for aarch64 debSergei Golubchik2022-06-161-0/+4
| | | | | |