0
点赞
收藏
分享

微信扫一扫

mvcc相关:innoDB之read view数据格式

源码

struct read_view_t{
	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 read-write
				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 */
};

前置知识

每开启一个事务,数据库会自动为之分配一个tx_id,它是线性增长的,也就是越后开启的事务,tx_id越大。

trx_ids

创建该read view 时活跃的事务id数组,不包含创建该read view的事务id(except the reading transaction itself)。

low_limit_id

活跃id的最大值+1。虽然是low,但数值确实最大的, 其实就是max_trx_id

up_limit_id

活跃事务id的最小值,最早创建的事务的id,其实就是min_trx_id。

creator_trx_id

创建该read view的事务id

举报

相关推荐

0 条评论