use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.
the class CacheDiagnosticManager method start0.
/**
* {@inheritDoc}
*/
@Override
protected void start0() throws IgniteCheckedException {
super.start0();
String name = U.maskForFileName(cctx.kernalContext().pdsFolderResolver().resolveFolders().consistentId().toString());
pageLockTrackerManager = new PageLockTrackerManager(log, name);
pageLockTrackerManager.start();
registerMetricsMBean(cctx.gridConfig(), MBEAN_GROUP, PageLockTrackerMXBean.MBEAN_NAME, pageLockTrackerManager.mxBean(), PageLockTrackerMXBean.class);
}
use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.
the class BPlusTreeReuseSelfTest method createReuseList.
/**
* {@inheritDoc}
*/
@Override
protected ReuseList createReuseList(int cacheId, PageMemory pageMem, long rootId, boolean initNew) throws IgniteCheckedException {
PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(new TestPageLockListener());
return new TestReuseList(cacheId, "test", pageMem, rootId, pageLockTrackerManager, new GridTestKernalContext(log), initNew);
}
use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.
the class CacheFreeListSelfTest method createFreeList.
/**
* @param pageSize Page size.
* @return Free list.
* @throws Exception If failed.
*/
private FreeList<CacheDataRow> createFreeList(int pageSize) throws Exception {
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB).setMaxSize(1024 * MB);
pageMem = createPageMemory(pageSize, plcCfg);
long metaPageId = pageMem.allocatePage(1, 1, PageIdAllocator.FLAG_DATA);
IgniteConfiguration cfg = new IgniteConfiguration().setMetricExporterSpi(new NoopMetricExporterSpi());
GridTestKernalContext ctx = new GridTestKernalContext(new GridTestLog4jLogger(), cfg);
ctx.add(new GridMetricManager(ctx));
ctx.add(new PerformanceStatisticsProcessor(ctx));
DataRegionMetricsImpl regionMetrics = new DataRegionMetricsImpl(plcCfg, ctx);
DataRegion dataRegion = new DataRegion(pageMem, plcCfg, regionMetrics, new NoOpPageEvictionTracker());
PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(PageLockTrackerManager.NOOP_LSNR);
return new CacheFreeList(1, "freelist", dataRegion, null, metaPageId, true, pageLockTrackerManager, new GridTestKernalContext(log), null, PageIdAllocator.FLAG_IDX);
}
use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.
the class IndexStorageSelfTest method metaAllocation.
/**
* @throws Exception If failed.
*/
private void metaAllocation() throws Exception {
PageMemory mem = memory(true);
int[] cacheIds = new int[] { 1, "partitioned".hashCode(), "replicated".hashCode() };
Map<Integer, Map<String, RootPage>> allocatedIdxs = new HashMap<>();
mem.start();
try {
final Map<Integer, IndexStorageImpl> storeMap = new HashMap<>();
for (int i = 0; i < 1_000; i++) {
int cacheId = cacheIds[i % cacheIds.length];
Map<String, RootPage> idxMap = allocatedIdxs.get(cacheId);
if (idxMap == null) {
idxMap = new HashMap<>();
allocatedIdxs.put(cacheId, idxMap);
}
String idxName;
do {
idxName = randomName();
} while (idxMap.containsKey(idxName));
IndexStorageImpl metaStore = storeMap.get(cacheId);
if (metaStore == null) {
PageLockTrackerManager pageLockTrackerManager = mock(PageLockTrackerManager.class);
when(pageLockTrackerManager.createPageLockTracker(anyString())).thenReturn(NOOP_LSNR);
metaStore = new IndexStorageImpl("indexStorageTree", mem, null, new AtomicLong(), cacheId, false, PageIdAllocator.INDEX_PARTITION, PageMemory.FLAG_IDX, null, mem.allocatePage(cacheId, PageIdAllocator.INDEX_PARTITION, PageMemory.FLAG_IDX), true, null, pageLockTrackerManager);
storeMap.put(cacheId, metaStore);
}
final RootPage rootPage = metaStore.allocateIndex(idxName);
assertTrue(rootPage.isAllocated());
idxMap.put(idxName, rootPage);
}
for (int cacheId : cacheIds) {
Map<String, RootPage> idxMap = allocatedIdxs.get(cacheId);
for (Map.Entry<String, RootPage> entry : idxMap.entrySet()) {
String idxName = entry.getKey();
FullPageId rootPageId = entry.getValue().pageId();
final RootPage rootPage = storeMap.get(cacheId).allocateIndex(idxName);
assertEquals("Invalid root page ID restored [cacheId=" + cacheId + ", idxName=" + idxName + ']', rootPageId, rootPage.pageId());
assertFalse("Root page already allocated [cacheId=" + cacheId + ", idxName=" + idxName + ']', rootPage.isAllocated());
}
}
} finally {
mem.stop(true);
}
}
use of org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker.PageLockTrackerManager in project ignite by apache.
the class BPlusTreeReplaceRemoveRaceTest method beforeTest.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTest() throws Exception {
pageMem = createPageMemory();
lockTrackerManager = new PageLockTrackerManager(log, "testTreeManager");
lockTrackerManager.start();
}
Aggregations