InnoDB---UNDO log and rollback

    The way transactions are linked to physical storage such as system table spaces and temporary table spaces through trx_rsegs_t is as follows:

/** Rollback segments assigned to a transaction for undo logging. */

struct trx_rsegs_t {

    /** undo log ptr holding reference to a rollback segment that resides in

        system/undo tablespace used for undo logging of tables that needs to be recovered on crash. */

    trx_undo_ptr_t     m_redo;    // System UNDO table space

 

    /** undo log ptr holding reference to a rollback segment that resides in

        temp tablespace used for undo logging of tables that doesn't need to be recovered on crash. */

    trx_undo_ptr_t     m_noredo; // System temporary table space

};

    The relationship between physical storage such as system table space and temporary table space and UNDO log is as follows:

/** Represents an instance of rollback segment along with its state variables.*/

struct trx_undo_ptr_t {  

    // Identify the rollback segment assigned to the transaction, thus establishing a relationship between the transaction and the rollback segment. Then it is linked to physical storage such as system table space and temporary table space through trx_rsegs_t

    trx_rseg_t*     rseg ;//          Point to rollback segment

    trx_undo_t*    insert_undo;    /*!< pointer to the insert undo log, or NULL if no inserts performed yet */  //事务指向insert undo log

    trx_undo_t*    update_undo;    /*!< pointer to the update undo log, or ULL if no update performed yet */    //事务指向update undo log

};

    The rollback segment information is as follows:

/** The rollback segment memory object */

struct trx_rseg_t {

    ulint     id;       // Identification of the rollback segment

...

    ulint     space;    // The location of the rollback segment header information in the table space, the table space identifier

    ulint     page_no; // The location and page number of the rollback segment header information in the table space

 

    page_size_t    page_size; /** page size of the relevant tablespace */

    ulint          max_size; /** maximum allowed size in pages */   

    ulint          curr_size; /** current size in pages */

...

    /** The UODO log generated by executing the UPDATE operation, including the UODO information generated during the process of first deletion and then insertion . After the transaction is completed, the information is still retained for consistent reading under the MVCC mechanism */ 

    /** List of update undo logs */

    UT_LIST_BASE_NODE_T(trx_undo_t)    update_undo_list;

    /** List of update undo log segments cached for fast reuse */

    UT_LIST_BASE_NODE_T(trx_undo_t)    update_undo_cached;

 

    /* UODO log generated by executing INSERT operation . This information is temporary and will be cleared after the transaction ends */

    /** List of insert undo logs */

    UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_list;

    /** List of insert undo log segments cached for fast reuse */

    UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_cached;

...

};

Guess you like

Origin blog.csdn.net/fly2nn/article/details/61924836