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

Recovery failure due to delete-marked SYS_FIELDS record

    XMLWordPrintable

Details

    Description

      We got a recovery failure like this:

      10.6 63e9a05440953bf451ebe1cd808ca445e4c7634e

      mariadbd: /mariadb/10.6/storage/innobase/dict/dict0dict.cc:2028: dberr_t dict_index_add_to_cache(dict_index_t *&, ulint, const dict_add_v_col_t *): Assertion `index->n_def == index->n_fields' failed.
      

      The reason is that for the clustered index of a #sql-ib table (which was being dropped in a transaction that had not been committed), the only SYS_FIELDS record is delete-marked. The following fixup to MDEV-25506 part 3 ought to fix it:

      diff --git a/storage/innobase/dict/drop.cc b/storage/innobase/dict/drop.cc
      index ff8e108b26d..1217a5bc0a1 100644
      --- a/storage/innobase/dict/drop.cc
      +++ b/storage/innobase/dict/drop.cc
      @@ -209,13 +209,13 @@ dberr_t trx_t::drop_table(const dict_table_t &table)
                             "WHILE 1 = 1 LOOP\n"
                             "  FETCH idx INTO iid;\n"
                             "  IF (SQL % NOTFOUND) THEN EXIT; END IF;\n"
      -                      "  DELETE FROM SYS_FIELDS WHERE INDEX_ID=iid;\n"
                             "  DELETE FROM SYS_INDEXES WHERE CURRENT OF idx;\n"
      +                      "  DELETE FROM SYS_FIELDS WHERE INDEX_ID=iid;\n"
                             "END LOOP;\n"
                             "CLOSE idx;\n"
       
      -                      "DELETE FROM SYS_COLUMNS WHERE TABLE_ID=:id;\n"
                             "DELETE FROM SYS_TABLES WHERE ID=:id;\n"
      +                      "DELETE FROM SYS_COLUMNS WHERE TABLE_ID=:id;\n"
       
                             "END;\n", FALSE, this);
       }
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.