summaryrefslogtreecommitdiff
path: root/storage/innobase/fts
Commit message (Collapse)AuthorAgeFilesLines
* MDEV-25919 preparation: Remove trx_t::internalMarko Mäkelä2021-07-011-10/+10
| | | | | | | With commit 1bd681c8b3c5213ce1f7976940a7dc38b48a0d39 (MDEV-25506) it no longer is necessary to run DDL and DML operations in separate transactions. Let us remove the flag trx_t::internal. Dictionary transactions will be distinguished by trx_t::dict_operation.
* MDEV-25936 Crash during DDL that involves FULLTEXT INDEXMarko Mäkelä2021-06-161-0/+4
| | | | | | | | | | | | | | | | In commit 1bd681c8b3c5213ce1f7976940a7dc38b48a0d39 we introduced a work-around for the missing MDL protection when the internal tables of FULLTEXT INDEX are dropped during DDL operations. That work-around suffered from a race condition. A purge thread could have narrowly passed purge_sys.check_stop_FTS() and then (while holding dict_sys.mutex) acquire a table reference right after fts_lock_table() determined that no references were being held. fts_lock_table(): Protect the reference check with dict_sys.mutex. Thanks to Thirunarayanan Balathandayuthapani for repeating the failure and testing the fix.
* MDEV-25506 (3 of 3): Do not delete .ibd files before commitMarko Mäkelä2021-06-091-92/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a complete rewrite of DROP TABLE, also as part of other DDL, such as ALTER TABLE, CREATE TABLE...SELECT, TRUNCATE TABLE. The background DROP TABLE queue hack is removed. If a transaction needs to drop and create a table by the same name (like TRUNCATE TABLE does), it must first rename the table to an internal #sql-ib name. No committed version of the data dictionary will include any #sql-ib tables, because whenever a transaction renames a table to a #sql-ib name, it will also drop that table. Either the rename will be rolled back, or the drop will be committed. Data files will be unlinked after the transaction has been committed and a FILE_RENAME record has been durably written. The file will actually be deleted when the detached file handle returned by fil_delete_tablespace() will be closed, after the latches have been released. It is possible that a purge of the delete of the SYS_INDEXES record for the clustered index will execute fil_delete_tablespace() concurrently with the DDL transaction. In that case, the thread that arrives later will wait for the other thread to finish. HTON_TRUNCATE_REQUIRES_EXCLUSIVE_USE: A new handler flag. ha_innobase::truncate() now requires that all other references to the table be released in advance. This was implemented by Monty. ha_innobase::delete_table(): If CREATE TABLE..SELECT is detected, we will "hijack" the current transaction, drop the table in the current transaction and commit the current transaction. This essentially fixes MDEV-21602. There is a FIXME comment about making the check less failure-prone. ha_innobase::truncate(), ha_innobase::delete_table(): Implement a fast path for temporary tables. We will no longer allow temporary tables to use the adaptive hash index. dict_table_t::mdl_name: The original table name for the purpose of acquiring MDL in purge, to prevent a race condition between a DDL transaction that is dropping a table, and purge processing undo log records of DML that had executed before the DDL operation. For #sql-backup- tables during ALTER TABLE...ALGORITHM=COPY, the dict_table_t::mdl_name will differ from dict_table_t::name. dict_table_t::parse_name(): Use mdl_name instead of name. dict_table_rename_in_cache(): Update mdl_name. For the internal FTS_ tables of FULLTEXT INDEX, purge would acquire MDL on the FTS_ table name, but not on the main table, and therefore it would be able to run concurrently with a DDL transaction that is dropping the table. Previously, the DROP TABLE queue hack prevented a race between purge and DDL. For now, we introduce purge_sys.stop_FTS() to prevent purge from opening any table, while a DDL transaction that may drop FTS_ tables is in progress. The function fts_lock_table(), which will be invoked before the dictionary is locked, will wait for purge to release any table handles. trx_t::drop_table_statistics(): Drop statistics for the table. This replaces dict_stats_drop_index(). We will drop or rename persistent statistics atomically as part of DDL transactions. On lock conflict for dropping statistics, we will fail instantly with DB_LOCK_WAIT_TIMEOUT, because we will be holding the exclusive data dictionary latch. trx_t::commit_cleanup(): Separated from trx_t::commit_in_memory(). Relax an assertion around fts_commit() and allow DB_LOCK_WAIT_TIMEOUT in addition to DB_DUPLICATE_KEY. The call to fts_commit() is entirely misplaced here and may obviously break the consistency of transactions that affect FULLTEXT INDEX. It needs to be fixed separately. dict_table_t::n_foreign_key_checks_running: Remove (MDEV-21175). The counter was a work-around for missing meta-data locking (MDL) on the SQL layer, and not really needed in MariaDB. ER_TABLE_IN_FK_CHECK: Replaced with ER_UNUSED_28. HA_ERR_TABLE_IN_FK_CHECK: Remove. row_ins_check_foreign_constraints(): Do not acquire dict_sys.latch either. The SQL-layer MDL will protect us. This was reviewed by Thirunarayanan Balathandayuthapani and tested by Matthias Leich.
* Merge 10.5 into 10.6Marko Mäkelä2021-05-261-15/+14
|\
| * Merge 10.4 into 10.5Marko Mäkelä2021-05-261-12/+23
| |\
| | * Merge 10.3 into 10.4Marko Mäkelä2021-05-251-12/+23
| | |\
| | | * Merge 10.2 into 10.3Marko Mäkelä2021-05-241-12/+23
| | | |\
| | | | * MDEV-25721 Double free of table when inplace alterThirunarayanan Balathandayuthapani2021-05-231-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FTS add index fails Problem: ======== InnoDB double frees the table if auxiliary fts table creation fails and fails to set the dict operation for the transaction. It leads to failure while dropping newly added index. Solution: ========= InnoDB should avoid double freeing and set the dictionary operation of transaction in fts_create_common_tables()
* | | | | MDEV-25743: Unnecessary copying of table names in InnoDB dictionaryMarko Mäkelä2021-05-212-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many InnoDB data dictionary cache operations require that the table name be copied so that it will be NUL terminated. (For example, SYS_TABLES.NAME is not guaranteed to be NUL-terminated.) dict_table_t::is_garbage_name(): Check if a name belongs to the background drop table queue. dict_check_if_system_table_exists(): Remove. dict_sys_t::load_sys_tables(): Load the non-hard-coded system tables SYS_FOREIGN, SYS_FOREIGN_COLS, SYS_VIRTUAL on startup. dict_sys_t::create_or_check_sys_tables(): Replaces dict_create_or_check_foreign_constraint_tables() and dict_create_or_check_sys_virtual(). dict_sys_t::load_table(): Replaces dict_table_get_low() and dict_load_table(). dict_sys_t::find_table(): Renamed from get_table(). dict_sys_t::sys_tables_exist(): Check whether all the non-hard-coded tables SYS_FOREIGN, SYS_FOREIGN_COLS, SYS_VIRTUAL exist. trx_t::has_stats_table_lock(): Moved to dict0stats.cc. Some error messages will now report table names in the internal databasename/tablename format, instead of `databasename`.`tablename`.
* | | | | MDEV-18518 fixup: Remove unused variablesMarko Mäkelä2021-05-071-16/+0
| | | | |
* | | | | MDEV-18518 follow-up fixesMarko Mäkelä2021-05-061-61/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make DDL operations that involve FULLTEXT INDEX atomic. In particular, we must drop the internal FTS_ tables in the same DDL transaction with ALTER TABLE. Remove all references to fts_drop_orphaned_tables(). row_merge_drop_temp_indexes(): Drop also the internal FTS_ tables that are associated with index stubs that were created in prepare_inplace_alter_table_dict() for CREATE FULLTEXT INDEX before the server was killed. fts_clear_all(): Remove the fts_drop_tables() call. It has to be executed before the transaction is committed! dict_load_indexes(): Do not load any metadata for index stubs that had been created by prepare_inplace_alter_table_dict() fts_create_one_common_table(), fts_create_common_tables(), fts_create_one_index_table(), fts_create_index_tables(): Remove redundant error handling. The tables will be dropped just fine by dict_drop_index_tree(). commit_try_norebuild(): Also drop the FTS_ tables when dropping FULLTEXT INDEX. The changes to the test case innodb_fts.crash_recovery has been extensively tested. The non-debug server will be killed while the 3 ALTER TABLE are in any phase of execution. With the debug server, DEBUG_SYNC should make the test deterministic.
* | | | | MDEV-25506: Kill during DDL leaves orphan .ibd fileMarko Mäkelä2021-05-041-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before we create an InnoDB data file, we must have persistently started a DDL transaction and written a record in SYS_INDEXES as well as a FILE_CREATE record for creating the file. In that way, if InnoDB is killed before the DDL transaction is committed, the rollback will be able to delete the file in dict_drop_index_tree(). dict_build_table_def_step(): Do not create the tablespace. At this point, we have not written any log, not even for inserting the SYS_TABLES record. dict_create_sys_indexes_tuple(): Relax an assertion to tolerate a missing tablespace before the first index has been created in dict_create_index_step(). dict_build_index_def_step(): Relax the dict_table_open_on_name() parameter, because no tablespace may be available yet. tab_create_graph_create(), row_create_table_for_mysql(), tab_node_t: Remove key_id, mode. ind_create_graph_create(), row_create_index_for_mysql(), ind_node_t: Add key_id, mode. dict_create_index_space(): New function, to create the tablespace during clustered index creation. dict_create_index_step(): After the SYS_INDEXES record has been written, invoke dict_create_index_space() to create the tablespace if needed. fil_ibd_create(): Before creating the file, persistently write a FILE_CREATE record. This will also ensure that an incomplete DDL transaction will be recovered. After creating the file, invoke fsp_header_init().
* | | | | MDEV-18518 Multi-table CREATE and DROP transactions for InnoDBMarko Mäkelä2021-05-041-196/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | InnoDB used to support at most one CREATE TABLE or DROP TABLE per transaction. This caused complications for DDL operations on partitioned tables (where each partition is treated as a separate table by InnoDB) and FULLTEXT INDEX (where each index is maintained in a number of internal InnoDB tables). dict_drop_index_tree(): Extend the MDEV-24589 logic and treat the purge or rollback of SYS_INDEXES records of clustered indexes specially: by dropping the tablespace if it exists. This is the only form of recovery that we will need. trx_undo_ddl_type: Document the DDL undo log record types better. trx_t::dict_operation: Change the type to bool. trx_t::ddl: Remove. trx_t::table_id, trx_undo_t::table_id: Remove. dict_build_table_def_step(): Remove trx_t::table_id logging. dict_table_close_and_drop(), row_merge_drop_table(): Remove. row_merge_lock_table(): Merged to the only callers, which can call lock_table_for_trx() directly. fts_aux_table_t, fts_aux_id, fts_space_set_t: Remove. fts_drop_orphaned_tables(): Remove. row_merge_rename_index_to_drop(): Remove. Thanks to MDEV-24589, we can simply delete the to-be-dropped indexes from SYS_INDEXES, while still being able to roll back the operation. ha_innobase_inplace_ctx: Make a few data members const. Preallocate trx. prepare_inplace_alter_table_dict(): Simplify the logic. Let the normal rollback take care of some cleanup. row_undo_ins_remove_clust_rec(): Simplify the parsing of SYS_COLUMNS. trx_rollback_active(): Remove the special DROP TABLE logic. trx_undo_mem_create_at_db_start(), trx_undo_reuse_cached(): Always write TRX_UNDO_TABLE_ID as 0.
* | | | | Merge 10.5 into 10.6Marko Mäkelä2021-04-141-7/+14
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.4 into 10.5Marko Mäkelä2021-04-141-8/+15
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.3 into 10.4Marko Mäkelä2021-04-141-8/+15
| | |\ \ \ | | | |/ /
| | | * | MDEV-24620 ASAN heap-buffer-overflow in btr_pcur_restore_position()bb-10.3-MDEV-24620Marko Mäkelä2021-04-131-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Between btr_pcur_store_position() and btr_pcur_restore_position() it is possible that purge empties a table and enlarges index->n_core_fields and index->n_core_null_bytes. Therefore, we must cache index->n_core_fields in btr_pcur_t::old_n_core_fields so that btr_pcur_t::old_rec can be parsed correctly. Unfortunately, this is a huge change, because we will replace "bool leaf" parameters with "ulint n_core" (passing index->n_core_fields, or 0 for non-leaf pages). For special cases where we know that index->is_instant() cannot hold, we may also pass index->n_fields.
| | | * | Merge 10.2 into 10.3Marko Mäkelä2021-04-091-6/+12
| | | |\ \ | | | | |/
| | | | * Improve diagnostics in order to catch MDEV-18868 and similar bugsThirunarayanan Balathandayuthapani2021-04-091-6/+12
| | | | |
* | | | | MDEV-25312 Replace fil_space_t::name with fil_space_t::name()bb-10.6-MDEV-25312Marko Mäkelä2021-04-071-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A consistency check for fil_space_t::name is causing recovery failures in MDEV-25180 (Atomic ALTER TABLE). So, we'd better remove that field altogether. fil_space_t::name was more or less a copy of dict_table_t::name (except for some special cases), and it was not being used for anything useful. There used to be a name_hash, but it had been removed already in commit a75dbfd7183cc96680f3e3e684fd36500dac8158 (MDEV-12266). We will also remove os_normalize_path(), OS_PATH_SEPARATOR, OS_PATH_SEPATOR_ALT. On Microsoft Windows, we will treat \ and / roughly in the same way. The intention is that for per-table tablespaces, the filenames will always follow the pattern prefix/databasename/tablename.ibd. (Any \ in the prefix must not be converted.) ut_basename_noext(): Remove (unused function). read_link_file(): Replaces RemoteDatafile::read_link_file(). We will ensure that the last two path component separators are forward slashes (converting up to 2 trailing backslashes on Microsoft Windows), so that everywhere else we can assume that data file names end in "/databasename/tablename.ibd". Note: On Microsoft Windows, path names that start with \\?\ must not contain / as path component separators. Previously, such paths did work in the DATA DIRECTORY argument of InnoDB tables. Reviewed by: Vladislav Vaintroub
* | | | | MDEV-25223 change fil_system_t::space_list and fil_system_t::named_spaces ↵Eugene Kosov2021-03-241-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from UT_LIST to ilist Mostly a refactoring. Also, debug functions were added for ease of life while debugging
* | | | | cleanup: os_thread_sleep() -> std::this_thread::sleep_for()Eugene Kosov2021-03-192-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std version has an advantage of a more convenient units implementation from std::chrono. Now it's no need to multipy/divide to bring anything to micro seconds.
* | | | | Merge 10.5 into 10.6Marko Mäkelä2021-03-111-1/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.4 into 10.5Marko Mäkelä2021-03-111-1/+1
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.3 into 10.4Marko Mäkelä2021-03-111-1/+1
| | |\ \ \ | | | |/ /
| | | * | MDEV-25070 SIGSEGV in fts_create_in_mem_aux_tableThirunarayanan Balathandayuthapani2021-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | InnoDB set the space in dict_table_t as NULL when table is discarded. So InnoDB shouldn't use the space present in table to detect whether the given tablespace is temporary tablespace.
* | | | | Merge 10.5 into 10.6Marko Mäkelä2021-02-171-1/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch 'bb-10.4-release' into bb-10.5-releaseSergei Golubchik2021-02-151-1/+1
| |\ \ \ \ | | |/ / /
| | * | | Merge branch 'bb-10.3-release' into bb-10.4-releaseSergei Golubchik2021-02-121-1/+1
| | |\ \ \ | | | |/ / | | | | | | | | | | | | | | | Note, the fix for "MDEV-23328 Server hang due to Galera lock conflict resolution" was null-merged. 10.4 version of the fix is coming up separately
| | | * | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-011-1/+1
| | | |\ \ | | | | |/
| | | | * MDEV-24403 Segfault on CREATE TABLE with explicit FTS_DOC_ID_INDEX by ↵Aleksey Midenkov2021-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | multiple fields Ignore table->fts freed previously by create_table_info_t::create_table().
| * | | | MDEV-24693 LeakSanitizer: detected memory leaks in ↵Thirunarayanan Balathandayuthapani2021-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mem_heap_create_block_func / fts_optimize_create_msg - This issue is caused by the commit bf1f9b59c7d0b619d8bf350b96436970c6edc118 (MDEV-24638). Delay the creation of SYNC message in fts_optimize_request_sync_table. So that InnoDB can avoid creating the message if the table already has SYNC message in fts_optimize_wq queue
* | | | | Cleanup: Replace mysql_cond_t with pthread_cond_tMarko Mäkelä2021-02-072-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Let us avoid the memory overhead and the dead duplicated code for each use of never-instrumented condition variables in InnoDB.
* | | | | Cleanups:Marko Mäkelä2021-01-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | que_thr_t::fork_type: Remove. QUE_THR_SUSPENDED, TRX_QUE_COMMITTING: Remove. Cleanup lock_cancel_waiting_and_release()
* | | | | Merge 10.5 into 10.6Marko Mäkelä2021-01-251-7/+7
|\ \ \ \ \ | |/ / / /
| * | | | 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-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ä
* | | | | MDEV-21452: Replace ib_mutex_t with mysql_mutex_tMarko Mäkelä2020-12-154-37/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SHOW ENGINE INNODB MUTEX functionality is completely removed, as are the InnoDB latching order checks. We will enforce innodb_fatal_semaphore_wait_threshold only for dict_sys.mutex and lock_sys.mutex. dict_sys_t::mutex_lock(): A single entry point for dict_sys.mutex. lock_sys_t::mutex_lock(): A single entry point for lock_sys.mutex. FIXME: srv_sys should be removed altogether; it is duplicating tpool functionality. fil_crypt_threads_init(): To prevent SAFE_MUTEX warnings, we must not hold fil_system.mutex. fil_close_all_files(): To prevent SAFE_MUTEX warnings for fil_space_destroy_crypt_data(), we must not hold fil_system.mutex while invoking fil_space_free_low() on a detached tablespace.
* | | | | MDEV-21452: Replace all direct use of os_event_tMarko Mäkelä2020-12-152-162/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let us replace os_event_t with mysql_cond_t, and replace the necessary ib_mutex_t with mysql_mutex_t so that they can be used with condition variables. Also, let us replace polling (os_thread_sleep() or timed waits) with plain mysql_cond_wait() wherever possible. Furthermore, we will use the lightweight srw_mutex for trx_t::mutex, to hopefully reduce contention on lock_sys.mutex. FIXME: Add test coverage of mariabackup --backup --kill-long-queries-timeout
* | | | | MDEV-24167: Replace fts_cache_rw_lock, fts_cache_init_rw_lock with mutexMarko Mäkelä2020-11-242-68/+58
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fts_cache_t::init_lock: Replace with mutex. This was only acquired in exclusive mode. fts_cache_t::lock: Replace with mutex. The only read-lock user was i_s_fts_index_cache_fill() for producing content for the view INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE.
* | | | Merge 10.4 into 10.5Marko Mäkelä2020-10-302-17/+22
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-10-292-17/+22
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-10-282-17/+22
| | |\ \ | | | |/
| | | * Bug #31228694 FTS QUERY WITH LIMIT HIT AN ASSERTbb-10.2-MDEV-23989Sachin Agarwal2020-10-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: 1. The server terminates abnormally when phrase search doesn't filter out doc_ids correctly. This problem has been fixed in bug 2. Wrong query result: It's a regression from the bug #22709692 fix. This fix optimize full-text search query with limit clause. when FTS expression involves only union operation, we fetch only number of doc_ids specified with the limit clause. Fulltext phrase search is not an union operation and we consider phrase search with plugin parser a union operation. In phrase search with limit clause, we fetch limited doc_ids for each token and if any of the selected doc_id does not contain all tokens in correct order then we do not include that row_id in the result set. Therefore phrase search gets fewer number of rows than the qualified rows exist in the table. Fix: Added a condition that phrase search with plugin parser is not a union operation. RB: 24925 Reviewed by : Annamalai Gurusami <annamalai.gurusami@oracle.com> This is a cherry-pick of mysql/mysql-server@5549920b7a33ef33034461d973a9ecb17ce49799 without a test case, because the test case depends on an n-gram tokenizer that will be missing from MariaDB until MDEV-10267 is added.
| | | * Bug #30933728 INNODB FTS PHRASE SEARCH HIT AN ASSERTSachin Agarwal2020-10-261-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: In Full-text phrase search, we filter out row that do not contain all the tokens in the phrase. If we do not filter out doc_id that doesn't appear in all the token's doc_id lists then we hit an assert. Fix: if any of the token has last doc_id equal to ith doc_id of the first token doc_id list then filter out rest of the higher doc_ids. RB: 24909 Reviewed by : Annamalai Gurusami <annamalai.gurusami@oracle.com> This is a cherry-pick of mysql/mysql-server@5aa075277dfe84a17a0331c57a6fe9b91dafb4cf but without a test case, because the test case depends on an n-gram tokenizer that will be missing from MariaDB until MDEV-10267 is added.
* | | | MDEV-23855: Shrink fil_space_tMarko Mäkelä2020-10-261-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge n_pending_ios, n_pending_ops to std::atomic<uint32_t> n_pending. Change some more fil_space_t members to uint32_t to reduce the memory footprint. fil_space_t::add(), fil_ibd_create(): Attach the already opened handle to the tablespace, and enforce the fil_system.n_open limit. dict_boot(): Initialize fil_system.max_assigned_id. srv_boot(): Call srv_thread_pool_init() before anything else, so that files should be opened in the correct mode on Windows. fil_ibd_create(): Create the file in OS_FILE_AIO mode, just like fil_node_open_file_low() does it. dict_table_t::is_accessible(): Replaces fil_table_accessible(). Reviewed by: Vladislav Vaintroub
* | | | Merge 10.4 to 10.5Marko Mäkelä2020-10-223-6/+19
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2020-10-223-6/+19
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2020-10-223-6/+19
| | |\ \ | | | |/
| | | * Merge 10.1 into 10.2Marko Mäkelä2020-10-211-1/+14
| | | |\