[MDEV-33094] row-by-row logging needs to be disabled for the online ALTER log application stage Created: 2023-12-20  Updated: 2024-01-22

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 11.2
Fix Version/s: 11.2

Type: Bug Priority: Major
Reporter: Nikita Malyavin Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-16329 Engine-independent online ALTER TABLE Closed
Relates
relates to MDEV-33087 ALTER TABLE...ALGORITHM=COPY should b... Confirmed
relates to MDEV-11415 Remove excessive undo logging during ... Closed

 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.



 Comments   
Comment by Nikita Malyavin [ 2023-12-20 ]

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

Comment by Marko Mäkelä [ 2023-12-20 ]

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.

Generated at Thu Feb 08 10:36:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.