- 23 Nov, 2018 2 commits
-
-
Marko Mäkelä authored
-
Marko Mäkelä authored
Several race conditions between MDEV-15562 instant ALTER TABLE and purge were observed. The most obvious race condition resulted in a reported assertion failure in dict_index_t::instant_add_field(): instant.n_core_fields == n_core_fields would not hold if the table was emptied by purge after the time dict_table_t::prepare_instant() was called. During purge, it can turn out that the table is logically empty, only containing a metadata record. If the metadata record is of the type created by MDEV-11369 instant ADD COLUMN, it can be removed and dict_index_t::clear_instant_add() can be called. This will convert the table to the canonical non-instant format. (If the metadata record is of the MDEV-15562 type, then it can only be deleted if the table becomes empty as the result of rollback of an instant ALTER TABLE operation.) row_purge_remove_clust_if_poss_low(): Add a debug check that ensures that purge can never remove a MDEV-15562 metadata record. ha_innobase::open(): Add a comment about the necessity of rolling back any recovered instant ALTER TABLE transaction on the table. instant_metadata_lock(): An auxiliary function to acquire a page latch on the metadata record, to prevent race conditions. dict_table_t::prepare_instant(), dict_index_t::instant_add_field(), dict_table_t::rollback_instant(), innobase_instant_try(): Invoke instant_metadata_lock() in order to prevent race conditions. dict_index_t::instant_add_field(): Correct debug assertions. The == was guaranteed by code in dict_table_t::prepare_instant() that was introduced in MDEV-15562. Due to the race condition, we could occasionally have <=, but never >= like the code was after MDEV-11369. ha_innobase_inplace_ctx::instant_column(): Wrapper for dict_table_t::instant_column(). Add debug assertions.
-
- 22 Nov, 2018 5 commits
-
-
Marko Mäkelä authored
-
Marko Mäkelä authored
InnoDB in MySQL 5.7 introduced two new parameters to the function dict_hdr_get_new_id(), to allow redo logging to be disabled when assigning identifiers to temporary tables or during the backup-unfriendly TRUNCATE TABLE that was replaced in MariaDB by MDEV-13564. Now that MariaDB 10.4.0 removed the crash recovery code for the backup-unfriendly TRUNCATE, we can revert dict_hdr_get_new_id() to be used only for persistent data structures. dict_table_assign_new_id(): Remove. This was a simple 2-line function that was called from few places. dict_table_open_on_id_low(): Declare in the only file where it is called. dict_sys_t::temp_id_hash: A separate lookup table for temporary tables. Table names will be in the common dict_sys_t::table_hash. dict_sys_t::get_temporary_table_id(): Assign a temporary table ID. dict_sys_t::get_table(): Look up a persistent table. dict_sys_t::get_temporary_table(): Look up a temporary table. dict_sys_t::temp_table_id: The sequence of temporary table identifiers. Starts from DICT_HDR_FIRST_ID, so that we can continue to simply compare dict_table_t::id to a few constants for the persistent hard-coded data dictionary tables. undo_node_t::state: Distinguish temporary and persistent tables. lock_check_dict_lock(), lock_get_table_id(): Assert that there cannot be locks on temporary tables. row_rec_to_index_entry_impl(): Assert that there cannot be metadata records on temporary tables. row_undo_ins_parse_undo_rec(): Distinguish temporary and persistent tables. Move some assertions from the only caller. Return whether the table was found. row_undo_ins(): Add some assertions. row_undo_mod_clust(), row_undo_mod(): Do not assign node->state. Let row_undo() do that. row_undo_mod_parse_undo_rec(): Distinguish temporary and persistent tables. Move some assertions from the only caller. Return whether the table was found. row_undo_try_truncate(): Renamed and simplified from trx_roll_try_truncate(). row_undo_rec_get(): Replaces trx_roll_pop_top_rec_of_trx() and trx_roll_pop_top_rec(). Fetch an undo log record, and assign undo->state accordingly. trx_undo_truncate_end(): Acquire the rseg->mutex only for the minimum required duration, and release it between mini-transactions.
-
Marko Mäkelä authored
-
Alexander Barkov authored
-
Marko Mäkelä authored
There was a race condition between ALTER TABLE and purge. If a table turns out to be logically empty when instant ALTER TABLE is executing, we will convert the table to the canonical format, to avoid overhead during subsequent accesses, and to allow the data file to be imported into older versions of MariaDB. It could happen that at the time the table is logically empty, there still exists an undo log record for updating the hidden metadata record for an earlier instant ALTER TABLE operation. If the table was converted to the canonical format before purge processes this undo log record, the undo log record could be referring to index fields that no longer exist, causing a crash. To prevent the race condition, we must delete the old undo log records. We do this lazily by assigning a new table ID, so that the table lookup for the old undo log records will fail. dict_table_t::reassign_id(): Reassign the table_id to effectively lazily delete old undo log records. innobase_instant_try(): Invoke index->table->reassign_id() before index->clear_instant_alter().
-
- 21 Nov, 2018 5 commits
-
-
Monty authored
-
Marko Mäkelä authored
dict_index_t::clear_instant_alter(): Remove a loop that became redundant in commit ae2004c6 and caused corruption of n_nullable when dropping the last column which was not declared NOT NULL.
-
Marko Mäkelä authored
-
Marko Mäkelä authored
dict_index_t::clear_instant_alter(): Correctly move all fields corresponding to instantly dropped columns to the end of the array. This fixes a regression that was introduced in commit 5aaee374.
-
Alexander Barkov authored
commit 21a58840
-
- 20 Nov, 2018 11 commits
-
-
Oleksandr Byelkin authored
-
Sergei Golubchik authored
If the engine wants to avoid rnd_pos() - force a temporary table before a filesort. But don't do it if addon_fields are used.
-
Sergei Golubchik authored
-
Sergei Golubchik authored
-
Sergei Golubchik authored
We don't have many bits left, no need to add another InnoDB-specific flag. Instead, we say that HA_REQUIRE_PRIMARY_KEY does not apply to SEQUENCE. Meaning, if the engine declares HA_CAN_TABLES_WITHOUT_ROLLBACK (required for SEQUENCE) it *must* support tables without a primary key.
-
Daniel Bartholomew authored
-
Marko Mäkelä authored
-
Marko Mäkelä authored
-
Marko Mäkelä authored
recv_addr_trim(): Do not try to detach the hash bucket, because the code for doing that does not always work. recv_apply_hashed_log_recs(): Do not attempt to read pages for which there exist no redo log records.
-
Marko Mäkelä authored
dict_index_t::clear_instant_alter(): Correctly sort the index fields to correspond to the columns of the table.
-
Alexander Barkov authored
-
- 19 Nov, 2018 8 commits
-
-
Elena Stepanova authored
Skip tests which expectedly fail when Aria is not used for temporary tables
-
Marko Mäkelä authored
-
Marko Mäkelä authored
-
Marko Mäkelä authored
Commit ff88e4bb broke the Windows build. Clean up one more redundant #include to fix it.
-
Marko Mäkelä authored
-
Marko Mäkelä authored
lock_discard_page(): Traverse and discard the B-tree record locks only if they exist. Else, discard the R-tree (spatial) index locks.
-
Marko Mäkelä authored
Compare against the correct constant 0. NOT_KILLED belongs to enum killed_state, while THD_IS_NOT_KILLED is what we want.
-
Alexander Barkov authored
modified: sql_yacc.yy modified: sql_yacc_ora.yy
-
- 18 Nov, 2018 2 commits
-
-
Marko Mäkelä authored
ib_counter_t::ib_counter_element_t: Avoid sizeof on a std::atomic type, because it causes errors on some version of the Microsoft compiler.
-
Marko Mäkelä authored
Remove some redundant declarations of global variables. These declarations can refer to undefined type names, because they occur before any #include statement for the type definitions. On GNU/Linux, uint and ulong seem to be defined in <sys/types.h> due to _DEFAULT_SOURCE and __USE_MISC becoming defined in <features.h>.
-
- 17 Nov, 2018 1 commit
-
-
Alexander Barkov authored
-
- 16 Nov, 2018 6 commits
-
-
Marko Mäkelä authored
dict_index_t::db_trx_id(): Return the position of DB_TRX_ID. Only valid for the clustered index. dict_index_t::db_roll_ptr(): Return the position of DB_ROLL_PTR. Only valid for the clustered index. dict_index_get_sys_col_pos(): Remove. This was performing unnecessarily complex computations, which only made sense for DB_ROW_ID, which would exist either as the first field in the clustered index or as the last field in a secondary index (only when a DB_ROW_ID column is materialised). row_sel_store_row_id_to_prebuilt(): Remove, and replace with simpler code. row_upd_index_entry_sys_field(): Remove. btr_cur_log_sys(): Replaces row_upd_write_sys_vals_to_log(). btr_cur_write_sys(): Write DB_TRX_ID,DB_ROLL_PTR to a data tuple.
-
Marko Mäkelä authored
row_import_set_sys_max_row_id(): Change the return type to void, and access the first column (DB_ROW_ID) directly.
-
Marko Mäkelä authored
fts_get_max_doc_id(): Remove totally unnecessary call to rec_get_offsets(). In FTS_DOC_ID_INDEX, the FTS_DOC_ID is always stored in the first 8 bytes of the record. fts_get_doc_id_from_row(): Get the offsets from the caller. row_ins_foreign_check_on_constraint(): Invoke rec_get_offsets() for the call.
-
Marko Mäkelä authored
-
Elena Stepanova authored
-
Monty authored
This caused ma_test_recovery.pl to fail Other things: - Fixed bug where "ma_test_recovert.pl --abort-on-error" didn't abort on error
-