函数page_rec_get_next_const

时间:2023-03-09 21:49:11
函数page_rec_get_next_const
/************************************************************//**
Gets the pointer to the next record on the page.
@return    pointer to next record */
UNIV_INLINE
const rec_t*
page_rec_get_next_const(
/*====================*/
    const rec_t*    rec)    /*!< in: pointer to record */
{
    return(page_rec_get_next_low(rec, page_rec_is_comp(rec)));
}

/************************************************************//**
TRUE if the record is on a page in compact format.
@return    nonzero if in compact format */
UNIV_INLINE
ulint
page_rec_is_comp(
/*=============*/
    const rec_t*    rec)    /*!< in: record */
{
    return(page_is_comp(page_align(rec)));
}

/************************************************************//**
Determine whether the page is in new-style compact format.
@return nonzero if the page is in compact format, zero if it is in
old-style format */
UNIV_INLINE
ulint
page_is_comp(
/*=========*/
    const page_t*    page)    /*!< in: index page */
{
    return(UNIV_EXPECT(page_header_get_field(page, PAGE_N_HEAP) & 0x8000,
               0x8000));
}

/************************************************************//**
Gets the pointer to the next record on the page.
@return    pointer to next record */
UNIV_INLINE
const rec_t*
page_rec_get_next_low(
/*==================*/
    const rec_t*    rec,    /*!< in: pointer to record */
    ulint        comp)    /*!< in: nonzero=compact page layout */
{
    ulint        offs;
    const page_t*    page;

    ut_ad(page_rec_check(rec));

    page = page_align(rec);

    offs = rec_get_next_offs(rec, comp);

    if (UNIV_UNLIKELY(offs >= UNIV_PAGE_SIZE)) {
        fprintf(stderr,
            "InnoDB: Next record offset is nonsensical %lu"
            " in record at offset %lu\n"
            "InnoDB: rec address %p, space id %lu, page %lu\n",
            (ulong)offs, (ulong) page_offset(rec),
            (void*) rec,
            (ulong) page_get_space_id(page),
            (ulong) page_get_page_no(page));
        buf_page_print(page, , );

        ut_error;
    }

    )) {

        return(NULL);
    }

    return(page + offs);
}