Class FullPageId


  • public class FullPageId
    extends Object
    Compound object used to address a page in the global page space.

    Page ID structure

    Generally, a full page ID consists of a cache ID and page ID. A page ID consists of page index (32 bits), partition ID (16 bits) and flags. Higher 8 bits of page ID are unused and reserved to address entries inside data pages or page ID rotation.

    Partition ID 0xFFFF is reserved for index pages.

    The structure of a page ID is shown in the diagram below:

     +---------+-----------+------------+--------------------------+
     | 8 bits  |   8 bits  |  16 bits   |         32 bits          |
     +---------+-----------+------------+--------------------------+
     |  OFFSET |   FLAGS   |PARTITION ID|       PAGE INDEX         |
     +---------+-----------+------------+--------------------------+
     

    Page ID rotation

    There are scenarios when we reference one page (B) from within another page (A) by page ID. It is also possible that this first page (B) is concurrently reused for a different purpose. In this case we should have a mechanism to determine that the reference from page (A) to page (B) is no longer valid. This is ensured by page ID rotation - together with page's (B) ID we should write some value that is incremented each time a page is reused (page ID rotation). This ID should be verified after page read and a page should be discarded if full ID is different.

    Effective page ID is page ID with zeroed bits used for page ID rotation.

    • Field Detail

      • NULL_PAGE

        public static final FullPageId NULL_PAGE
    • Constructor Detail

      • FullPageId

        public FullPageId​(long pageId,
                          int grpId)
        Parameters:
        pageId - Page ID.
        grpId - Cache group ID.
    • Method Detail

      • hashCode

        public static int hashCode​(int grpId,
                                   long pageId)
        Parameters:
        grpId - Cache group ID.
        pageId - Page ID.
        Returns:
        Hash code.
      • pageId

        public long pageId()
        Returns:
        Page ID.
      • effectivePageId

        public long effectivePageId()
        Returns:
        Effective page ID.
      • groupId

        public int groupId()
        Returns:
        Cache group ID.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object