mysql 指针_MySQL的B+tree结构的叶子节点之间的指针到底是单向的还是双向的?

/** Set next page@param[in]next_page_nonext page no */

void PageBulk::setNext(page_no_t next_page_no) {

btr_page_set_next(m_page, nullptr, next_page_no, m_mtr);

}

/** Set previous page@param[in]prev_page_noprevious page no */

void PageBulk::setPrev(page_no_t prev_page_no) {

btr_page_set_prev(m_page, nullptr, prev_page_no, m_mtr);

}

双向

/** Sets the previous index page field. */

UNIV_INLINE

void btr_page_set_prev(

page_t *page, /*!< in: index page */

page_zip_des_t *page_zip, /*!< in: compressed page whose uncompressed

part will be updated, or NULL */

page_no_t prev, /*!< in: previous page number */

mtr_t *mtr) /*!< in: mini-transaction handle */

{

ut_ad(page != NULL);

ut_ad(mtr != NULL);

if (page_zip) {

mach_write_to_4(page + FIL_PAGE_PREV, prev);

page_zip_write_header(page_zip, page + FIL_PAGE_PREV, 4, mtr);

} else {

mlog_write_ulint(page + FIL_PAGE_PREV, prev, MLOG_4BYTES, mtr);

}

}

/** Sets the next index page field. */

UNIV_INLINE

void btr_page_set_next(

page_t *page, /*!< in: index page */

page_zip_des_t *page_zip, /*!< in: compressed page whose uncompressed

part will be updated, or NULL */

page_no_t next, /*!< in: next page number */

mtr_t *mtr) /*!< in: mini-transaction handle */

{

ut_ad(page != NULL);

ut_ad(mtr != NULL);

if (page_zip) {

mach_write_to_4(page + FIL_PAGE_NEXT, next);

page_zip_write_header(page_zip, page + FIL_PAGE_NEXT, 4, mtr);

} else {

mlog_write_ulint(page + FIL_PAGE_NEXT, next, MLOG_4BYTES, mtr);

}

}

双向更新

/** if there is a 'natural' predecessor of the page, its offset.

Otherwise FIL_NULL. This field is not set on BLOB pages, which are stored as a

singly-linked list. See also FIL_PAGE_NEXT. */

#define FIL_PAGE_PREV 8

/** On page 0 of the tablespace, this is the server version ID */

#define FIL_PAGE_SRV_VERSION 8

/** if there is a 'natural' successor of the page, its offset. Otherwise

FIL_NULL. B-tree index pages(FIL_PAGE_TYPE contains FIL_PAGE_INDEX) on the

same PAGE_LEVEL are maintained as a doubly linked list via FIL_PAGE_PREV and

FIL_PAGE_NEXT in the collation order of the smallest user record on each

page. */

#define FIL_PAGE_NEXT 12

注意:This field is not set on BLOB pages, which are stored as a singly-linked list. See also FIL_PAGE_NEXT. */

也就是BLOB页是单向的,

页:

数据页

Undo页

系统页

事务数据页

插入缓冲位图页

未压缩二进制大对象页

压缩二进制大对象页

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值