org.apache.ignite.internal.processors.cache.persistence.tree.io

## Class TrackingPageIO

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO
  - - org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO

    public class TrackingPageIO
    extends PageIO

We use dedicated page for tracking pages updates. Also we divide such 'tracking' pages on two half, first is used for check that page was changed or not (during incremental snapshot), second - to accumulate changed for next snapshot. You cannot test change for not started snapshot! because it will cause of preparation for snapshot. Implementation. For each page there is own bit in both half. Tracking page is used for tracking N page after it. N depends on page size (how many bytes we can use for tracking). +-----------------------------------------+-----------------------------------------+ | left half | right half | +---------+----------+----+------------------------------------+----+------------------------------------+ | HEADER | Last |size| |size| | | |SnapshotId|2b. | tracking bits |2b. | tracking bits | +---------+----------+----+------------------------------------+----+------------------------------------+

### Field Summary

Fields
`static int` `BITMAP_OFFSET` Bitmap offset.
`static int` `COUNT_OF_EXTRA_PAGE` Count of extra page.
`static int` `LAST_SNAPSHOT_TAG_OFFSET` Last snapshot offset.
`static int` `SIZE_FIELD_OFFSET` Size field offset.
`static int` `SIZE_FIELD_SIZE` 'Size' field size.
`static IOVersions<TrackingPageIO>` `VERSIONS`

### Fields inherited from class org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO

`COMMON_HEADER_END, CRC_OFF, MAX_PAYLOAD_SIZE, PAGE_ID_OFF, T_BPLUS_META, T_CACHE_ID_AWARE_DATA_REF_INNER, T_CACHE_ID_AWARE_DATA_REF_LEAF, T_CACHE_ID_AWARE_PENDING_REF_INNER, T_CACHE_ID_AWARE_PENDING_REF_LEAF, T_DATA, T_DATA_METASTORAGE, T_DATA_REF_INNER, T_DATA_REF_LEAF, T_DATA_REF_METASTORAGE_INNER, T_DATA_REF_METASTORAGE_LEAF, T_H2_EX_REF_INNER_END, T_H2_EX_REF_INNER_START, T_H2_EX_REF_LEAF_END, T_H2_EX_REF_LEAF_START, T_H2_REF_INNER, T_H2_REF_LEAF, T_META, T_METASTORE_INNER, T_METASTORE_LEAF, T_PAGE_LIST_META, T_PAGE_LIST_NODE, T_PAGE_UPDATE_TRACKING, T_PART_CNTRS, T_PART_META, T_PENDING_REF_INNER, T_PENDING_REF_LEAF, TYPE_OFF, VER_OFF`

### Constructor Summary

Constructors
`protected` `TrackingPageIO(int ver)`

### Method Summary

All Methods Instance Methods Concrete Methods
`short` `countOfChangedPage(ByteBuffer buf, long snapshotTag, int pageSize)`
`int` `countOfPageToTrack(int pageSize)`
`Long` `findNextChangedPage(ByteBuffer buf, long start, long curSnapshotTag, long lastSuccessfulSnapshotTag, int pageSize)`
`boolean` `markChanged(ByteBuffer buf, long pageId, long nextSnapshotTag, long lastSuccessfulSnapshotTag, int pageSize)` Will mark pageId as changed for next (!)
`protected void` `printPage(long addr, int pageSize, GridStringBuilder sb)`
`long` `trackingPageFor(long pageId, int pageSize)`
`boolean` `wasChanged(ByteBuffer buf, long pageId, long curSnapshotTag, long lastSuccessfulSnapshotTag, int pageSize)` Check that pageId was marked as changed between previous snapshot finish and current snapshot start.

### Methods inherited from class org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO

`getBPlusIO, getBPlusIO, getCrc, getCrc, getInnerVersions, getLeafVersions, getPageId, getPageId, getPageIO, getPageIO, getType, getType, getType, getVersion, getVersion, getVersion, initNewPage, isDataPageType, printPage, registerH2, registerH2ExtraInner, registerH2ExtraLeaf, registerTest, setCrc, setCrc, setPageId, setType, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### VERSIONS

    public static final IOVersions<TrackingPageIO> VERSIONS

#### LAST_SNAPSHOT_TAG_OFFSET

    public static final int LAST_SNAPSHOT_TAG_OFFSET

Last snapshot offset.

See Also:
  Constant Field Values

#### SIZE_FIELD_OFFSET

    public static final int SIZE_FIELD_OFFSET

Size field offset.

See Also:
  Constant Field Values

#### SIZE_FIELD_SIZE

    public static final int SIZE_FIELD_SIZE

'Size' field size.

See Also:
  Constant Field Values

#### BITMAP_OFFSET

    public static final int BITMAP_OFFSET

Bitmap offset.

See Also:
  Constant Field Values

#### COUNT_OF_EXTRA_PAGE

    public static final int COUNT_OF_EXTRA_PAGE

Count of extra page.

See Also:
  Constant Field Values

### Constructor Detail

#### TrackingPageIO

    protected TrackingPageIO(int ver)

Parameters:
  `ver` - Page format version.

### Method Detail

#### markChanged

    public boolean markChanged(ByteBuffer buf,
                               long pageId,
                               long nextSnapshotTag,
                               long lastSuccessfulSnapshotTag,
                               int pageSize)

Will mark pageId as changed for next (!) snapshotId

Parameters:
  `buf` - Buffer.
  `pageId` - Page id.
  `nextSnapshotTag` - tag of next snapshot.
  `pageSize` - Page size.

#### wasChanged

    public boolean wasChanged(ByteBuffer buf,
                              long pageId,
                              long curSnapshotTag,
                              long lastSuccessfulSnapshotTag,
                              int pageSize)

Check that pageId was marked as changed between previous snapshot finish and current snapshot start.

Parameters:
  `buf` - Buffer.
  `pageId` - Page id.
  `curSnapshotTag` - Snapshot tag.
  `lastSuccessfulSnapshotTag` - Last successful snapshot id.
  `pageSize` - Page size.

#### countOfChangedPage

    public short countOfChangedPage(ByteBuffer buf,
                                    long snapshotTag,
                                    int pageSize)

Parameters:
  `buf` - Buffer.
  `snapshotTag` - Snapshot tag.
  `pageSize` - Page size.
Returns:
  count of pages which were marked as change for given snapshotTag

#### trackingPageFor

    public long trackingPageFor(long pageId,
                                int pageSize)

Parameters:
  `pageId` - Page id.
  `pageSize` - Page size.
Returns:
  pageId of tracking page which set pageId belongs to

#### countOfPageToTrack

    public int countOfPageToTrack(int pageSize)

Parameters:
  `pageSize` - Page size.
Returns:
  how many page we can track with 1 page

#### findNextChangedPage

    @Nullable
    public Long findNextChangedPage(ByteBuffer buf,
                                              long start,
                                              long curSnapshotTag,
                                              long lastSuccessfulSnapshotTag,
                                              int pageSize)

Parameters:
  `buf` - Buffer.
  `start` - Start.
  `curSnapshotTag` - Snapshot id.
  `lastSuccessfulSnapshotTag` - Last successful snapshot id.
  `pageSize` - Page size.
Returns:
  set pageId if it was changed or next closest one, if there is no changed page `null` will be returned

#### printPage

    protected void printPage(long addr,
                             int pageSize,
                             GridStringBuilder sb)
                      throws IgniteCheckedException

Specified by:
  `printPage` in class `PageIO`
Parameters:
  `addr` - Address.
  `pageSize` - Page size.
  `sb` - Sb.
Throws:
  `IgniteCheckedException`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.4.0
Release Date | : March 5 2018