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

REPAIR TABLE ... USE_FRM: Inconsistent "Table" column format (alias vs db.table) in multi-table output

    XMLWordPrintable

Details

    Description

      Summary

      Under low session memory conditions (max_session_mem_used=8192, executing a multi-table REPAIR TABLE t1, t2 USE_FRM returns a result set with inconsistent namespace formatting in the Table column.

      The first row returns the unqualified table alias (t1), while subsequent rows return the fully qualified name (realbug_probe.t2). This breaks consistency contracts for diagnostic outputs and can break automated database administration tools/parsers that expect a uniform db.table format.

      Root Cause Analysis

      The divergence occurs because the "early error" path uses a different string generation method than the standard admin path:

      • send_check_errmsg() (in sql/sql_admin.cc) fetches and stores table->alias only.
      • Normal admin result rows generated via mysql_admin_table() correctly build the qualified name: db + . + table_name.

      Steps to Reproduce

      DROP DATABASE IF EXISTS realbug_probe;
      CREATE DATABASE realbug_probe;
      USE realbug_probe;
       
      SET SESSION max_session_mem_used=8192;
       
      CREATE TABLE t1(id INT) ENGINE=MyISAM;
      CREATE TABLE t2(id INT) ENGINE=MyISAM;
       
      REPAIR TABLE t1, t2 USE_FRM;
      

      Actual Result (Inconsistent)

      Table Op Msg_type Msg_text
      t1 repair error Failed to open partially repaired table
      realbug_probe.t2 repair Error The MariaDB server is running with the --max...
      realbug_probe.t2 repair Error The MariaDB server is running with the --max...
      realbug_probe.t2 repair status Operation failed

      (Notice the mixing of "t1" and "realbug_probe.t2" in the first column).

      Expected Result (Consistent)

      All rows in the Table column must use the same naming convention, aligned with other multi-table admin commands. It should be fully qualified: realbug_probe.t1 and realbug_probe.t2.

      Controls / Proof of Consistency

      If we run the exact same scenario but simply omit USE_FRM, or change the verb to CHECK TABLE, the output is perfectly consistent (using the db.table format):

      Control A: Without USE_FRM

      REPAIR TABLE t1, t2; 
      

      Result A: Consistent db.table (e.g., realbug_pair.t1 / realbug_pair.t2).

      Control B: CHECK TABLE

      CHECK TABLE t1, t2;
      

      Result B: Consistent db.table (e.g., realbug_chk.t1 / realbug_chk.t2).

      Suggested Fix

      Align send_check_errmsg() (or the call sites for repair) to emit the same qualified table identifier string built in mysql_admin_table(), rather than relying solely on TABLE_LIST::alias.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            mu mu
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.