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

Backup fails during an ALTER TABLE with FULLTEXT INDEX

    XMLWordPrintable

Details

    Description

      MDEV-32932 introduced the test mariabackup.innodb_ddl_on_intermediate_table, but it is disabled. First of all, the test would hang because of a missing DEBUG_SYNC point. Once that is sorted out, the test would fail in a similar way as described in MDEV-25899.

      It is not quite the same way, because this failure would involve an internal table for FULLTEXT INDEX. It turns out that in backup, there already was an incomplete attempt to fix this bug:

      diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
      index e9f6876f30b..8347d84f0cb 100644
      --- a/extra/mariabackup/xtrabackup.cc
      +++ b/extra/mariabackup/xtrabackup.cc
      @@ -3892,16 +3892,18 @@ static void xb_load_single_table_tablespace(const char *dirname,
       
       	if (is_remote) {
       		RemoteDatafile* rf = new RemoteDatafile();
      +		file = rf;
       		if (!rf->open_link_file(n)) {
      -			die("Can't open datafile %s", name);
      +			goto cant_open;
       		}
      -		file = rf;
       	} else {
       		file = new Datafile();
       		file->make_filepath(".", n, IBD);
       	}
       
       	if (file->open_read_only(true) != DB_SUCCESS) {
      +	cant_open:
      +		delete file;
       		// Ignore FTS tables, as they can be removed for intermediate tables,
       		// this code must be executed under stronger or equal to BLOCK_DDL lock,
       		// so there must not be errors for non-intermediate FTS tables.
      diff --git a/mysql-test/suite/mariabackup/disabled.def b/mysql-test/suite/mariabackup/disabled.def
      index f8a341814da..136352b81fd 100644
      --- a/mysql-test/suite/mariabackup/disabled.def
      +++ b/mysql-test/suite/mariabackup/disabled.def
      @@ -1,3 +1,2 @@
       log_page_corruption : MDEV-26210
       mariabackup.xb_compressed_encrypted : MDEV-26154 (error 194 "Tablespace is missing for a table")
      -innodb_ddl_on_intermediate_table : MENT-1213
      diff --git a/sql/sql_table.cc b/sql/sql_table.cc
      index 55f708c6692..3e435d45cc2 100644
      --- a/sql/sql_table.cc
      +++ b/sql/sql_table.cc
      @@ -11956,6 +11956,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, bool ignore,
         }
       
         backup_set_alter_copy_lock(thd, from);
      +  DEBUG_SYNC(thd, "copy_data_between_tables_after_set_backup_lock");
       
         alter_table_manage_keys(to, from->file->indexes_are_disabled(),
                                 alter_info->keys_onoff);
      

      The above patch enables and fixes the test case, as well as the bug about missing FTS_ files during backup.

      10.11 abc46259c6e6fc0fdf8144ad4be551495d88d22a with the patch

      [00] 2024-10-25 13:43:35 Finished backing up non-InnoDB tables and files
      [00] 2024-10-25 13:43:35 Waiting for log copy thread to read lsn 101050
      [07] 2024-10-25 13:43:35 Copied file ./mysql/slow_log.CSV for log table `mysql`.`slow_log`, 0 bytes
      [05] 2024-10-25 13:43:35 Copied file ./mysql/general_log.CSV for log table `mysql`.`general_log`, 0 bytes
      [00] 2024-10-25 13:43:36 DDL tracking : create 18 "./test/#sql-alter-175c6-11.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 19 "./test/FTS_000000000000001f_BEING_DELETED.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 20 "./test/FTS_000000000000001f_BEING_DELETED_CACHE.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 21 "./test/FTS_000000000000001f_CONFIG.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 22 "./test/FTS_000000000000001f_DELETED.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 23 "./test/FTS_000000000000001f_DELETED_CACHE.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 24 "./test/FTS_000000000000001f_000000000000002d_INDEX_1.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 25 "./test/FTS_000000000000001f_000000000000002d_INDEX_2.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 26 "./test/FTS_000000000000001f_000000000000002d_INDEX_3.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 27 "./test/FTS_000000000000001f_000000000000002d_INDEX_4.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 28 "./test/FTS_000000000000001f_000000000000002d_INDEX_5.ibd"
      [00] 2024-10-25 13:43:36 DDL tracking : create 29 "./test/FTS_000000000000001f_000000000000002d_INDEX_6.ibd"
      [00] FATAL ERROR: 2024-10-25 13:43:37 Can't open datafile test/FTS_000000000000001f_BEING_DELETED
      

      The file test/FTS_000000000000001f_BEING_DELETED was deleted at LSN=119,678 right after the FILE_DELETE record for it had been written. Backup did not observe that record, because it had only copied log until the recv_sys.lsn 108,542 (a little more than it was initially waiting for in the above log). The table was deleted because backup_reset_alter_copy_lock() in copy_data_between_tables() had timed out due to the conflict with BACKUP STAGE BLOCK_DDL that is held by the backup process.

      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.