您的位置:首页 > 其它

何谓组合事务ID

2015-07-29 16:30 330 查看

Multixacts and Wraparound

Multixact IDs are used to support row locking by multiple transactions. Since there is only limited space in a tuple header to store lock information, that information is encoded as a “multiple transaction ID”, or multixact ID for short, whenever there is more than one transaction concurrently locking a row. Information about which transaction IDs are included in any particular multixact ID is stored separately in the pg_multixact subdirectory, and only the multixact ID appears in the xmax field in the tuple header. Like transaction IDs, multixact IDs are implemented as a 32-bit counter and corresponding storage, all of which requires careful aging management, storage cleanup, and wraparound handling. There is a separate storage area which holds the list of members in each multixact, which also uses a 32-bit counter and which must also be managed.

组合事务用于支持元组被多个事务同时锁定,当多个事务同时并发的锁定了一个元组时,由于元组头部只能记录较为有限的锁信息,锁定同一个元组的多个事务ID被编码为组合事务ID。而具体的哪些事务ID与组合事务ID相关,这部分信息被存放在pg_multixact子目录下,锁定元组的组合事务ID则存放在元组头信息中的xmax字段中。元组头信息中的t_infomask字段与宏定义HEAP_XMAX_IS_MULTI进行与操作即可判定xmax是否为组合事务

define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: