Skip to content
  • Andrei Elkin's avatar
    71995955
    commit c2718152b0e6d00dba8d791cf3866c7315418a85 · 71995955
    Andrei Elkin authored
    Author: Andrei Elkin <andrei.elkin@oracle.com>
    Date:   Fri Nov 25 15:17:17 2016 +0200
    
        WL#9175 Correct recovery of DDL statements/transactions by binary log
    
        The patch consists of two parts implementing the WL agenda which is
        is to provide crash-safety for DDL.
        That is a server (a general one, master or slave) must be able to recover
        from crash to commit or rollback every DDL command that was in progress
        on the eve of crash.
    
        The Commit decision is done to commands that had reached
        Engine-prepared status and got successfully logged into binary log.
        Otherwise they are rolled back.
    
        In order to achieve the goal some refinements are done to the binlogging
        mechanism, minor addition is done to the server recovery module and some changes
        applied to the slave side.
    
        The binary log part includes Query-log-event which is made to contain xid
        that is a key item at server recovery. The recovery now is concern with it along
        with its standard location in Xid_log_event.
    
        The first part deals with the ACL DDL sub-class and
        TRIGGER related queries are fully 2pc-capable. It constructs
        the WL's framework which is proved on these subclasses.
        It also specifies how to cover the rest of DDLs by the WL's framework.
        For those not 2pc-ready DDL cases, sometimes "stub" tests are prepared
        to be refined by responsible worklogs.
    
        Take a few notes to the low-level details of implementation.
    
        Note #1.
    
        Tagging by xid number is done to the exact 2pc-capable DDL subclass.
        For DDL:s that will be ready for xiding in future, there is a tech specification
        how to do so.
    
        Note #2.
    
        By virtue of existing mechanisms, the slave applier augments the DDL
        transaction incorporating the slave info table update and the
        Gtid-executed table (either one optionally) at time of the DDL is
        ready for the final commit.
        When for filtering reason the DDL skips committing at its regular
        time, the augmented transaction would still be not empty consisting of
        only the added statements, and it would have to be committed by
        top-level slave specific functions through Log_event::do_update_pos().
    
        To aid this process Query_log_event::has_committed is introduced.
    
        Note #3 (QA, please read this.)
    
        Replication System_table interface that is employed by handler of TABLE type slave info
        had to be refined in few places.
    
        Note #4 (runtime code).
    
        While trying to lessen the footprint to the runtime server code few
        concessions had to be conceded. These include changes to
        ha_commit_trans()
        to invoke new pre_commit() and post_commit(), and post_rollback() hooks
        due to the slave extra statement.
    
        -------------------------------------------------------------------
    
        The 2nd part patch extends the basic framework,
        xidifies the rest of DDL commands that are
        (at least) committable at recovery. At the moment those include
        all Data Definition Statements except ones related to
        VIEWs, STORED Functions and Procedures.
    
        DDL Query is recoverable for these subclasses when it has been
        recorded into the binary log and was discovered there at the server
        restart, quite compatible with the DML algorithm.
        However a clean automatic rollback can't be provided for some
        of the commands and the user would have to complete recovery
        manually.
    71995955
    commit c2718152b0e6d00dba8d791cf3866c7315418a85
    Andrei Elkin authored
    Author: Andrei Elkin <andrei.elkin@oracle.com>
    Date:   Fri Nov 25 15:17:17 2016 +0200
    
        WL#9175 Correct recovery of DDL statements/transactions by binary log
    
        The patch consists of two parts implementing the WL agenda which is
        is to provide crash-safety for DDL.
        That is a server (a general one, master or slave) must be able to recover
        from crash to commit or rollback every DDL command that was in progress
        on the eve of crash.
    
        The Commit decision is done to commands that had reached
        Engine-prepared status and got successfully logged into binary log.
        Otherwise they are rolled back.
    
        In order to achieve the goal some refinements are done to the binlogging
        mechanism, minor addition is done to the server recovery module and some changes
        applied to the slave side.
    
        The binary log part includes Query-log-event which is made to contain xid
        that is a key item at server recovery. The recovery now is concern with it along
        with its standard location in Xid_log_event.
    
        The first part deals with the ACL DDL sub-class and
        TRIGGER related queries are fully 2pc-capable. It constructs
        the WL's framework which is proved on these subclasses.
        It also specifies how to cover the rest of DDLs by the WL's framework.
        For those not 2pc-ready DDL cases, sometimes "stub" tests are prepared
        to be refined by responsible worklogs.
    
        Take a few notes to the low-level details of implementation.
    
        Note #1.
    
        Tagging by xid number is done to the exact 2pc-capable DDL subclass.
        For DDL:s that will be ready for xiding in future, there is a tech specification
        how to do so.
    
        Note #2.
    
        By virtue of existing mechanisms, the slave applier augments the DDL
        transaction incorporating the slave info table update and the
        Gtid-executed table (either one optionally) at time of the DDL is
        ready for the final commit.
        When for filtering reason the DDL skips committing at its regular
        time, the augmented transaction would still be not empty consisting of
        only the added statements, and it would have to be committed by
        top-level slave specific functions through Log_event::do_update_pos().
    
        To aid this process Query_log_event::has_committed is introduced.
    
        Note #3 (QA, please read this.)
    
        Replication System_table interface that is employed by handler of TABLE type slave info
        had to be refined in few places.
    
        Note #4 (runtime code).
    
        While trying to lessen the footprint to the runtime server code few
        concessions had to be conceded. These include changes to
        ha_commit_trans()
        to invoke new pre_commit() and post_commit(), and post_rollback() hooks
        due to the slave extra statement.
    
        -------------------------------------------------------------------
    
        The 2nd part patch extends the basic framework,
        xidifies the rest of DDL commands that are
        (at least) committable at recovery. At the moment those include
        all Data Definition Statements except ones related to
        VIEWs, STORED Functions and Procedures.
    
        DDL Query is recoverable for these subclasses when it has been
        recorded into the binary log and was discovered there at the server
        restart, quite compatible with the DML algorithm.
        However a clean automatic rollback can't be provided for some
        of the commands and the user would have to complete recovery
        manually.
Loading