赞
踩
这就是多版本中在事务要读取元组时,进行判断的事务快照,和postgresql中的snapshot一样,就是名不一样,都是把事务启动时,还有运行的事务ID记录在一个列表里面,事务ID在这之间的还需要判断,比这区间小的认为是已提交的,比这区间大的认为是看不到的
/* 多版本的限制 FACT A: Cursor read view on a secondary index sees only committed versions FACT B: Cursor read view on a clustered index sees only committed versions FACT C: Purge does not remove any delete marked row that is visible */ /** Read view lists the trx ids of those transactions for which a consistent read should not see the modifications to the database. */ struct read_view_struct{ ulint type; /*!< VIEW_NORMAL, VIEW_HIGH_GRANULARITY */ undo_no_t undo_no;/*!< 0 or if type is VIEW_HIGH_GRANULARITY transaction undo_no when this high-granularity consistent read view was created */ trx_id_t low_limit_no; /*!< The view does not need to see the undo logs for transactions whose transaction number is strictly smaller (<) than this value: they can be removed in purge if not needed by other views */ trx_id_t low_limit_id; /*!< The read should not see any transaction with trx id >= this value. In other words, this is the "high water mark". 这个是最大 */ trx_id_t up_limit_id; /*!< The read should see all trx ids which are strictly smaller (<) than this value. In other words, this is the "low water mark". 这个是最小*/ ulint n_trx_ids; /*!< Number of cells in the trx_ids array */ trx_id_t* trx_ids;/*!< Additional trx ids which the read should not see: typically, these are the active transactions at the time when the read is serialized, except the reading transaction itself; the trx ids in this array are in a descending order. These trx_ids should be between the "low" and "high" water marks, that is, up_limit_id and low_limit_id. */ trx_id_t creator_trx_id; /*!< trx id of creating transaction, or 0 used in purge */ UT_LIST_NODE_T(read_view_t) view_list; /*!< List of read views in trx_sys */ };