use of org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseBag in project ignite by apache.
the class AbstractFreeList method removeDataRowByLink.
/**
* {@inheritDoc}
*/
@Override
public void removeDataRowByLink(long link, IoStatisticsHolder statHolder) throws IgniteCheckedException {
assert link != 0;
try {
long pageId = PageIdUtils.pageId(link);
int itemId = PageIdUtils.itemId(link);
ReuseBag bag = new LongListReuseBag();
long nextLink = write(pageId, rmvRow, bag, itemId, FAIL_L, statHolder);
// Can't fail here.
assert nextLink != FAIL_L;
while (nextLink != 0L) {
memMetrics.decrementLargeEntriesPages();
itemId = PageIdUtils.itemId(nextLink);
pageId = PageIdUtils.pageId(nextLink);
nextLink = write(pageId, rmvRow, bag, itemId, FAIL_L, statHolder);
// Can't fail here.
assert nextLink != FAIL_L;
}
reuseList.addForRecycle(bag);
} catch (AssertionError e) {
throw corruptedFreeListException(e);
} catch (IgniteCheckedException | Error e) {
throw e;
} catch (Throwable t) {
throw new CorruptedFreeListException("Failed to remove data by link", t, grpId);
}
}
use of org.apache.ignite.internal.processors.cache.persistence.tree.reuse.ReuseBag in project ignite by apache.
the class PagesPossibleCorruptionDiagnosticTest method testDiagnosticCollectedOnCorruptedPageList.
/**
* Tests page list pages are collected in {@link CorruptedFreeListException}.
*/
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_PAGES_LIST_DISABLE_ONHEAP_CACHING, value = "true")
public void testDiagnosticCollectedOnCorruptedPageList() throws Exception {
IgniteEx ignite = startGrid(0);
ignite.cluster().state(ClusterState.ACTIVE);
IgniteCache<Integer, Integer> cache = ignite.getOrCreateCache(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME).setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL).setAffinity(new RendezvousAffinityFunction(false, 1)));
cache.put(1, 1);
cache.remove(1);
int grpId = cacheGroupId(DEFAULT_CACHE_NAME, null);
IgniteCacheOffheapManager.CacheDataStore dataStore = ignite.context().cache().cacheGroup(grpId).offheap().cacheDataStores().iterator().next();
GridCacheOffheapManager.GridCacheDataStore store = (GridCacheOffheapManager.GridCacheDataStore) dataStore;
AbstractFreeList freeList = store.getCacheStoreFreeList();
ReuseBag bag = new LongListReuseBag();
bag.addFreePage(pageId(0, FLAG_DATA, 10));
bag.addFreePage(pageId(0, FLAG_DATA, 11));
long[] pages = null;
try {
freeList.addForRecycle(bag);
} catch (CorruptedFreeListException e) {
pages = e.pageIds();
}
assertNotNull(pages);
}
Aggregations