innodb 回滚段内存结构

来源:互联网 发布:电脑办公软件分类 编辑:程序博客网 时间:2024/05/16 18:06

/* The rollback segment memory object */struct trx_rseg_t{/**********************************************************/        ulintid;/*!rollback segment id == the index of its slot in the trx system file copy */        ulintspace;/*!space where the rollback segment is header is placed */        ulintpage_no;/* page number of the rollback segment header ,即slot所在页页号*//*--------------------------------------------------------*//* Fields for update undo logs */UT_LIST_BASE_NODE_T(trx_undo_t) update_undo_list;/* List of update undo logs */UT_LIST_BASE_NODE_T(trx_undo_t) update_undo_cached;/* List of update undo log segmentscached for fast reuse *//*--------------------------------------------------------*//* Fields for insert undo logs */UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_list;/* List of insert undo logs */UT_LIST_BASE_NODE_T(trx_undo_t) insert_undo_cached;/* List of insert undo log segmentscached for fast reuse *//*--------------------------------------------------------*/        //undo log 页ulintlast_page_no;/*!< Page number of the last not yetpurged log header in the history list; FIL_NULL if all list purged */ulintlast_offset;/*!< Byte offset of the last not yet purged log header */trx_id_tlast_trx_no;/*!< Transaction number of the last not yet purged log */iboollast_del_marks;/*!< TRUE if the last not yet purged log needs purging */};

1、将undo页插入historylist时,如果是第一次插入,即该回滚段最早的事务,将相关信息保存到回滚段的内存结构中,即下面几个成员保存的是回滚段中最老事务的信息:

 trx_commit->trx_commit_low->trx_write_serialisation_history->trx_undo_update_cleanup->trx_purge_add_update_undo_to_history:  if (rseg->last_page_no ==FIL_NULL) {        rseg->last_page_no= undo->hdr_page_no;//undo页的页号        rseg->last_offset= undo->hdr_offset;//undo log header的偏移        rseg->last_trx_no= trx->no;//最大事务ID,commit in memory之前的所有事务        rseg->last_del_marks= undo->del_marks;//只在update中  }


0 0
原创粉丝点击