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

Show actual mismatching values in mismatch error messages from row_import::match_table_columns()

Details

    Description

      When doing an ALTER TABLE ... IMPORT, InnoDB checks for a number of potential type mismatches between the local table definition, and those from the imported table.

      When finding a mismatch it prevents the import, and logs a mismatch error message, but these messages do not contain actual value, so one can see that there was a mismatch of some sort, but not what the actual mismatching values on either side were.

      Attachments

        Issue Links

          Activity

            hholzgra Hartmut Holzgraefe added a comment - - edited

            Proposed change (against current 10.2 branch, also adding a missing error message for col->ind):

            diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
            index 930a8303316..56dc8252ba4 100644
            --- a/storage/innobase/row/row0import.cc
            +++ b/storage/innobase/row/row0import.cc
            @@ -1156,8 +1156,10 @@ row_import::match_table_columns(
                                            ib_errf(thd,
                                                     IB_LOG_LEVEL_ERROR,
                                                     ER_TABLE_SCHEMA_MISMATCH,
            -                                        "Column %s precise type mismatch.",
            -                                        col_name);
            +                                        "Column %s precise type mismatch, "
            +                                        " it's %X in the table and %X"
            +                                        " in the tablespace meta file",
            +                                        col_name, col->prtype, cfg_col->prtype);
                                            err = DB_ERROR;
                                    }
             
            @@ -1165,8 +1167,10 @@ row_import::match_table_columns(
                                            ib_errf(thd,
                                                     IB_LOG_LEVEL_ERROR,
                                                     ER_TABLE_SCHEMA_MISMATCH,
            -                                        "Column %s main type mismatch.",
            -                                        col_name);
            +                                        "Column %s main type mismatch, "
            +                                        " it's %X in the table and %X"
            +                                        " in the tablespace meta file",
            +                                        col_name, col->mtype, cfg_col->mtype);
                                            err = DB_ERROR;
                                    }
             
            @@ -1174,8 +1178,10 @@ row_import::match_table_columns(
                                            ib_errf(thd,
                                                     IB_LOG_LEVEL_ERROR,
                                                     ER_TABLE_SCHEMA_MISMATCH,
            -                                        "Column %s length mismatch.",
            -                                        col_name);
            +                                        "Column %s length mismatch, "
            +                                        " it's %u in the table and %u"
            +                                        " in the tablespace meta file",
            +                                       col_name, col->len, cfg_col->len);
                                            err = DB_ERROR;
                                    }
             
            @@ -1184,12 +1190,22 @@ row_import::match_table_columns(
                                            ib_errf(thd,
                                                     IB_LOG_LEVEL_ERROR,
                                                     ER_TABLE_SCHEMA_MISMATCH,
            -                                        "Column %s multi-byte len mismatch.",
            -                                        col_name);
            +                                        "Column %s multi-byte len mismatch, "
            +                                        " it's %u-%u in the table and %u-%u"
            +                                        " in the tablespace meta file",
            +                                        col_name, col->mbminlen, col->mbmaxlen,
            +                                        cfg_col->mbminlen, cfg_col->mbmaxlen);
                                            err = DB_ERROR;
                                    }
             
                                    if (cfg_col->ind != col->ind) {
            +                               ib_errf(thd,
            +                                        IB_LOG_LEVEL_ERROR,
            +                                        ER_TABLE_SCHEMA_MISMATCH,
            +                                        "Column %s position mismatch, "
            +                                        " it's %u in the table and %u"
            +                                        " in the tablespace meta file",
            +                                       col_name, col->ind, cfg_col->ind);
                                            err = DB_ERROR;
                                    }
             
            @@ -1197,8 +1213,10 @@ row_import::match_table_columns(
                                            ib_errf(thd,
                                                     IB_LOG_LEVEL_ERROR,
                                                     ER_TABLE_SCHEMA_MISMATCH,
            -                                        "Column %s ordering mismatch.",
            -                                        col_name);
            +                                        "Column %s ordering mismatch, "
            +                                        " it's %u in the table and %u"
            +                                        " in the tablespace meta file",
            +                                       col_name, col->ord_part, cfg_col->ord_part);
                                            err = DB_ERROR;
                                    }
             
            @@ -1206,8 +1224,10 @@ row_import::match_table_columns(
                                            ib_errf(thd,
                                                     IB_LOG_LEVEL_ERROR,
                                                     ER_TABLE_SCHEMA_MISMATCH,
            -                                        "Column %s max prefix mismatch.",
            -                                        col_name);
            +                                        "Column %s max prefix mismatch "
            +                                        " it's %u in the table and %u"
            +                                        " in the tablespace meta file",
            +                                       col_name, col->max_prefix, cfg_col->max_prefix);
                                            err = DB_ERROR;
                                    }
                            }
            
            

            hholzgra Hartmut Holzgraefe added a comment - - edited Proposed change (against current 10.2 branch, also adding a missing error message for col->ind): diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 930a8303316..56dc8252ba4 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1156,8 +1156,10 @@ row_import::match_table_columns( ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Column %s precise type mismatch.", - col_name); + "Column %s precise type mismatch, " + " it's %X in the table and %X" + " in the tablespace meta file", + col_name, col->prtype, cfg_col->prtype); err = DB_ERROR; } @@ -1165,8 +1167,10 @@ row_import::match_table_columns( ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Column %s main type mismatch.", - col_name); + "Column %s main type mismatch, " + " it's %X in the table and %X" + " in the tablespace meta file", + col_name, col->mtype, cfg_col->mtype); err = DB_ERROR; } @@ -1174,8 +1178,10 @@ row_import::match_table_columns( ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Column %s length mismatch.", - col_name); + "Column %s length mismatch, " + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->len, cfg_col->len); err = DB_ERROR; } @@ -1184,12 +1190,22 @@ row_import::match_table_columns( ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Column %s multi-byte len mismatch.", - col_name); + "Column %s multi-byte len mismatch, " + " it's %u-%u in the table and %u-%u" + " in the tablespace meta file", + col_name, col->mbminlen, col->mbmaxlen, + cfg_col->mbminlen, cfg_col->mbmaxlen); err = DB_ERROR; } if (cfg_col->ind != col->ind) { + ib_errf(thd, + IB_LOG_LEVEL_ERROR, + ER_TABLE_SCHEMA_MISMATCH, + "Column %s position mismatch, " + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->ind, cfg_col->ind); err = DB_ERROR; } @@ -1197,8 +1213,10 @@ row_import::match_table_columns( ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Column %s ordering mismatch.", - col_name); + "Column %s ordering mismatch, " + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->ord_part, cfg_col->ord_part); err = DB_ERROR; } @@ -1206,8 +1224,10 @@ row_import::match_table_columns( ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Column %s max prefix mismatch.", - col_name); + "Column %s max prefix mismatch " + " it's %u in the table and %u" + " in the tablespace meta file", + col_name, col->max_prefix, cfg_col->max_prefix); err = DB_ERROR; } }

            People

              hholzgra Hartmut Holzgraefe
              hholzgra Hartmut Holzgraefe
              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.