summaryrefslogtreecommitdiff
path: root/storage/innobase
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-22325 ib_logfile0 is too small for innodb_thread_concurrency=0. The ↵Eugene Kosov2020-06-093-19/+10
| | | | | | | | | size of ib_logfile0 should be bigger than 200 kB * innodb_thread_concurrency. Correct log message. IMO, we shouldn't be very precise in that message as the formula behind it is not trivial. Also performed a little cleanup.
* MDEV-15053 follow-up to reduce buf_pool.mutex contentionMarko Mäkelä2020-06-087-85/+47
| | | | | | | | | | | | | buf_LRU_make_block_young(): Merge with buf_page_make_young(). buf_pool_check_no_pending_io(): Remove. Replaced with buf_pool.any_io_pending() and buf_pool.io_pending(), which do not unnecessarily acquire buf_pool.mutex. buf_pool_t::init_flush[]: Use atomic access, so that buf_flush_wait_LRU_batch_end() can avoid acquiring buf_pool.mutex. buf_pool_t::try_LRU_scan: Declare as bool.
* MDEV-22824 Buffer overflow in dict_table_t::parse_name()Marko Mäkelä2020-06-071-6/+13
| | | | | dict_table_t::parse_name(): Strip any partition or subpartition name before copying the name to the decoding buffer.
* Merge 10.4 into 10.5Marko Mäkelä2020-06-071-3/+3
|\
| * Merge 10.3 into 10.4Marko Mäkelä2020-06-062-13/+13
| |\
| | * Merge 10.2 into 10.3Marko Mäkelä2020-06-061-3/+3
| | |\
| | | * MDEV-22818 Server crash on corrupted ROW_FORMAT=COMPRESSED pageMarko Mäkelä2020-06-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | page_zip_fields_decode(): Do not dereference index=NULL. Instead, return NULL early. The only caller does not care about the values of output parameters in that case. This bug was introduced in MySQL 5.7.6 by mysql/mysql-server@9eae0edb7a8e4004328e61157f5f3b39cebe1b2b and in MariaDB 10.2.2 by commit 2e814d4702d71a04388386a9f591d14a35980bfe. Thanks to my son for pointing this out after investigating the output of a static analysis tool.
| | * | MDEV-22721 fixup for 32-bit GCCMarko Mäkelä2020-06-061-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | lock_check_trx_id_sanity(): Because the argument of UNIV_LIKELY or __builtin_expect() can be less than sizeof(trx_id_t) on 32-bit systems, it cannot reliably perform an implicit comparison to 0.
* | | | MDEV-22817 Assertion idlen <= MAX_TABLE_NAME_LEN in ↵Marko Mäkelä2020-06-071-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | create_table_info_t::create_foreign_keys() create_table_info_t::create_foreign_keys(): Make the create_name buffer long enough for both the database and table name. It is still not long enough to hold partition or subpartition names. Because we do never supported FOREIGN KEY constraints on partitions, we can simply skip the call to innobase_convert_name() on CREATE TABLE.
* | | | MDEV-22721: Fix GCC 5.3.1 -WconversionMarko Mäkelä2020-06-061-10/+10
| | | |
* | | | MDEV-22816 Assertion `node->space == fil_system.sys_space' failed in ↵Marko Mäkelä2020-06-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fil_aio_callback fil_aio_callback(): Remove a bogus assertion that was added in commit b1ab211dee599eabd9a5b886fafa3adea29ae041 (MDEV-15053). We will have !bpage for any write by buf_flush_freed_page().
* | | | MDEV-15053 fixup: MSAN use-of-uninitialized-valueMarko Mäkelä2020-06-063-11/+9
| | | | | | | | | | | | | | | | | | | | buf_page_init_for_read(): Initialize the output parameter of buf_buddy_alloc().
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-06-0542-466/+475
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-06-0543-541/+496
| |\ \ \ | | |/ /
| | * | After-merge fix: GCC -Wmaybe-uninitializedMarko Mäkelä2020-06-051-2/+2
| | | |
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-06-0543-550/+497
| | |\ \ | | | |/
| | | * MDEV-22769 Shutdown hang or crash due to XA breaking locksMarko Mäkelä2020-06-0511-50/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The background drop table queue in InnoDB is a work-around for cases where the SQL layer is requesting DDL on tables on which transactional locks exist. One such case are XA transactions. Our test case exploits the fact that the recovery of XA PREPARE transactions will only resurrect InnoDB table locks, but not MDL that should block any concurrent DDL. srv_shutdown_t: Introduce the srv_shutdown_state=SRV_SHUTDOWN_INITIATED for the initial part of shutdown, to wait for the background drop table queue to be emptied. srv_shutdown_bg_undo_sources(): Assign srv_shutdown_state=SRV_SHUTDOWN_INITIATED before waiting for the background drop table queue to be emptied. row_drop_tables_for_mysql_in_background(): On slow shutdown, if no active transactions exist (excluding ones that are in XA PREPARE state), skip any tables on which locks exist. row_drop_table_for_mysql(): Do not unnecessarily attempt to drop InnoDB persistent statistics for tables that have already been added to the background drop table queue. row_mysql_close(): Relax an assertion, and free all memory even if innodb_force_recovery=2 would prevent the background drop table queue from being emptied.
| | | * MDEV-22790 Race between btr_page_mtr_lock() dropping AHI on the same blockMarko Mäkelä2020-06-052-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This race condition was introduced by commit ad6171b91cac33e70bb28fa6865488b2c65e858c (MDEV-22456). In the observed case, two threads were executing btr_search_drop_page_hash_index() on the same block, to free a stale entry that was attached to a dropped index. Both threads were holding an S latch on the block. We must prevent the double-free of block->index by holding block->lock in exclusive mode. btr_search_guess_on_hash(): Do not invoke btr_search_drop_page_hash_index(block) to get rid of stale entries, because we are not necessarily holding an exclusive block->lock here. buf_defer_drop_ahi(): New function, to safely drop stale entries in buf_page_mtr_lock(). We will skip the call to btr_search_drop_page_hash_index(block) when only requesting bufferfixing (no page latch), because in that case, we should not be accessing the adaptive hash index, and we might get a deadlock if we acquired the page latch.
| | | * MDEV-22646: Fix a memory leakMarko Mäkelä2020-06-051-12/+22
| | | | | | | | | | | | | | | | | | | | | | | | btr_search_sys_free(): Free btr_search_sys->hash_tables. The leak was introduced in commit ad2bf1129cfa85c00072b46e0355fe14bf69ee54.
| | | * dict_check_sys_tables(): Do not rely on buf_page_optimistic_get()Marko Mäkelä2020-06-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are supposed to commit and restart the mini-transaction between records. There is no point to store and restore the persistent cursor position otherwise. If buf_page_optimistic_get() is patched to always fail, the debug build would fail to start up due to trying to re-acquire an already S-latched block. This bug (which should not have visible impact to users, because the code is only executed during startup, while no other threads are accessing B-trees or causing pages to be evicted from the buffer pool) was caught as part of a debugging effort for something else. The debugging approach was: Make buf_page_optimistic_get() always return FALSE, and add ut_a(block->lock.lock_word == X_LOCK_DECR) to both buf_LRU_get_free_only() and buf_LRU_block_free_non_file_page(). This would catch misuse of the buffer pool. If it were not for buf_page_optimistic_get(), no buf_block_t::lock of any BUF_BLOCK_NOT_USED block would ever be acquired.
| | | * MDEV-22721 Remove bloat caused by InnoDB logger classMarko Mäkelä2020-06-0437-326/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new ATTRIBUTE_NOINLINE to ib::logger member functions, and add UNIV_UNLIKELY hints to callers. Also, remove some crash reporting output. If needed, the information will be available using debugging tools. Furthermore, remove some fts_enable_diag_print output that included indexed words in raw form. The code seemed to assume that words are NUL-terminated byte strings. It is not clear whether a NUL terminator is always guaranteed to be present. Also, UCS2 or UTF-16 strings would typically contain many NUL bytes.
| | | * MDEV-22646 Assertion `table2->cached' failed in dict_table_t::add_to_cacheThirunarayanan Balathandayuthapani2020-06-038-147/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======== During buffer pool resizing, InnoDB recreates the dictionary hash tables. Dictionary hash table reuses the heap of AHI hash tables. It leads to memory corruption. Fix: ==== - While disabling AHI, free the heap and AHI hash tables. Recreate the AHI hash tables and assign new heap when AHI is enabled. - btr_blob_free() access invalid page if page was reallocated during buffer poolresizing. So btr_blob_free() should get the page from buf_pool instead of using existing block. - btr_search_enabled and block->index should be checked after acquiring the btr_search_sys latch - Moved the buffer_pool_scan debug sync to earlier before accessing the btr_search_sys latches to avoid the hang of truncate_purge_debug test case - srv_printf_innodb_monitor() should acquire btr_search_sys latches before AHI hash tables.
| | | * MDEV-22577 innodb_fast_shutdown=0 fails to report purge progressMarko Mäkelä2020-06-031-4/+6
| | | | | | | | | | | | | | | | | | | | srv_purge_should_exit(): Report progress on slow shutdown not only to systemd, but also to the error log.
* | | | MDEV-21751 followup: Bypass the change buffer on slow shutdownMarko Mäkelä2020-06-051-0/+6
| | | |
* | | | Reduce CPU usage in srv_purge_shutdown.Vladislav Vaintroub2020-06-051-1/+1
| | | | | | | | | | | | | | | | Polling for srv_purge_should_exit() once every millisecond is enough.
* | | | MDEV-15053 Reduce buf_pool_t::mutex contentionMarko Mäkelä2020-06-0583-6962/+4051
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User-visible changes: The INFORMATION_SCHEMA views INNODB_BUFFER_PAGE and INNODB_BUFFER_PAGE_LRU will report a dummy value FLUSH_TYPE=0 and will no longer report the PAGE_STATE value READY_FOR_USE. We will remove some fields from buf_page_t and move much code to member functions of buf_pool_t and buf_page_t, so that the access rules of data members can be enforced consistently. Evicting or adding pages in buf_pool.LRU will remain covered by buf_pool.mutex. Evicting or adding pages in buf_pool.page_hash will remain covered by both buf_pool.mutex and the buf_pool.page_hash X-latch. After this fix, buf_pool.page_hash lookups can entirely avoid acquiring buf_pool.mutex, only relying on buf_pool.hash_lock_get() S-latch. Similarly, buf_flush_check_neighbors() can will rely solely on buf_pool.mutex, no buf_pool.page_hash latch at all. The buf_pool.mutex is rather contended in I/O heavy benchmarks, especially when the workload does not fit in the buffer pool. The first attempt to alleviate the contention was the buf_pool_t::mutex split in commit 4ed7082eefe56b3e97e0edefb3df76dd7ef5e858 which introduced buf_block_t::mutex, which we are now removing. Later, multiple instances of buf_pool_t were introduced in commit c18084f71b02ea707c6461353e6cfc15d7553bc6 and recently removed by us in commit 1a6f708ec594ac0ae2dd30db926ab07b100fa24b (MDEV-15058). UNIV_BUF_DEBUG: Remove. This option to enable some buffer pool related debugging in otherwise non-debug builds has not been used for years. Instead, we have been using UNIV_DEBUG, which is enabled in CMAKE_BUILD_TYPE=Debug. buf_block_t::mutex, buf_pool_t::zip_mutex: Remove. We can mainly rely on std::atomic and the buf_pool.page_hash latches, and in some cases depend on buf_pool.mutex or buf_pool.flush_list_mutex just like before. We must always release buf_block_t::lock before invoking unfix() or io_unfix(), to prevent a glitch where a block that was added to the buf_pool.free list would apper X-latched. See commit c5883debd6ef440a037011c11873b396923e93c5 how this glitch was finally caught in a debug environment. We move some buf_pool_t::page_hash specific code from the ha and hash modules to buf_pool, for improved readability. buf_pool_t::close(): Assert that all blocks are clean, except on aborted startup or crash-like shutdown. buf_pool_t::validate(): No longer attempt to validate n_flush[] against the number of BUF_IO_WRITE fixed blocks, because buf_page_t::flush_type no longer exists. buf_pool_t::watch_set(): Replaces buf_pool_watch_set(). Reduce mutex contention by separating the buf_pool.watch[] allocation and the insert into buf_pool.page_hash. buf_pool_t::page_hash_lock<bool exclusive>(): Acquire a buf_pool.page_hash latch. Replaces and extends buf_page_hash_lock_s_confirm() and buf_page_hash_lock_x_confirm(). buf_pool_t::READ_AHEAD_PAGES: Renamed from BUF_READ_AHEAD_PAGES. buf_pool_t::curr_size, old_size, read_ahead_area, n_pend_reads: Use Atomic_counter. buf_pool_t::running_out(): Replaces buf_LRU_buf_pool_running_out(). buf_pool_t::LRU_remove(): Remove a block from the LRU list and return its predecessor. Incorporates buf_LRU_adjust_hp(), which was removed. buf_page_get_gen(): Remove a redundant call of fsp_is_system_temporary(), for mode == BUF_GET_IF_IN_POOL_OR_WATCH, which is only used by BTR_DELETE_OP (purge), which is never invoked on temporary tables. buf_free_from_unzip_LRU_list_batch(): Avoid redundant assignments. buf_LRU_free_from_unzip_LRU_list(): Simplify the loop condition. buf_LRU_free_page(): Clarify the function comment. buf_flush_check_neighbor(), buf_flush_check_neighbors(): Rewrite the construction of the page hash range. We will hold the buf_pool.mutex for up to buf_pool.read_ahead_area (at most 64) consecutive lookups of buf_pool.page_hash. buf_flush_page_and_try_neighbors(): Remove. Merge to its only callers, and remove redundant operations in buf_flush_LRU_list_batch(). buf_read_ahead_random(), buf_read_ahead_linear(): Rewrite. Do not acquire buf_pool.mutex, and iterate directly with page_id_t. ut_2_power_up(): Remove. my_round_up_to_next_power() is inlined and avoids any loops. fil_page_get_prev(), fil_page_get_next(), fil_addr_is_null(): Remove. buf_flush_page(): Add a fil_space_t* parameter. Minimize the buf_pool.mutex hold time. buf_pool.n_flush[] is no longer updated atomically with the io_fix, and we will protect most buf_block_t fields with buf_block_t::lock. The function buf_flush_write_block_low() is removed and merged here. buf_page_init_for_read(): Use static linkage. Initialize the newly allocated block and acquire the exclusive buf_block_t::lock while not holding any mutex. IORequest::IORequest(): Remove the body. We only need to invoke set_punch_hole() in buf_flush_page() and nowhere else. buf_page_t::flush_type: Remove. Replaced by IORequest::flush_type. This field is only used during a fil_io() call. That function already takes IORequest as a parameter, so we had better introduce for the rarely changing field. buf_block_t::init(): Replaces buf_page_init(). buf_page_t::init(): Replaces buf_page_init_low(). buf_block_t::initialise(): Initialise many fields, but keep the buf_page_t::state(). Both buf_pool_t::validate() and buf_page_optimistic_get() requires that buf_page_t::in_file() be protected atomically with buf_page_t::in_page_hash and buf_page_t::in_LRU_list. buf_page_optimistic_get(): Now that buf_block_t::mutex no longer exists, we must check buf_page_t::io_fix() after acquiring the buf_pool.page_hash lock, to detect whether buf_page_init_for_read() has been initiated. We will also check the io_fix() before acquiring hash_lock in order to avoid unnecessary computation. The field buf_block_t::modify_clock (protected by buf_block_t::lock) allows buf_page_optimistic_get() to validate the block. buf_page_t::real_size: Remove. It was only used while flushing pages of page_compressed tables. buf_page_encrypt(): Add an output parameter that allows us ot eliminate buf_page_t::real_size. Replace a condition with debug assertion. buf_page_should_punch_hole(): Remove. buf_dblwr_t::add_to_batch(): Replaces buf_dblwr_add_to_batch(). Add the parameter size (to replace buf_page_t::real_size). buf_dblwr_t::write_single_page(): Replaces buf_dblwr_write_single_page(). Add the parameter size (to replace buf_page_t::real_size). fil_system_t::detach(): Replaces fil_space_detach(). Ensure that fil_validate() will not be violated even if fil_system.mutex is released and reacquired. fil_node_t::complete_io(): Renamed from fil_node_complete_io(). fil_node_t::close_to_free(): Replaces fil_node_close_to_free(). Avoid invoking fil_node_t::close() because fil_system.n_open has already been decremented in fil_space_t::detach(). BUF_BLOCK_READY_FOR_USE: Remove. Directly use BUF_BLOCK_MEMORY. BUF_BLOCK_ZIP_DIRTY: Remove. Directly use BUF_BLOCK_ZIP_PAGE, and distinguish dirty pages by buf_page_t::oldest_modification(). BUF_BLOCK_POOL_WATCH: Remove. Use BUF_BLOCK_NOT_USED instead. This state was only being used for buf_page_t that are in buf_pool.watch. buf_pool_t::watch[]: Remove pointer indirection. buf_page_t::in_flush_list: Remove. It was set if and only if buf_page_t::oldest_modification() is nonzero. buf_page_decrypt_after_read(), buf_corrupt_page_release(), buf_page_check_corrupt(): Change the const fil_space_t* parameter to const fil_node_t& so that we can report the correct file name. buf_page_monitor(): Declare as an ATTRIBUTE_COLD global function. buf_page_io_complete(): Split to buf_page_read_complete() and buf_page_write_complete(). buf_dblwr_t::in_use: Remove. buf_dblwr_t::buf_block_array: Add IORequest::flush_t. buf_dblwr_sync_datafiles(): Remove. It was a useless wrapper of os_aio_wait_until_no_pending_writes(). buf_flush_write_complete(): Declare static, not global. Add the parameter IORequest::flush_t. buf_flush_freed_page(): Simplify the code. recv_sys_t::flush_lru: Renamed from flush_type and changed to bool. fil_read(), fil_write(): Replaced with direct use of fil_io(). fil_buffering_disabled(): Remove. Check srv_file_flush_method directly. fil_mutex_enter_and_prepare_for_io(): Return the resolved fil_space_t* to avoid a duplicated lookup in the caller. fil_report_invalid_page_access(): Clean up the parameters. fil_io(): Return fil_io_t, which comprises fil_node_t and error code. Always invoke fil_space_t::acquire_for_io() and let either the sync=true caller or fil_aio_callback() invoke fil_space_t::release_for_io(). fil_aio_callback(): Rewrite to replace buf_page_io_complete(). fil_check_pending_operations(): Remove a parameter, and remove some redundant lookups. fil_node_close_to_free(): Wait for n_pending==0. Because we no longer do an extra lookup of the tablespace between fil_io() and the completion of the operation, we must give fil_node_t::complete_io() a chance to decrement the counter. fil_close_tablespace(): Remove unused parameter trx, and document that this is only invoked during the error handling of IMPORT TABLESPACE. row_import_discard_changes(): Merged with the only caller, row_import_cleanup(). Do not lock up the data dictionary while invoking fil_close_tablespace(). logs_empty_and_mark_files_at_shutdown(): Do not invoke fil_close_all_files(), to avoid a !needs_flush assertion failure on fil_node_t::close(). innodb_shutdown(): Invoke os_aio_free() before fil_close_all_files(). fil_close_all_files(): Invoke fil_flush_file_spaces() to ensure proper durability. thread_pool::unbind(): Fix a crash that would occur on Windows after srv_thread_pool->disable_aio() and os_file_close(). This fix was submitted by Vladislav Vaintroub. Thanks to Matthias Leich and Axel Schwenke for extensive testing, Vladislav Vaintroub for helpful comments, and Eugene Kosov for a review.
* | | | For better experience in Visual Studio IDE, add header files to Innodb sourcesVladislav Vaintroub2020-06-051-0/+213
| | | |
* | | | MDEV-22787 postfixVladislav Vaintroub2020-06-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that FTS_MSG_STOP is the very last message, and nothing comes after it in fts_optimize_shutdown. Stop the timer to ensure that.
* | | | MDEV-21751 postfixVladislav Vaintroub2020-06-031-1/+1
| | | | | | | | | | | | | | | | Use symbolic constant for max purge threads.
* | | | MDEV-21751 innodb_fast_shutdown=0 can be unnecessarily slowVladislav Vaintroub2020-06-035-20/+47
| | | | | | | | | | | | | | | | max out parallel purge worker tasks, on slow shutdown, to speedup
* | | | MDEV-22787 fts_optimize_shutdown() deletes timer prematurelyMarko Mäkelä2020-06-031-2/+2
| | | | | | | | | | | | | | | | | | | | fts_optimize_shutdown(): Wait for fts_optimize_callback() to terminate before deleting the timer that it uses.
* | | | MDEV-22710 Assertion ...status != buf_page_t::FREED in ibuf_remove_free_page()Marko Mäkelä2020-06-033-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The buf_page_free() call that was introduced in MDEV-15528 was performed too early in fseg_free_page(), tripping a debug check in ibuf_remove_free_page(). In all other callers, we can (and will) invoke buf_page_free() right after fseg_free_page(), but in ibuf_remove_free_page() we will defer that call to the end of the mini-transaction. (That call was already present.)
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-06-0313-76/+10
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-06-0312-82/+13
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-06-0211-78/+11
| | |\ \ | | | |/
| | | * MDEV-22650 Dirty compressed page checksum validation failsThirunarayanan Balathandayuthapani2020-06-013-26/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======= While evicting the uncompressed page from buffer pool, InnoDB writes the checksum for the compressed page in buf_LRU_free_page(). So while flushing the compressed page, checksum validation fails when innodb_checksum_algorithm variable changed to strict_none. Solution: ======== - Calculate the checksum only during flushing of page. Removed the checksum write in buf_LRU_free_page().
| | | * Cleanup: Remove thr_is_recv(), trx_is_recv()Marko Mäkelä2020-06-017-51/+7
| | | | | | | | | | | | | | | | Compare to trx_roll_crash_recv_trx directly where needed.
| | | * MDEV-21615 InnoDB: innodb_page_size=x requires... should be logged as errorMarko Mäkelä2020-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | innobase_init(): On every path to refused startup, log the reason to refuse startup as an error, instead of a note.
| | * | MDEV-22770 trx_undo_report_rename() fails to release page latchesMarko Mäkelä2020-06-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit f74023b955b5825fc3e957f644d5ee75c8171c98 (MDEV-15090) inadvertently removed a mtr_t::commit() call from trx_undo_report_rename(), causing an InnoDB hang if we failed to log a RENAME operation. It is unclear whether this condition is possible in practice. The test case involved SET GLOBAL innodb_trx_rseg_n_slots_debug=1 and a failed CREATE TABLE...SELECT, whose error handling would internally invoke RENAME in InnoDB.
| * | | MDEV-22773 Assertion page_get_page_no... in btr_pcur_store_position()Marko Mäkelä2020-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_pcur_store_position(): Replace a too strict debug assertion. It is possible to have a clustered index B-tree for a logically empty table, which will consist of a node pointer from the root page to a leaf page that contains the metadata record. The too strict debug assertion was added in commit 0e5a4ac2532c64a545796c787354dc41d61d0e62 (MDEV-15562).
* | | | MDEV-22027 Assertion oldest_lsn >= log_sys.last_checkpoint_lsn failedMarko Mäkelä2020-06-026-54/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | log_buf_pool_get_oldest_modification(): Acquire log_sys_t::flush_order_mutex in order to prevent a race condition that was introduced in commit 1a6f708ec594ac0ae2dd30db926ab07b100fa24b (MDEV-15058). Before that change, log_buf_pool_get_oldest_modification() was protected by both log_sys.mutex and log_sys.flush_order_mutex like it was supposed to be ever since commit a52c4820a30a69522c9876f06510662bf063bcc3 (MySQL 5.5.10). buf_pool_t::get_oldest_modification(): Replaces buf_pool_get_oldest_modification(), to emphasize that log_sys.flush_order_mutex must be acquired by the caller if needed. log_close(): Invoke log_buf_pool_get_oldest_modification() in order to ensure a clean shutdown. The scenario of the race condition is as follows: 1. The buffer pool is clean (no writes are pending). 2. mtr_add_dirtied_pages_to_flush_list() releases log_sys.mutex. 3. log_buf_pool_get_oldest_modification() observes that the buffer pool is clean and returns log_sys.lsn. 4. log_checkpoint() completes, writing a wrong checkpoint header according to which everything up to log_sys.lsn was clean. 5. mtr_add_dirtied_pages_to_flush_list() completes the execution of mtr_memo_note_modifications(), releases the page latches and the flush_order_mutex. 6. On a subsequent log_checkpoint(), the assertion could fail if the page modifications had not been flushed yet. The failing assertion (which is valid) was added in MySQL 5.7 mysql/mysql-server@5c6c6ec69336369487dfc080a6980089b4e1a3c2 and merged to MariaDB Server 10.2.2 in commit fec844aca88e1c6b9c36bb0b811e92d9d023ffb9.
* | | | MDEV-22641: Provide SIMD optimized wrapper for zlib crc32() (#1558)mysqlonarm2020-06-011-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Existing implementation used my_checksum (from mysys) for calculating table checksum and binlog checksum. This implementation was optimized for powerpc only and lacked SIMD implementation for x86 (using clmul) and ARM (using ACLE) instead used zlib-crc32. mariabackup had its own copy of the crc32 implementation using hardware optimized implementation only for x86 and lagged hardware based implementation for powerpc and ARM. Patch helps unifies all such calls and help aggregate all of them using an unified interface my_checksum(). Said unification also enables hardware optimized calls for all architecture viz. x86, ARM, POWERPC. Default always fallback to zlib crc32. Thanks to Daniel Black for reviewing, fixing and testing PowerPC changes. Thanks to Marko and Daniel for early code feedback.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-05-3110-75/+108
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-05-304-49/+36
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-05-274-49/+36
| | |\ \ | | | |/
| | | * intrusive::list fixesEugene Kosov2020-05-274-49/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namespace intrusive: removed split class into two: ilist<T> and sized_ilist<T> which has a size field. ilist<T> no more NULLify pointers to bring a slignly better performance. As a consequence, fil_space_t::is_in_unflushed_spaces and fil_space_t::is_in_rotation_list boolean members are needed now.
| * | | Merge branch 'codership-10.4-MDEV-22666-v2' into 10.4Julius Goryavsky2020-05-291-6/+5
| |\ \ \
| | * \ \ Merge branch '10.4-MDEV-22666-v2' of ↵Julius Goryavsky2020-05-261-6/+5
| | |\ \ \ | | | | | | | | | | | | | | | | | | https://github.com/codership/mariadb-server into codership-10.4-MDEV-22666-v2
| | | * | | MDEV-22666 galera.MW-328A hangsjaakola2020-05-251-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hang can happen between a lock connection issuing KILL CONNECTION for a victim, which is in committing phase. There happens two resource deadlockwhere killer is holding victim's LOCK_thd_data and requires trx mutex for the victim. The victim, otoh, holds his own trx mutex, but requires LOCK_thd_data in wsrep_commit_ordered(). Hence a classic two thread deadlock happens. The fix in this commit changes innodb commit so that wsrep_commit_ordered() is not called while holding trx mutex. With this, wsrep patch commit time mutex locking does not violate the locking protocol of KILL command (i.e. LOCK_thd_data -> trx mutex) Also, a new test case has been added in galera.galera_bf_kill.test for scenario where a client connection is killed in committting phase.
| * | | | | MDEV-22456 after-merge fix: Avoid functional change to rw_lock_s_unlock()Marko Mäkelä2020-05-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the merge 9e6e43551fc61bc34152f8d60f5d72f0d3814787 we replaced direct use of std::atomic with a wrapper class, so that dict_index_t::lock will support the default assignment operator. As part of that change, one occurrence of std::memory_order_release was accidentally replaced with std::memory_order_relaxed. Thanks to Sergey Vojtovich for noticing this.