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

Clean up some DDL code around FOREIGN KEY constraints

Details

    Description

      In MDEV-17938 a second bool parameter was added to the function row_rename_table_for_mysql(), which is part of RENAME TABLE and also other DDL operations that rebuild tables. An earlier parameter bool commit had been removed in MDEV-25506.

      In a MDEV-25292 branch bb-main-midenok-MDEV-25292, a parameter bool cmd_alter was added to row_rename_table_for_mysql(). It would have been better to replace the existing bool use_fk parameter with an enum:

      enum rename_fk {
        /** ignore FOREIGN KEY constraints */
        RENAME_IGNORE_FK= 0,
        /** parse and enforce FOREIGN KEY constaints */
        RENAME_FK,
        /** Rename a table as part of a native table-rebuilding DDL operation */
        RENAME_REBUILD,
        /** Rename as part of ALTER TABLE...ALGORITHM=COPY */
        RENAME_ALTER_COPY
      };
      

      Part of this change could simplify some logic around FOREIGN KEY constraints in table-rebuilding operations, such as TRUNCATE TABLE.

      Another change that seems to be needed both for MDEV-25506 and MDEV-19191 is simplifying the function dict_get_referenced_table().

      Attachments

        Issue Links

          Activity

            There is updated branch bb-main-midenok-MDEV-25292

            midenok Aleksey Midenkov added a comment - There is updated branch bb-main-midenok- MDEV-25292

            marko The refactoring looks good overall. I have added a few doubts/comments for your consideration.

            debarun Debarun Banerjee added a comment - marko The refactoring looks good overall. I have added a few doubts/comments for your consideration.

            I have addressed your review comments and added a test case for something that would have caused a regression. Please take another look.

            marko Marko Mäkelä added a comment - I have addressed your review comments and added a test case for something that would have caused a regression. Please take another look.

            Thank you marko for addressing the comments. The new `innodb_convert_name()` and `dict_scan_id()` related clean up looks good to me.

            debarun Debarun Banerjee added a comment - Thank you marko for addressing the comments. The new `innodb_convert_name()` and `dict_scan_id()` related clean up looks good to me.

            While I was discussing this with debarun, I vaguely remembered that there was some further maintenance debt that had been left behind by MDEV-20480. I did not find a ticket for it, so I filed MDEV-35916.

            marko Marko Mäkelä added a comment - While I was discussing this with debarun , I vaguely remembered that there was some further maintenance debt that had been left behind by MDEV-20480 . I did not find a ticket for it, so I filed MDEV-35916 .

            People

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