summaryrefslogtreecommitdiff
path: root/storage
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-24671: Replace lock_wait_timeout_task with mysql_cond_timedwait()Marko Mäkelä2021-01-2725-1508/+582
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lock_wait(): Replaces lock_wait_suspend_thread(). Wait for the lock to be granted or the transaction to be killed using mysql_cond_timedwait() or mysql_cond_wait(). lock_wait_end(): Replaces que_thr_end_lock_wait() and lock_wait_release_thread_if_suspended(). lock_wait_timeout_task: Remove. The operating system kernel will resume the mysql_cond_timedwait() in lock_wait(). An added benefit is that innodb_lock_wait_timeout no longer has a 'jitter' of 1 second, which was caused by this wake-up task waking up only once per second, and then waking up any threads for which the timeout (which was only measured in seconds) was exceeded. innobase_kill_query(): Set trx->error_state=DB_INTERRUPTED, so that a call trx_is_interrupted(trx) in lock_wait() can be avoided. We will protect things more consistently with lock_sys.wait_mutex, which will be moved below lock_sys.mutex in the latching order. trx_lock_t::cond: Condition variable for !wait_lock, used with lock_sys.wait_mutex. srv_slot_t: Remove. Replaced by trx_lock_t::cond, lock_grant_after_reset(): Merged to to lock_grant(). lock_rec_get_index_name(): Remove. lock_sys_t: Introduce wait_pending, wait_count, wait_time, wait_time_max that are protected by wait_mutex. trx_lock_t::que_state: Remove. que_thr_state_t: Remove QUE_THR_COMMAND_WAIT, QUE_THR_LOCK_WAIT. que_thr_t: Remove is_active, start_running(), stop_no_error(). que_fork_t::n_active_thrs, trx_lock_t::n_active_thrs: Remove.
* Cleanups:Marko Mäkelä2021-01-2717-144/+49
| | | | | | | | que_thr_t::fork_type: Remove. QUE_THR_SUSPENDED, TRX_QUE_COMMITTING: Remove. Cleanup lock_cancel_waiting_and_release()
* Cleanup: Remove unused query node declarationsMarko Mäkelä2021-01-272-42/+1
|
* Cleanup the lock creationMarko Mäkelä2021-01-273-73/+34
| | | | | | | | | | | | | | LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK, LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, LOCK_RELEASE_INTERVAL: Replace with the bare use of the constants. lock_rec_create_low(): Remove LOCK_PAGE_BITMAP_MARGIN altogether. We already have REDZONE_SIZE as a 'safety margin' in AddressSanitizer builds, to catch any out-of-bounds access. lock_prdt_add_to_queue(): Avoid a useless search when enqueueing a waiting lock request. lock_prdt_lock(): Reduce the size of the trx->mutex critical section.
* Cleanup: Remove trx_get_id_for_print()Marko Mäkelä2021-01-276-67/+11
| | | | | | | | | Any transaction that has requested a lock must have trx->id!=0. trx_print_low(): Distinguish non-locking or inactive transaction objects by displaying the pointer in parentheses. fill_trx_row(): Do not try to map trx->id to a pointer-based value.
* MDEV-24685 - remove IO thread states output from SHOW ENGINE INNODB STATUSVladislav Vaintroub2021-01-273-60/+0
| | | | There are no IO threads anymore.
* MDEV-515 fixup: Cover dict_table_t::clear() during ADD INDEXMarko Mäkelä2021-01-251-3/+3
|
* MDEV-515 Reduce InnoDB undo logging for insert into empty tableMarko Mäkelä2021-01-2525-426/+802
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We implement an idea that was suggested by Michael 'Monty' Widenius in October 2017: When InnoDB is inserting into an empty table or partition, we can write a single undo log record TRX_UNDO_EMPTY, which will cause ROLLBACK to clear the table. For this to work, the insert into an empty table or partition must be covered by an exclusive table lock that will be held until the transaction has been committed or rolled back, or the INSERT operation has been rolled back (and the table is empty again), in lock_table_x_unlock(). Clustered index records that are covered by the TRX_UNDO_EMPTY record will carry DB_TRX_ID=0 and DB_ROLL_PTR=1<<55, and thus they cannot be distinguished from what MDEV-12288 leaves behind after purging the history of row-logged operations. Concurrent non-locking reads must be adjusted: If the read view was created before the INSERT into an empty table, then we must continue to imagine that the table is empty, and not try to read any records. If the read view was created after the INSERT was committed, then all records must be visible normally. To implement this, we introduce the field dict_table_t::bulk_trx_id. This special handling only applies to the very first INSERT statement of a transaction for the empty table or partition. If a subsequent statement in the transaction is modifying the initially empty table again, we must enable row-level undo logging, so that we will be able to roll back to the start of the statement in case of an error (such as duplicate key). INSERT IGNORE will continue to use row-level logging and locking, because implementing it would require the ability to roll back the latest row. Since the undo log that we write only allows us to roll back the entire statement, we cannot support INSERT IGNORE. We will introduce a handler::extra() parameter HA_EXTRA_IGNORE_INSERT to indicate to storage engines that INSERT IGNORE is being executed. In many test cases, we add an extra record to the table, so that during the 'interesting' part of the test, row-level locking and logging will be used. Replicas will continue to use row-level logging and locking until MDEV-24622 has been addressed. Likewise, this optimization will be disabled in Galera cluster until MDEV-24623 enables it. dict_table_t::bulk_trx_id: The latest active or committed transaction that initiated an insert into an empty table or partition. Protected by exclusive table lock and a clustered index leaf page latch. ins_node_t::bulk_insert: Whether bulk insert was initiated. trx_t::mod_tables: Use C++11 style accessors (emplace instead of insert). Unlike earlier, this collection will cover also temporary tables. trx_mod_table_time_t: Add start_bulk_insert(), end_bulk_insert(), is_bulk_insert(), was_bulk_insert(). trx_undo_report_row_operation(): Before accessing any undo log pages, invoke trx->mod_tables.emplace() in order to determine whether undo logging was disabled, or whether this is the first INSERT and we are supposed to write a TRX_UNDO_EMPTY record. row_ins_clust_index_entry_low(): If we are inserting into an empty clustered index leaf page, set the ins_node_t::bulk_insert flag for the subsequent trx_undo_report_row_operation() call. lock_rec_insert_check_and_lock(), lock_prdt_insert_check_and_lock(): Remove the redundant parameter 'flags' that can be checked in the caller. btr_cur_ins_lock_and_undo(): Simplify the logic. Correctly write DB_TRX_ID,DB_ROLL_PTR after invoking trx_undo_report_row_operation(). trx_mark_sql_stat_end(), ha_innobase::extra(HA_EXTRA_IGNORE_INSERT), ha_innobase::external_lock(): Invoke trx_t::end_bulk_insert() so that the next statement will not be covered by table-level undo logging. ReadView::changes_visible(trx_id_t) const: New accessor for the case where the trx_id_t is not read from a potentially corrupted index page but directly from the memory. In this case, we can skip a sanity check. row_sel(), row_sel_try_search_shortcut(), row_search_mvcc(): row_sel_try_search_shortcut_for_mysql(), row_merge_read_clustered_index(): Check dict_table_t::bulk_trx_id. row_sel_clust_sees(): Replaces lock_clust_rec_cons_read_sees(). lock_sec_rec_cons_read_sees(): Replaced with lower-level code. btr_root_page_init(): Refactored from btr_create(). dict_index_t::clear(), dict_table_t::clear(): Empty an index or table, for the ROLLBACK of an INSERT operation. ROW_T_EMPTY, ROW_OP_EMPTY: Note a concurrent ROLLBACK of an INSERT into an empty table. This is joint work with Thirunarayanan Balathandayuthapani, who created a working prototype. Thanks to Matthias Leich for extensive testing.
* MDEV-24642 Assertion r->emplace... failed in sux_lock::s_lock_register()Marko Mäkelä2021-01-253-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 03ca6495df31313c96e38834b9a235245e2ae2a8 (MDEV-24142) we replaced a debug data structure that holds information about S-latch holders with a std::set, which does not allow duplicates. The assertion failed in btr_search_guess_on_hash() in an s_lock_try() operation. The reason why recursive S-latch requests are not normally allowed is that if some other thread has enqueued a waiting X-lock, then further S-latch requests will block until the exclusive lock has been granted and released. If a thread were already holding one S-latch while waiting for the X-latch to be granted and released by another thread, the two threads would deadlock. However, the nonblocking s_lock_try() is perfectly fine; it will immediately return failure in case of conflict. sux_lock::readers: Use std::unordered_multiset instead of std::set. sux_lock::s_lock_register(): Allow 'duplicate' requests. Blocking-mode latch acquisitions are already covered by !have_s() assertions. sux_lock::s_unlock(): Erase only one element from readers. buf_page_try_get(): Revert to s_lock_try(). It had been previously changed to the more intrusive u_lock_try() in response to the debug check failing.
* Merge 10.5 into 10.6Marko Mäkelä2021-01-2513-73/+92
|\
| * Merge 10.4 into 10.5Marko Mäkelä2021-01-256-41/+51
| |\
| | * Merge 10.3 into 10.4Marko Mäkelä2021-01-256-40/+51
| | |\
| | | * MDEV-24653 Assertion block->page.id.page_no() == index->page failed in ↵Marko Mäkelä2021-01-252-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | innobase_add_instant_try() We may end up with an empty leaf page (containing only an ADD COLUMN metadata record) that is not the root page. innobase_add_instant_try(): Disable an optimization for a non-canonical empty table that contains a metadata record somewhere else than in the root page. btr_pcur_store_position(): Tolerate a non-canonical empty table.
| | | * MDEV-22351 InnoDB may recover wrong information after RESET MASTERbb-10.3-MDEV-22351Marko Mäkelä2021-01-222-29/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ever since commit 947efe17ed8188ca4feef6deb0c2831a246b5c8f InnoDB no longer writes binlog position in one place. It will not at all be written to the TRX_SYS page, and instead it will be written to the undo log header page that changes the transaction state. trx_rseg_mem_restore(): Recover the information from the latest written page.
| | | * MDEV-24593 Signal 11 when group by primary key of table joined to ↵Sergei Golubchik2021-01-222-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | information_schema.columns I_S tables were materialized too late, an attempt to use table statistics before the table was created caused a crash. Let's move table creation up. it only needs read_set to be calculated properly, this happens in JOIN::optimize_inner(), after semijoin transformation. Note that tables are not populated at that point, so most of the statistics would make no sense anyway. But at least field sizes will be correct. And it won't crash.
| | | * Merge 10.2 into 10.3Marko Mäkelä2021-01-191-0/+16
| | | |\
| | | | * MDEV-21478 Inplace ALTER fails to report error when FTS_DOC_IDThirunarayanan Balathandayuthapani2021-01-111-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with wrong data type is added Inplace alter fails to report error when fts_doc_id column with wrong data type is added. prepare_inplace_alter_table_dict(): Should check whether the column is fts_doc_id. It should be of bigint type, should accept non null data type and it should be in capital letters.
| | | * | MDEV-20502 Queries against spider tables return wrong values for columns ↵Kentoku SHIBA2021-01-122-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | following constant declarations. Add test cases.
| | | * | MDEV-20502 Queries against spider tables return wrong values for columns ↵Kentoku SHIBA2021-01-1210-4/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | following constant declarations. When executing a query like "select id, 0 as const, val from ...", there are 3 columns(items) in Query->select at handlerton->create_group_by(). After that, MariaDB makes a temporary table with 2 columns. The skipped items are const item, so fixing Spider to skip const items for items at Query->select.
| * | | | MDEV-24659 Assertion !fsp_is_system_temporary(bpage->id().space()) failed in ↵Marko Mäkelä2021-01-232-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buf_flush_relocate_on_flush_list() When commit 5eb539555b36a60944eefeb84d5d6d436ba61e63 (MDEV-12227) removed the pages of temporary tables from the buf_pool.flush_list, an adjustment to the buffer pool resizing was forgotten. buf_pool_t::realloc(): Do not invoke buf_flush_relocate_on_flush_list() for pages that belong to the temporary tablespace. Also, deduplicate some code at the end. buf_page_t::set_corrupt_id(): Tolerate oldest_modification()==1 (the dummy value) for temporary tablespace pages. The revised buf_pool_t::realloc() may invoke this on dirty temporary tablespace pages.
| * | | | MDEV-24638 Avoid repetitive FTS SYNC request for tableThirunarayanan Balathandayuthapani2021-01-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts_optimize_request_sync_table() can avoid the repetitive FTS SYNC request of the table if the table already has FTS_SYNC message in fts_optimize_wq queue. Reviewed-by: Marko Mäkelä
| * | | | MDEV-24652 mtr fails while reusing the cached undo log blockThirunarayanan Balathandayuthapani2021-01-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While reusing the cached undo log block, mtr expects the page write to change while writing the trx id. cached undo log block could contain bytes which were originally written for some other transaction. So InnoDB should make mtr to do MAYBE_NOP while reusing cached undo log block. Reviewed-by: Marko Mäkelä
| * | | | MDEV-24612: innodb hangs if it's initialization is broken before encryption ↵bb-10.5-MDEV-24612Vlad Lesin2021-01-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | threads are started Do not init encryption threads if shutdown is in progress.
| * | | | cmake warning, if/endif mismatchSergei Golubchik2021-01-171-1/+1
| | | | |
| * | | | MDEV-24600 performance_schema.events_transactions_history_long.trx_id ↵Marko Mäkelä2021-01-151-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reports garbage The table performance_schema.events_transactions_history_long that was imported from MySQL 5.7.28 in commit 0ea717f51a152afdb3791195c4a25ee0baa2faac may report bogus trx_id values for InnoDB transactions. innobase_register_trx(): Pass trx->id to trans_register_ha(), even if it is 0. It is more appropriate to report NULL than some arbitrary value that has been constructed from the address of a transaction identifier.
* | | | | MDEV-24637 fts_slots is being accessed after it gets freedThirunarayanan Balathandayuthapani2021-01-221-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts_optimize_callback() could be called after processing FTS_MSG_STOP due to timer initiated callback. This issue is caused by commit 38fd7b7d9170369b16ff553f01669182e70bc9b5 (MDEV-21452). In that case, fts_optimize_callback() should check whether it processed FTS_MSG_STOP already. Reviewed-by: Marko Mäkelä
* | | | | Fixup 92abdcca5a5324f0727112ab2417d10c7a8d5094Marko Mäkelä2021-01-141-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert an accidental update of ColumnStore. A different submodule is being used between MariaDB 10.5 and 10.6. The submodule was accidentally updated to the 10.5 version in the merge.
* | | | | MDEV-24569: Merge 10.5 into 10.6Marko Mäkelä2021-01-146-50/+74
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fseg_page_is_free(): Because MDEV-24167 changed fil_space_t::latch to a simple non-recursive rw-lock, we must avoid acquiring a shared latch if the current thread already holds an exclusive latch. This affects the test innodb.innodb_bug59733, which is exercising the change buffer. fil_space_t::is_owner(): Make available in non-debug builds.
| * | | | MDEV-24569: Change buffer merge modifies freed pageMarko Mäkelä2021-01-143-30/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with MDEV-15528, we will avoid writing freed pages back to data files. During stress testing, the assertion mach_read_from_4(frame + 4U) == block.page.id().page_no() failed in log_phys_t::apply(), because before the server was killed and restarted, change buffer merge was executed on a previously freed page. During recovery, the assertion would fail when InnoDB would apply a FREE_PAGE and a WRITE record to the page. ibuf_merge_or_delete_for_page(): Before applying any changes, check whether the secondary index leaf page has already been freed according to the allocation bitmap page. If it is freed, then we must reset the bits in change buffer bitmap page. ibuf_reset_bitmap(): Auxiliary function for repeated code. mtr_t::sx_lock_space(): Replaces mtr_t::x_lock_space(). Due to the lazy approach of the change buffer, The function ibuf_merge_or_delete_for_page() may be executed in buf_page_create() while the tablespace is already X-latched. An S-latch must not be acquired while the thread already holds an X-latch, but a redundant SX-latch is fine. The fix was developed by Thirunarayanan Balathandayuthapani.
* | | | | Merge 10.5 into 10.6Marko Mäkelä2021-01-145-13/+1
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-24536 innodb_idle_flush_pct has no effectMarko Mäkelä2021-01-133-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parameter innodb_idle_flush_pct that was introduced in MariaDB Server 10.1.2 by MDEV-6932 has no effect ever since the InnoDB changes from MySQL 5.7.9 were applied in commit 2e814d4702d71a04388386a9f591d14a35980bfe. Let us declare the parameter as MARIADB_REMOVED_OPTION. For earlier versions, commit ea9cd97f855fddf91f011434e8289ce5eba52528 declared the parameter deprecated.
| * | | | MDEV-24292 support semi-independent versioning for sub-packagesSergei Golubchik2021-01-122-0/+1
| | | | | | | | | | | | | | | | | | | | 4. update columnstore
* | | | | Merge 10.5 into 10.6Marko Mäkelä2021-01-1115-114/+124
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.4 into 10.5Marko Mäkelä2021-01-119-89/+110
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.3 into 10.4Marko Mäkelä2021-01-117-72/+67
| | |\ \ \ | | | |/ /
| | | * | Merge 10.2 into 10.3 (except MDEV-17556)Marko Mäkelä2021-01-115-26/+11
| | | |\ \ | | | | |/ | | | | | | | | | | | | | | | | | | | | The fix of MDEV-17556 (commit e25623e78a3efde05e30070dc7362f8dc0d8c459 and commit 61a362c9493df63dc588fcb71409537ae56ab9c8) has been omitted due to conflicts and will have to be applied separately later.
| | | | * MDEV-23536 : Race condition between KILL and transaction commitJan Lindström2021-01-083-31/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A race condition may occur between the execution of transaction commit, and an execution of a KILL statement that would attempt to abort that transaction. MDEV-17092 worked around this race condition by modifying InnoDB code. After that issue was closed, Sergey Vojtovich pointed out that this race condition would better be fixed above the storage engine layer: If you look carefully into the above, you can conclude that thd->free_connection() can be called concurrently with KILL/thd->awake(). Which is the bug. And it is partially fixed in THD::~THD(), that is destructor waits for KILL completion: Fix: Add necessary mutex operations to THD::free_connection() and move WSREP specific code also there. This ensures that no one is using THD while we do free_connection(). These mutexes will also ensures that there can't be concurrent KILL/THD::awake(). innobase_kill_query We can now remove usage of trx_sys_mutex introduced on MDEV-17092. trx_t::free() Poison trx->state and trx->mysql_thd This patch is validated with an RQG run similar to the one that reproduced MDEV-17092.
| | | | * Cleanup: Remove unused symbol QUE_THR_PROCEDURE_WAITMarko Mäkelä2021-01-082-4/+2
| | | | |
| | | | * fixup MDEV-17556: fix mroongaNikita Malyavin2021-01-083-19/+19
| | | | |
| | | | * MDEV-17556 Assertion `bitmap_is_set_all(&table->s->all_set)' failedNikita Malyavin2021-01-0820-147/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The assertion failed in handler::ha_reset upon SELECT under READ UNCOMMITTED from table with index on virtual column. This was the debug-only failure, though the problem is mush wider: * MY_BITMAP is a structure containing my_bitmap_map, the latter is a raw bitmap. * read_set, write_set and vcol_set of TABLE are the pointers to MY_BITMAP * The rest of MY_BITMAPs are stored in TABLE and TABLE_SHARE * The pointers to the stored MY_BITMAPs, like orig_read_set etc, and sometimes all_set and tmp_set, are assigned to the pointers. * Sometimes tmp_use_all_columns is used to substitute the raw bitmap directly with all_set.bitmap * Sometimes even bitmaps are directly modified, like in TABLE::update_virtual_field(): bitmap_clear_all(&tmp_set) is called. The last three bullets in the list, when used together (which is mostly always) make the program flow cumbersome and impossible to follow, notwithstanding the errors they cause, like this MDEV-17556, where tmp_set pointer was assigned to read_set, write_set and vcol_set, then its bitmap was substituted with all_set.bitmap by dbug_tmp_use_all_columns() call, and then bitmap_clear_all(&tmp_set) was applied to all this. To untangle this knot, the rule should be applied: * Never substitute bitmaps! This patch is about this. orig_*, all_set bitmaps are never substituted already. This patch changes the following function prototypes: * tmp_use_all_columns, dbug_tmp_use_all_columns to accept MY_BITMAP** and to return MY_BITMAP * instead of my_bitmap_map* * tmp_restore_column_map, dbug_tmp_restore_column_maps to accept MY_BITMAP* instead of my_bitmap_map* These functions now will substitute read_set/write_set/vcol_set directly, and won't touch underlying bitmaps.
| | | * | MDEV-23632 ALTER TABLE...ADD KEY creates corrupted index on virtual columnNikita Malyavin2021-01-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mysql_col_offset was not updated after the new column has been added by an INSTANT ALTER TABLE -- table data dictionary had been remaining the same. When the virtual column is added or removed, table was usually evicted and then reopened, which triggered vcol info rebuild on the next open. However this also should be done when the usual column is added or removed: mariadb always stores virtual field at the end of maria record, so the shift should always happen. Fix: expand the eviction condition to the case when usual fields are added/removed Note: this should happen only in the case of !new_clustered: * When new_clustered is true, a new data dictionary is created, and vcol metadata is rebuilt in `alter_rebuild_apply_log()` * We can't do it in `new_clustered` case, because the old table is not yet subctituted correctly
| | | * | ut_ad(err != DB_DUPLICATE_KEY) in row_rename_table_for_mysqlNikita Malyavin2021-01-051-0/+2
| | | | |
| | | * | handler0alter.cc: extract cache eviction and stats drop to functionsNikita Malyavin2021-01-051-42/+44
| | | | |
| | * | | MDEV-24512 Assertion failed in rec_is_metadata() in ↵Marko Mäkelä2021-01-021-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btr_discard_only_page_on_level() btr_discard_only_page_on_level(): Attempt to read the MDEV-15562 metadata record from the leaf page, not the root page. In the root, the leftmost (in this case, the only) node pointer would look like a metadata record. This corruption bug was introduced in commit 0e5a4ac2532c64a545796c787354dc41d61d0e62 (MDEV-15562). The scenario is rare: a column was dropped instantly or the order of columns was changed instantly, and then the table became empty in such a way that in the last step, the root page had one child page. Normally, a non-leaf B-tree page would always contain at least 2 children.
| | * | | Merge 10.3 into 10.4Marko Mäkelä2020-12-283-7/+31
| | |\ \ \ | | | |/ /
| | | * | Merge 10.2 into 10.3Marko Mäkelä2020-12-283-7/+31
| | | |\ \ | | | | |/
| | | | * MDEV-24449 Corruption of system tablespace or last recovered pageMarko Mäkelä2020-12-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to 10.5 commit 39378e1366f78b38c05e45103b9fb9c829cc5f4f. With a patched version of the test innodb.ibuf_not_empty (so that it would trigger crash recovery after using the change buffer), and patched code that would modify the os_thread_sleep() in recv_apply_hashed_log_recs() to be 1ms as well as add a sleep of the same duration to the end of recv_recover_page() when recv_sys->n_addrs=0, we can demonstrate a race condition. After disabling some debug checks in buf_all_freed_instance(), buf_pool_invalidate_instance() and buf_validate(), we managed to trigger an assertion failure in fseg_free_step(), on the XDES_FREE_BIT. In other words, an trx_undo_seg_free() call during trx_rollback_resurrected() was attempting a double-free of a page. This was repeated about once in 400 to 500 test runs. With the fix applied, the test passed 2,000 runs. recv_apply_hashed_log_recs(): Do not only wait for recv_sys->n_addrs to reach 0, but also wait for buf_get_n_pending_read_ios() to reach 0, to guarantee that buf_page_io_complete() will not be executing ibuf_merge_or_delete_for_page().
| | | | * MDEV-23851 MDEV-24229 BF-BF conflict issuessjaakola2020-12-282-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issues MDEV-23851 and MDEV-24229 are probably duplicates and are caused by the new self-asserting function lock0lock.cc:wsrep_assert_no_bf_bf_wait(). The criteria for asserting is too strict and does not take in consideration scenarios of "false positive" lock conflicts, which are resolved by replaying the local transaction. As a fix, this PR is relaxing the assert criteria by two conditions, which skip assert if high priority transactions are locking in correct order or if conflicting high priority lock holder is aborting and has just not yet released the lock. Alternative fix would be to remove wsrep_assert_no_bf_bf_wait() altogether, or remove the assert in this function and let it only print warnings in error log. But in my high conflict rate multi-master test scenario, this relaxed asserting appears to be safe. This PR also removes two wsrep_report_bf_lock_wait() calls in innodb lock manager, which cause mutex access assert in debug builds. Foreign key appending missed handling of data types of float and double in INSERT execution. This is not directly related to the actual issue here but is fixed in this PR nevertheless. Missing these foreign keys values in certification could cause problems in some multi-master load scenarios. Finally, some problem reports suggest that some of the issues reported in MDEV-23851 might relate to false positive lock conflicts over unique secondary index gaps. There is separate work for relaxing UK index gap locking of replication appliers, and separate PR will be submitted for it, with a related mtr test as well.
| * | | | MDEV-24556: Build does not recognize powerpc64 (OpenBSD)Brad Smith2021-01-111-2/+2
| | | | | | | | | | | | | | | | | | | | Reviewer: Daniel Black
| * | | | MDEV-24544 innodb_buffer_pool_wait_free is not protected by mutexMarko Mäkelä2021-01-076-25/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | buf_LRU_get_free_block(): Increment the counter after acquiring buf_pool.mutex. buf_pool.stat.LRU_waits: Replaces export_vars.innodb_buffer_pool_wait_free and srv_stats.buf_pool_wait_free. Reads of the counter will remain dirty, not acquiring the mutex.