summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0mysql.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.3 into 10.4Marko Mäkelä2021-01-111-0/+2
|\
| * ut_ad(err != DB_DUPLICATE_KEY) in row_rename_table_for_mysqlNikita Malyavin2021-01-051-0/+2
| |
* | Merge 10.3 into 10.4Marko Mäkelä2020-12-231-7/+57
|\ \ | |/
| * MDEV-23644 Assertion on evaluating foreign referential action for ↵Aleksey Midenkov2020-12-221-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | self-reference in system versioned table First part of the fix (row0mysql.cc) addresses external columns when adding history row on referential action. The full data must be retrieved before the row is inserted. Second part of the fix (the rest) avoids duplicate primary key error between the history row generated on referential action and the history row generated by SQL command. Both command and referential action can happen on same table since foreign key can be self-reference (parent and child tables are same). Moreover, the self-reference can refer multiple rows when the key is non-unique. In such case history is generated by referential action occured on first row but processed all rows by a matched key. The second round is when the next row is processed by a command but history already exists. In such case we check TRX_ID of existing history row and if it is the same we assume the above situation and skip adding one more history row or failing the command.
| * MDEV-21138 Assertion `col->ord_part' or `f.col->ord_part' failed in ↵Aleksey Midenkov2020-12-221-7/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | row_build_index_entry_low First part (row0mysql.cc) fixes ins_node_set_new_row() usage workflow as it is designed to operate on empty row (see row_get_prebuilt_insert_row() for example). Second part (row0ins.cc) fixes duplicate key error in FTS_DOC_ID_INDEX since history rows must not generate entries in that index. We detect FTS_DOC_ID_INDEX by a number of attributes and skip it if the row is historical. Misc fixes: row_build_index_entry_low() does not accept non-NULL tuple for FTS index (subject assertion fails), assertion (index->type != DICT_FTS) adds code understanding. Now as historical_row is copied in row_update_vers_insert() there is no need to copy the row twice: ROW_COPY_POINTERS is used to build historical_row initially. dbug_print_rec() debug functions.
* | Merge 10.3 into 10.4Marko Mäkelä2020-10-291-4/+3
|\ \ | |/
| * Merge 10.2 into 10.3Marko Mäkelä2020-10-281-3/+3
| |\
| | * MDEV-23991 dict_table_stats_lock() has unnecessarily long scopeEugene Kosov2020-10-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch removes dict_index_t::stats_latch. Table/index statistics now protected with dict_sys->mutex. That way statistics computation can happen in parallel in several threads and dict_sys->mutex will be locked only for a short period of time. This patch is a joint work with Marko Mäkelä dict_index_t::lock: make mutable which allows to pass const pointer when only lock is touched in an object btr_height_get() btr_get_size(): make index argument const for better type safety btr_estimate_number_of_different_key_vals(): now returns computed values instead of setting fields in dict_index_t directly remove everything related to dict_index_t::stats_latch dict_stats_index_set_n_diff(): now returns computed values instead of setting fields in dict_index_t directly dict_stats_analyze_index(): now returns computed values instead of setting fields in dict_index_t directly Reviewed by: Marko Mäkelä
* | | Merge 10.3 into 10.4Marko Mäkelä2020-09-211-3/+15
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-09-211-3/+15
| |\ \ | | |/
| | * MDEV-18867 Long Time to Stop and StartThirunarayanan Balathandayuthapani2020-09-101-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts_drop_orphaned_tables() takes long time to remove the orphaned FTS tables. In order to reduce the time, do the following: - Traverse fil_system.space_list and construct a set of table_id,index_id of all FTS_*.ibd tablespaces. - Traverse the sys_indexes table and ignore the entry from the above collection if it exist. - Existing elements in the collection can be considered as orphaned fts tables. construct the table name from (table_id,index_id) and invoke fts_drop_tables(). - Removed DICT_TF2_FTS_AUX_HEX_NAME flag usage from upgrade. - is_aux_table() in dict_table_t to check whether the given name is fts auxiliary table fts_space_set_t is a structure to store set of parent table id and index id - Remove unused FTS function in fts0fts.cc - Remove the fulltext index in row_format_redundant test case. Because it deals with the condition that SYS_TABLES does have corrupted entry and valid entry exist in SYS_INDEXES.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-08-211-3/+3
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-08-211-3/+3
| |\ \ | | |/
* | | Merge 10.3 into 10.4Marko Mäkelä2020-08-201-2/+10
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-08-201-2/+10
| |\ \ | | |/
| | * MDEV-23475 InnoDB performance regression for write-heavy workloadsMarko Mäkelä2020-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit fe39d02f51b96536dccca7ff89faf05e13548877 (MDEV-20638) we removed some wake-up signaling of the master thread that should have been there, to ensure a steady log checkpointing workload. Common sense suggests that the commit omitted some necessary calls to srv_inc_activity_count(). But, an attempt to add the call to trx_flush_log_if_needed_low() as well as to reinstate the function innobase_active_small() did not restore the performance for the case where sync_binlog=1 is set. Therefore, we will revert the entire commit in MariaDB Server 10.2. In MariaDB Server 10.5, adding a srv_inc_activity_count() call to trx_flush_log_if_needed_low() did restore the performance, so we will not revert MDEV-20638 across all versions.
| | * MDEV-22934 Table disappear after two alter table commandThirunarayanan Balathandayuthapani2020-08-181-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======= InnoDB drops the column which has foreign key relations on it. So it tries to load the foreign key during rename process of copy algorithm even though the foreign_key_check is disabled. Solution: ======== During alter copy algorithm, InnoDB ignores the error while loading the foreign key constraint if foreign key check is disabled. It should throw the warning about failure of the foreign key constraint when foreign key check is disabled.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-07-311-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-07-311-1/+1
| |\ \ | | |/
| | * MDEV-20638 Remove the deadcode from srv_master_thread() and ↵Thirunarayanan Balathandayuthapani2020-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | srv_active_wake_master_thread_low() - Due to commit fe95cb2e40d73adbbe88efa0e7f48c055ccd042f (MDEV-16125), InnoDB master thread does not need to call srv_resume_thread() and therefore there is no need to wake up the thread. Due to the above patch, InnoDB should remove the following dead code. srv_check_activity(): Makes the parameter as in,out and returns the recent activity value innobase_active_small(): Removed srv_active_wake_master_thread(): Removed srv_wake_master_thread(): Removed srv_active_wake_master_thread_low(): Removed Simplify srv_master_thread() and remove switch cases, added the assert. Replace srv_wake_master_thread() with srv_inc_activity_count() INNOBASE_WAKE_INTERVAL: Removed
* | | Merge 10.3 into 10.4Marko Mäkelä2020-07-211-48/+10
|\ \ \ | |/ /
| * | MDEV-20661 Virtual fields are not recalculated on system fields value assignmentAleksey Midenkov2020-07-201-40/+2
| | | | | | | | | | | | | | | | | | | | | Fix stale virtual field value in 4 cases: when virtual field depends on row_start/row_end in timestamp/trx_id versioned table. row_start dep is recalculated in vers_update_fields() (SQL and InnoDB layer). row_end dep is recalculated on history row insert.
| * | MDEV-22061 InnoDB: Assertion of missing row in sec index row_start upon ↵Aleksey Midenkov2020-07-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REPLACE on a system-versioned table make_versioned_helper() appended new update field unconditionally while it should check if this field already exists in update vector. Misc renames to conform versioning prefix. vers_update_fields() name conforms with sql layer TABLE::vers_update_fields().
* | | Merge 10.3 into 10.4Marko Mäkelä2020-07-021-3/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-07-021-3/+1
| |\ \ | | |/
| | * MDEV-20377: Make WITH_MSAN more usableMarko Mäkelä2020-07-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MemorySanitizer (clang -fsanitize=memory) requires that all code be compiled with instrumentation enabled. The only exception is the C runtime library. Failure to use instrumented libraries will cause bogus messages about memory being uninitialized. In WITH_MSAN builds, we must avoid calling getservbyname(), because even though it is a standard library function, it is not instrumented, not even in clang 10. Note: Before MariaDB Server 10.5, ./mtr will typically fail due to the old PCRE library, which was updated in MDEV-14024. The following cmake options were tested on 10.5 in commit 94d0bb4dbeb28a94d1f87fdd55f4297ff3df0157: cmake \ -DCMAKE_C_FLAGS='-march=native -O2' \ -DCMAKE_CXX_FLAGS='-stdlib=libc++ -march=native -O2' \ -DWITH_EMBEDDED_SERVER=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_TYPE=Debug \ -DWITH_INNODB_{BZIP2,LZ4,LZMA,LZO,SNAPPY}=OFF \ -DPLUGIN_{ARCHIVE,TOKUDB,MROONGA,OQGRAPH,ROCKSDB,CONNECT,SPIDER}=NO \ -DWITH_SAFEMALLOC=OFF \ -DWITH_{ZLIB,SSL,PCRE}=bundled \ -DHAVE_LIBAIO_H=0 \ -DWITH_MSAN=ON MEM_MAKE_DEFINED(): An alias for VALGRIND_MAKE_MEM_DEFINED() and __msan_unpoison(). MEM_GET_VBITS(), MEM_SET_VBITS(): Aliases for VALGRIND_GET_VBITS(), VALGRIND_SET_VBITS(), __msan_copy_shadow(). InnoDB: Replace the UNIV_MEM_ macros with corresponding MEM_ macros. ut_crc32_8_hw(), ut_crc32_64_low_hw(): Use the compiler built-in functions instead of inline assembler when building WITH_MSAN. This will require at least -msse4.2 when building for IA-32 or AMD64. The inline assembler would not be instrumented, and would thus cause bogus failures.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-06-051-29/+49
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-06-051-29/+49
| |\ \ | | |/
| | * MDEV-22769 Shutdown hang or crash due to XA breaking locksMarko Mäkelä2020-06-051-23/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-22721 Remove bloat caused by InnoDB logger classMarko Mäkelä2020-06-041-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-05-161-29/+3
|\ \ \ | |/ / | | | | | | | | | We will expose some more std::atomic internals in Atomic_counter, so that dict_index_t::lock will support the default assignment operator.
| * | Merge 10.2 into 10.3Marko Mäkelä2020-05-151-29/+3
| |\ \ | | |/
| | * MDEV-22456 Dropping the adaptive hash index may cause DDL to lock up InnoDBMarko Mäkelä2020-05-151-29/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the InnoDB buffer pool contains many pages for a table or index that is being dropped or rebuilt, and if many of such pages are pointed to by the adaptive hash index, dropping the adaptive hash index may consume a lot of time. The time-consuming operation of dropping the adaptive hash index entries is being executed while the InnoDB data dictionary cache dict_sys is exclusively locked. It is not actually necessary to drop all adaptive hash index entries at the time a table or index is being dropped or rebuilt. We can let the LRU replacement policy of the buffer pool take care of this gradually. For this to work, we must detach the dict_table_t and dict_index_t objects from the main dict_sys cache, and once the last adaptive hash index entry for the detached table is removed (when the garbage page is evicted from the buffer pool) we can free the dict_table_t and dict_index_t object. Related to this, in MDEV-16283, we made ALTER TABLE...DISCARD TABLESPACE skip both the buffer pool eviction and the drop of the adaptive hash index. We shifted the burden to ALTER TABLE...IMPORT TABLESPACE or DROP TABLE. We can remove the eviction from DROP TABLE. We must retain the eviction in the ALTER TABLE...IMPORT TABLESPACE code path, so that in case the discarded table is being re-imported with the same tablespace identifier, the fresh data from the imported tablespace will replace any stale pages in the buffer pool. rpl.rpl_failed_drop_tbl_binlog: Remove the test. DROP TABLE can no longer be interrupted inside InnoDB. fseg_free_page(), fseg_free_step(), fseg_free_step_not_header(), fseg_free_page_low(), fseg_free_extent(): Remove the parameter that specifies whether the adaptive hash index should be dropped. btr_search_lazy_free(): Lazily free an index when the last reference to it is dropped from the adaptive hash index. buf_pool_clear_hash_index(): Declare static, and move to the same compilation unit with the bulk of the adaptive hash index code. dict_index_t::clone(), dict_index_t::clone_if_needed(): Clone an index that is being rebuilt while adaptive hash index entries exist. The original index will be inserted into dict_table_t::freed_indexes and dict_index_t::set_freed() will be called. dict_index_t::set_freed(), dict_index_t::freed(): Note that or check whether the index has been freed. We will use the impossible page number 1 to denote this condition. dict_index_t::n_ahi_pages(): Replaces btr_search_info_get_ref_count(). dict_index_t::detach_columns(): Move the assignment n_fields=0 to ha_innobase_inplace_ctx::clear_added_indexes(). We must have access to the columns when freeing the adaptive hash index. Note: dict_table_t::v_cols[] will remain valid. If virtual columns are dropped or added, the table definition will be reloaded in ha_innobase::commit_inplace_alter_table(). buf_page_mtr_lock(): Drop a stale adaptive hash index if needed. We will also reduce the number of btr_get_search_latch() calls and enclose some more code inside #ifdef BTR_CUR_HASH_ADAPT in order to benefit cmake -DWITH_INNODB_AHI=OFF.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-05-051-5/+5
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-05-041-5/+5
| |\ \ | | |/
| | * MDEV-21595: innodb offset_t rename to rec_offsDaniel Black2020-04-291-5/+5
| | | | | | | | | | | | | | | | | | thanks to: perl -i -pe 's/\boffset_t\b/rec_offs/g' $(git grep -lw offset_t storage/innobase)
* | | Merge 10.3 into 10.4Marko Mäkelä2020-04-271-6/+5
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-04-271-5/+4
| |\ \ | | |/
| | * MDEV-7962: Follow-up fix for 10.2Marko Mäkelä2020-04-271-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | dict_stats_update_if_needed(): Replace the parameter THD* with const trx_t& so that trx_t::is_wsrep() can be invoked instead of the more expensive wsrep_on(). Replace also other occurrences of wsrep_on() with trx_t::is_wsrep().
| * | Merge 10.2 into 10.3Marko Mäkelä2020-04-271-1/+1
| |\ \ | | |/
| | * MDEV-22358 Assertion srv_undo_sources || ... in row_prebuilt_free()Marko Mäkelä2020-04-231-1/+1
| | | | | | | | | | | | | | | | | | row_prebuilt_free(): Do not attempt to drop orphan indexes that might have been left behind by a failed ADD UNIQUE INDEX. This avoids the execution of unwanted transactions during shutdown.
* | | Merge 10.3 into 10.4Marko Mäkelä2020-03-301-1/+1
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-03-301-1/+1
| |\ \ | | |/
| | * InnoDB: reduce size of dtuple_tEugene Kosov2020-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making a linked list of dtuple_t is needed only for inserting records. It's better to store tuples in a non-intrusive container to not affect all other use cases of dtuple_t dtuple_t::tuple_list: removed, it was 2 * sizeof(void*) bytes ins_node_t::entry_list: now it's std::vector<dtuple_t*> ins_node_t::entry: now it's std::vector<dtuple_t*>::iterator DBUG_EXECUTE_IF("row_ins_skip_sec": this dead code removed
* | | Merge 10.3 into 10.4Marko Mäkelä2020-03-201-6/+7
|\ \ \ | |/ /
| * | Merge 10.2 into 10.3Marko Mäkelä2020-03-201-6/+7
| |\ \ | | |/ | | | | | | Also, clean up the test innodb_gis.geometry a little further.
| | * MDEV-21983: Crash on DROP/RENAME TABLE after DISCARD TABLESPACEMarko Mäkelä2020-03-191-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fil_delete_tablespace(): Remove the unused parameter drop_ahi, and add the parameter if_exists=false. We want to suppress error messages if we know that the tablespace has been discarded. dict_table_rename_in_cache(): Pass the new parameter to fil_delete_tablespace(), that is, do not complain about missing tablespace if the tablespace has been discarded. row_make_new_pathname(): Declare as static. row_drop_table_for_mysql(): Tolerate !table->data_dir_path when the tablespace has been discarded. row_rename_table_for_mysql(): Skip part of the RENAME TABLE when fil_space_get_first_path() returns NULL.
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2020-02-111-1/+20
|\ \ \ | |/ /
| * | Merge branch '10.2' into 10.3Oleksandr Byelkin2020-02-101-1/+15
| |\ \ | | |/
| | * Merge branch '10.1' into 10.2Oleksandr Byelkin2020-02-101-1/+15
| | |\