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

[PATCH] alter online table xxxx (no options) should be possible

    Details

      Description

      alter online table t1 algorithm=INPLACE, lock=NONE;

      sure it does nothing, but the current implementation does a full table copy for it.

      simple patch for a simple problem.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              danblack Daniel Black added a comment - - edited

              since handle_if_exists_options only removes alter_info->flags if the exists {column, fk,partition etc} exists, lets short cut that too.

              Show
              danblack Daniel Black added a comment - - edited since handle_if_exists_options only removes alter_info->flags if the exists {column, fk,partition etc} exists, lets short cut that too.
              Show
              danblack Daniel Black added a comment - https://github.com/MariaDB/server/pull/23
              Hide
              serg Sergei Golubchik added a comment -
              Show
              serg Sergei Golubchik added a comment - for 10.0: https://github.com/MariaDB/server/pull/58
              Hide
              serg Sergei Golubchik added a comment -

              Daniel Black, I don't understand your comment about handle_if_exists_options (and the if() you've added above it). Could you please elaborate on that?

              Show
              serg Sergei Golubchik added a comment - Daniel Black , I don't understand your comment about handle_if_exists_options (and the if() you've added above it). Could you please elaborate on that?
              Hide
              danblack Daniel Black added a comment -

              This if statement is considering whether to allow online operations based on the flags. When Alter_info::ALTER_RENAME or Alter_info::ALTER_KEYS_ONOFF is specified we can still do it online so lets mask those out.
              alter_info->flags & ~(Alter_info::ALTER_RENAME |Alter_info::ALTER_KEYS_ONOFF would normally be true if we've got some flags incompatible with with online operations.

                 if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME |
                                             Alter_info::ALTER_KEYS_ONOFF))
              

              alter_info->flags != 0 is added because if no flags (i.e. a plain alter online table xxxx) is specified this above condition is also false resulting in no online being possible.

              The only outcome of handle_if_exists is that alter_info->flags&=

              {something}

              under various branches. If alter_info->flags is already 0 we don't need to call this function.

              Show
              danblack Daniel Black added a comment - This if statement is considering whether to allow online operations based on the flags. When Alter_info::ALTER_RENAME or Alter_info::ALTER_KEYS_ONOFF is specified we can still do it online so lets mask those out. alter_info->flags & ~(Alter_info::ALTER_RENAME |Alter_info::ALTER_KEYS_ONOFF would normally be true if we've got some flags incompatible with with online operations. if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME | Alter_info::ALTER_KEYS_ONOFF)) alter_info->flags != 0 is added because if no flags (i.e. a plain alter online table xxxx) is specified this above condition is also false resulting in no online being possible. The only outcome of handle_if_exists is that alter_info->flags&= {something} under various branches. If alter_info->flags is already 0 we don't need to call this function.
              Hide
              danblack Daniel Black added a comment -

              the if condition before handle_if_exists_options is an optional part of the patch. Omit if you feel uncomfortable about it.

              Show
              danblack Daniel Black added a comment - the if condition before handle_if_exists_options is an optional part of the patch. Omit if you feel uncomfortable about it.

                People

                • Assignee:
                  serg Sergei Golubchik
                  Reporter:
                  danblack Daniel Black
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 30 minutes
                    30m