/** * @param x Long. * @return String. */ private static String formatPageId(long x) { return U.hexLong(x); }
/** * Constructs a page link by the given page ID and 8-byte words within the page. * * @param pageId Page ID. * @param itemId Item ID. * @return Page link. */ public static long link(long pageId, int itemId) { assert itemId >= 0 && itemId <= MAX_ITEMID_NUM: itemId; assert (pageId >> (FLAG_SIZE + PART_ID_SIZE + PAGE_IDX_SIZE)) == 0 : U.hexLong(pageId); return pageId | (((long)itemId) << (FLAG_SIZE + PART_ID_SIZE + PAGE_IDX_SIZE)); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(SingletonReuseBag.class, this, "pageId", U.hexLong(pageId)); } }
/** * @param grpId Cache group ID. * @param pageId Page ID. * @return {@code True} if checks succeeded. */ private boolean assertKey(int grpId, long pageId) { assert grpId != EMPTY_CACHE_GRP_ID && PageIdUtils.isEffectivePageId(pageId): "grpId=" + grpId + ", pageId=" + U.hexLong(pageId); return true; }
/** {@inheritDoc} */ @Override public DirectMemoryRegion slice(long offset) { if (offset < 0 || offset >= size) throw new IllegalArgumentException("Failed to create a memory region slice [ptr=" + U.hexLong(addr) + ", len=" + size + ", offset=" + offset + ']'); return new UnsafeChunk(addr + offset, size - offset); }
/** {@inheritDoc} */ @Override public DirectMemoryRegion slice(long offset) { if (offset < 0 || offset >= len) throw new IllegalArgumentException("Failed to create a memory region slice [ptr=" + U.hexLong(ptr) + ", len=" + len + ", offset=" + offset + ']'); return new UnsafeChunk(ptr + offset, len - offset); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(RecycleRecord.class, this, "newPageId", U.hexLong(newPageId), "super", super.toString() ); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(SplitExistingPageRecord.class, this, "fwId", U.hexLong(fwdId), "super", super.toString()); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(InitNewPageRecord.class, this, "newPageId", U.hexLong(newPageId), "super", super.toString()); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(PagesListAddPageRecord.class, this, "dataPageId", U.hexLong(dataPageId), "super", super.toString()); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(InsertRecord.class, this, "rightId", U.hexLong(rightId), "super", super.toString()); } }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(PageDeltaRecord.class, this, "pageId", U.hexLong(pageId), "super", super.toString()); } }
/** */ private void checkRootsPageIdFlag(long treeRoot, long reuseListRoot) throws StorageException { if (PageIdUtils.flag(treeRoot) != PageMemory.FLAG_DATA) throw new StorageException("Wrong tree root page id flag: treeRoot=" + U.hexLong(treeRoot) + ", METASTORAGE_CACHE_ID=" + METASTORAGE_CACHE_ID); if (PageIdUtils.flag(reuseListRoot) != PageMemory.FLAG_DATA) throw new StorageException("Wrong reuse list root page id flag: reuseListRoot=" + U.hexLong(reuseListRoot) + ", METASTORAGE_CACHE_ID=" + METASTORAGE_CACHE_ID); }
/** {@inheritDoc} */ @Override public void onBeforeReadLock(int cacheId, long pageId, long page) { if (PRINT_LOCKS) X.println(" onBeforeReadLock: " + U.hexLong(pageId)); // // U.dumpStack(); assertNull(beforeReadLock.put(threadId(), pageId)); }
/** {@inheritDoc} */ @Override public void onReadUnlock(int cacheId, long pageId, long page, long pageAddr) { if (PRINT_LOCKS) X.println(" onReadUnlock: " + U.hexLong(pageId)); checkPageId(pageId, pageAddr); long actual = PageIO.getPageId(pageAddr); assertEquals(Long.valueOf(actual), locks(true).remove(pageId)); }
/** {@inheritDoc} */ @Override public void onWriteUnlock(int cacheId, long pageId, long page, long pageAddr) { if (PRINT_LOCKS) X.println(" onWriteUnlock: " + U.hexLong(pageId)); assertEquals(effectivePageId(pageId), effectivePageId(PageIO.getPageId(pageAddr))); assertEquals(Long.valueOf(pageId), locks(false).remove(pageId)); }
/** * @param pageId Page ID. * @param statHolder Statistics holder to track IO operations. * @return Page absolute pointer. * @throws IgniteCheckedException If failed. */ protected final long acquirePage(long pageId, IoStatisticsHolder statHolder) throws IgniteCheckedException { assert PageIdUtils.flag(pageId) == FLAG_IDX && PageIdUtils.partId(pageId) == INDEX_PARTITION || PageIdUtils.flag(pageId) == FLAG_DATA && PageIdUtils.partId(pageId) <= MAX_PARTITION_ID : U.hexLong(pageId) + " flag=" + PageIdUtils.flag(pageId) + " part=" + PageIdUtils.partId(pageId); return pageMem.acquirePage(grpId, pageId, statHolder); }
/** {@inheritDoc} */ @Override public void insertDataRow(CacheDataRow row, IoStatisticsHolder statHolder) throws IgniteCheckedException { super.insertDataRow(row, statHolder); assert row.key().partition() == PageIdUtils.partId(row.link()) : "Constructed a link with invalid partition ID [partId=" + row.key().partition() + ", link=" + U.hexLong(row.link()) + ']'; }