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

row-by-row logging needs to be disabled for the online ALTER log application stage

Details

    Description

      Engine-independent online alter table (MDEV-16329) brings an extra data-modification stage to the COPY alter table – online log changes application.

      For the normal copy stage, the row-by-row logging was disabled in MDEV-11415. This can be extended to the online log application.

      Attachments

        Issue Links

          Activity

            Row-by-row logging is enabled for CREATE...SELECT in select_create::prepare.
            But it's turned off for IGNORE and REPLACE

                if (thd->lex->duplicates == DUP_ERROR && !thd->lex->ignore)
                  table->file->extra(HA_EXTRA_BEGIN_ALTER_COPY);
            

            git show c411393a844becf91a560ac8e53ab04cb4fb9219

             
            commit c411393a844becf91a560ac8e53ab04cb4fb9219
            Author: Marko Mäkelä <marko.makela@mariadb.com>
            Date:   Thu Jan 28 15:26:53 2021 +0200
             
                MDEV-24715 Assertion !node->table->skip_alter_undo in CREATE...REPLACE SELECT
                
                In commit 3cef4f8f0fc88ae5bfae4603d8d600ec84cc70a9 (MDEV-515)
                we inadvertently broke CREATE TABLE...REPLACE SELECT statements
                by wrongly disabling row-level undo logging.
                
                select_create::prepare(): Only invoke extra(HA_EXTRA_BEGIN_ALTER_COPY)
                if no special treatment of duplicates is needed.
            

            REPLACE operation has a special treatment in comparison with UPDATE and DELETE – it needs row-grained logging to carefully rollback the failed row insertion inside the statement. In comparison, this would lead to a statement failure in INSERT/UPDATE/DELETE/CREATE...SELECT/ALTER TABLE.

            Online ALTER does not allow the replace behavior for the online log application (neither it does for the copy stage as of now), so it should be safe

            nikitamalyavin Nikita Malyavin added a comment - Row-by-row logging is enabled for CREATE...SELECT in select_create::prepare . But it's turned off for IGNORE and REPLACE if (thd->lex->duplicates == DUP_ERROR && !thd->lex->ignore) table->file->extra(HA_EXTRA_BEGIN_ALTER_COPY); git show c411393a844becf91a560ac8e53ab04cb4fb9219   commit c411393a844becf91a560ac8e53ab04cb4fb9219 Author: Marko Mäkelä <marko.makela@mariadb.com> Date: Thu Jan 28 15:26:53 2021 +0200   MDEV-24715 Assertion !node->table->skip_alter_undo in CREATE...REPLACE SELECT In commit 3cef4f8f0fc88ae5bfae4603d8d600ec84cc70a9 (MDEV-515) we inadvertently broke CREATE TABLE...REPLACE SELECT statements by wrongly disabling row-level undo logging. select_create::prepare(): Only invoke extra(HA_EXTRA_BEGIN_ALTER_COPY) if no special treatment of duplicates is needed. REPLACE operation has a special treatment in comparison with UPDATE and DELETE – it needs row-grained logging to carefully rollback the failed row insertion inside the statement. In comparison, this would lead to a statement failure in INSERT/UPDATE/DELETE/CREATE...SELECT/ALTER TABLE. Online ALTER does not allow the replace behavior for the online log application (neither it does for the copy stage as of now), so it should be safe

            The fixes of this and MDEV-33087 may conflict with each other. We would want to only disable the row-level undo logging on the being-altered table, but only enable the MDEV-24621 optimization for the initial copying stage.

            marko Marko Mäkelä added a comment - The fixes of this and MDEV-33087 may conflict with each other. We would want to only disable the row-level undo logging on the being-altered table, but only enable the MDEV-24621 optimization for the initial copying stage.

            People

              nikitamalyavin Nikita Malyavin
              nikitamalyavin Nikita Malyavin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.