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

Online ALTER table is denied with non-informative error messages

Details

    Description

      serg wrote elsewhere:

      Conditions under which online alter works are getting more and more complicated, lots of cases will disable online mode. Perhaps it'd make sense to issue a warning of why exactly online was disabled? Otherwise, I suspect, users will be hardly able to navigate this maze of conditions.

      So far this extra diagnostics has not been implemented, error messages still look the way they did before:

      bb-11.0-oalter fd06124e66c

      MariaDB [test]> alter online table t1 rename to t1a;
      ERROR 1845 (0A000): LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
      MariaDB [test]> show warnings;
      +-------+------+--------------------------------------------------------------------------+
      | Level | Code | Message                                                                  |
      +-------+------+--------------------------------------------------------------------------+
      | Error | 1845 | LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE |
      +-------+------+--------------------------------------------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova added a comment - - edited

            It turns out that ALTER ONLINE TABLE is not the same online alter as online alter in MDEV-16329, so the example in the description doesn't exactly relate to it (you can't do ALTER ONLINE TABLE ... RENAME but you can do ALTER ... RENAME .. ALGORITHM=COPY, LOCK=NONE); but the question of non-detailed error messages remain the same, regardless the example.

            elenst Elena Stepanova added a comment - - edited It turns out that ALTER ONLINE TABLE is not the same online alter as online alter in MDEV-16329 , so the example in the description doesn't exactly relate to it (you can't do ALTER ONLINE TABLE ... RENAME but you can do ALTER ... RENAME .. ALGORITHM=COPY, LOCK=NONE ); but the question of non-detailed error messages remain the same, regardless the example.

            I think we do need better diagnostics. The error message for 1845 ER_ALTER_OPERATION_NOT_SUPPORTED, as in the description, is at least still correct, even if not very informative ("LOCK=NONE is not supported for this operation. Try ..."), but the more generic 1846 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON is now plain wrong: "LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try ...".

            That is, instead of referring to a specific operation, as 1845 does, this one claims that LOCK=NONE is not supported for the COPY algorithm at all, which is of course not true anymore.

            Besides, it can be very confusing, e.g. when you can do ALTER, but cannot do the same ALTER with IGNORE:

            MariaDB [test]> alter table t force, algorithm=copy, lock=none;
            Query OK, 2 rows affected (0.065 sec)                      
            Records: 2  Duplicates: 0  Warnings: 0
             
            MariaDB [test]> alter ignore table t force, algorithm=copy, lock=none;
            ERROR 1846 (0A000): LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
            

            elenst Elena Stepanova added a comment - I think we do need better diagnostics. The error message for 1845 ER_ALTER_OPERATION_NOT_SUPPORTED , as in the description, is at least still correct, even if not very informative ("LOCK=NONE is not supported for this operation. Try ..."), but the more generic 1846 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON is now plain wrong: "LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try ...". That is, instead of referring to a specific operation, as 1845 does, this one claims that LOCK=NONE is not supported for the COPY algorithm at all, which is of course not true anymore. Besides, it can be very confusing, e.g. when you can do ALTER, but cannot do the same ALTER with IGNORE: MariaDB [test]> alter table t force , algorithm=copy, lock=none; Query OK, 2 rows affected (0.065 sec) Records: 2 Duplicates: 0 Warnings: 0   MariaDB [test]> alter ignore table t force , algorithm=copy, lock=none; ERROR 1846 (0A000): LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED

            dc7136481bf5 looks ok

            serg Sergei Golubchik added a comment - dc7136481bf5 looks ok

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              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.