Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35059

ALTER TABLE...IMPORT TABLESPACE with FULLTEXT SEARCH may corrupt the adaptive hash index

    XMLWordPrintable

Details

    Description

      The fix of MDEV-30655 introduced a regression that is easy to reproduce as follows:

      ./mtr --mem --skip-stack-trace --parallel=6 --repeat=10 --mysqld=--loose-innodb-adaptive-hash-index=ON --suite=innodb innodb.import_hidden_fts{,,,,,}
      

      10.11 21b20712a3fe7ac44291b398a3731e514c23c8a4

      CURRENT_TEST: innodb.import_hidden_fts
      mysqltest: At line 43: query 'ALTER TABLE t1 IMPORT TABLESPACE' failed: <Unknown> (2013): Lost connection to server during query
      ...
      2024-10-02 10:50:25 14 [Note] InnoDB: Phase IV - Flush complete
      2024-10-02 10:50:25 14 [Warning] InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace `test`.`t1`
      mariadbd: /mariadb/10.11/storage/innobase/dict/dict0mem.cc:207: void dict_mem_table_free(dict_table_t*): Assertion `(table->freed_indexes).count == 0' failed.
      241002 10:50:25 [ERROR] mysqld got signal 6 ;
      

      The fix is simple: a per-index data structure must not be shared between indexes.

      diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
      index 4d5f3592b5a..ca27e26d55a 100644
      --- a/storage/innobase/row/row0import.cc
      +++ b/storage/innobase/row/row0import.cc
      @@ -3335,7 +3335,9 @@ static dict_table_t *build_fts_hidden_table(
             new_index->fields[old_index->n_fields].fixed_len= sizeof(doc_id_t);
           }
       
      -    new_index->search_info= old_index->search_info;
      +#ifdef BTR_CUR_ADAPT
      +    new_index->search_info= btr_search_info_create(new_index->heap);
      +#endif /* BTR_CUR_ADAPT */
           UT_LIST_ADD_LAST(new_index->table->indexes, new_index);
           old_index= UT_LIST_GET_NEXT(indexes, old_index);
           if (UT_LIST_GET_LEN(new_table->indexes)
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.