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

DROP TABLE leaves the InnoDB table behind when the fulltext parser plugin of the table is not loaded

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.8.9, 12.3.3
    • None
    • Full-text Search, Plugins
    • None
    • Can result in unexpected behaviour
    • DROP TABLE no longer leaves an InnoDB table and its files behind when the fulltext parser plugin of the table is not loaded.

    Description

      INSTALL PLUGIN simple_parser SONAME 'mypluglib';
      CREATE TABLE t1 (id INT PRIMARY KEY, a TEXT, FULLTEXT ft (a) WITH PARSER simple_parser) ENGINE=InnoDB;
      FLUSH TABLES;
      UNINSTALL PLUGIN simple_parser;
      DROP TABLE t1;                                  # succeeds, no warning
      SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/%';
      # test/t1 and all its FTS_* tables are still there; t1.ibd and FTS_*.ibd remain in the datadir
      CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
      # ERROR 1050 (42S01): Table '`test`.`t1`' already exists
      

      The error log only shows Incorrect information in file: './test/t1.frm'; a restart does not change anything. The same happens when the server is started with --<parser>=OFF (e.g. ngram from MDEV-10267 with --ngram=OFF).

      Since aa09cb3b11 ("open frm for DROP TABLE", 11.7), mysql_rm_table_no_locks() opens the table share to find the engine, with a Dummy_error_handler. init_from_binary_frm_image() cannot lock the parser plugin and raises ER_PLUGIN_IS_NOT_LOADED, then ER_NOT_FORM_FILE. Dummy_error_handler::got_error() returns the first error, so the ER_NOT_FORM_FILE case, which takes the engine from dd_frm_type(), is skipped, and the default case leaves the handlerton NULL (in a DBUG trace the DDL log entry shows handler '(null)'). ha_delete_table() returns at once, and only the .frm file is deleted. InnoDB is never asked to drop the table, so the table, its FTS auxiliary tables and their files stay, and CREATE TABLE with that name fails until DROP TABLE is run a second time (without the .frm it goes through ha_delete_table_force()). 11.4 is not affected: it takes the engine from dd_frm_type() and drops the table.

      Possible fix: handle ER_PLUGIN_IS_NOT_LOADED like ER_NOT_FORM_FILE there, or let DROP TABLE fail with ER_PLUGIN_IS_NOT_LOADED instead of dropping only the .frm. We found it while porting MySQL's ngram tests (innodb_fts.ngram_2) for MDEV-10267.

      MyISAM and Aria tables also lose only the .frm (.MYD/.MYI or .MAD/.MAI stay), but there CREATE TABLE overwrites the files.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Futureweb Andreas Schnederle-Wagner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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