Search in sources :

Example 1 with BPlusTreeRuntimeException

use of org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTreeRuntimeException in project ignite by apache.

the class CacheDataRowAdapter method doInitFromLink.

/**
 * @param link Link.
 * @param sharedCtx Cache shared context.
 * @param coctx Cache object context.
 * @param pageMem Page memory.
 * @param grpId Cache group Id.
 * @param readCacheId {@code true} If need to read cache ID.
 * @param rowData Required row data.
 * @param incomplete Incomplete object.
 * @param skipVer Whether version read should be skipped.
 * @throws IgniteCheckedException If failed.
 */
private void doInitFromLink(long link, GridCacheSharedContext<?, ?> sharedCtx, CacheObjectContext coctx, PageMemory pageMem, int grpId, IoStatisticsHolder statHolder, boolean readCacheId, RowData rowData, @Nullable IncompleteObject<?> incomplete, boolean skipVer) throws IgniteCheckedException {
    assert link != 0 : "link";
    assert key == null : "key";
    long nextLink = link;
    do {
        final long pageId = pageId(nextLink);
        try {
            final long page = pageMem.acquirePage(grpId, pageId, statHolder);
            try {
                // Non-empty data page must not be recycled.
                long pageAddr = pageMem.readLock(grpId, pageId, page);
                assert pageAddr != 0L : nextLink;
                try {
                    DataPageIO io = DataPageIO.VERSIONS.forPage(pageAddr);
                    int itemId = itemId(nextLink);
                    incomplete = readIncomplete(incomplete, sharedCtx, coctx, pageMem.pageSize(), pageMem.realPageSize(grpId), pageAddr, itemId, io, rowData, readCacheId, skipVer);
                    if (incomplete == null || (rowData == KEY_ONLY && key != null))
                        return;
                    nextLink = incomplete.getNextLink();
                } finally {
                    pageMem.readUnlock(grpId, pageId, page);
                }
            } finally {
                pageMem.releasePage(grpId, pageId, page);
            }
        } catch (RuntimeException | AssertionError e) {
            // Collect all pages from first link to pageId.
            long[] pageIds;
            try {
                pageIds = relatedPageIds(grpId, link, pageId, pageMem, statHolder);
            } catch (IgniteCheckedException e0) {
                // Ignore exception if failed to resolve related page ids.
                pageIds = new long[] { pageId };
            }
            throw new BPlusTreeRuntimeException(e, grpId, pageIds);
        }
    } while (nextLink != 0);
    assert isReady() : "ready";
}
Also used : DataPageIO(org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO) BPlusTreeRuntimeException(org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTreeRuntimeException) BPlusTreeRuntimeException(org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTreeRuntimeException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 BPlusTreeRuntimeException (org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTreeRuntimeException)1 DataPageIO (org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO)1