Search in sources :

Example 1 with HeapBufferAllocator

use of org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator in project asterixdb by apache.

the class InMemoryBTreeRunner method init.

protected void init(int pageSize, int numPages, ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories) throws HyracksDataException {
    bufferCache = new VirtualBufferCache(new HeapBufferAllocator(), pageSize, numPages);
    TypeAwareTupleWriterFactory tupleWriterFactory = new TypeAwareTupleWriterFactory(typeTraits);
    ITreeIndexFrameFactory leafFrameFactory = new BTreeNSMLeafFrameFactory(tupleWriterFactory);
    ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(tupleWriterFactory);
    IPageManager freePageManager = new VirtualFreePageManager(bufferCache);
    btree = new BTree(bufferCache, new TransientFileMapManager(), freePageManager, interiorFrameFactory, leafFrameFactory, cmpFactories, typeTraits.length, file);
}
Also used : BTreeNSMLeafFrameFactory(org.apache.hyracks.storage.am.btree.frames.BTreeNSMLeafFrameFactory) IPageManager(org.apache.hyracks.storage.am.common.api.IPageManager) HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) VirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache) TypeAwareTupleWriterFactory(org.apache.hyracks.storage.am.common.tuples.TypeAwareTupleWriterFactory) BTree(org.apache.hyracks.storage.am.btree.impls.BTree) BTreeNSMInteriorFrameFactory(org.apache.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory) ITreeIndexFrameFactory(org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory) VirtualFreePageManager(org.apache.hyracks.storage.am.lsm.common.freepage.VirtualFreePageManager) TransientFileMapManager(org.apache.hyracks.storage.common.file.TransientFileMapManager)

Example 2 with HeapBufferAllocator

use of org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator in project asterixdb by apache.

the class TestStorageManagerComponentHolder method getBufferCache.

public static synchronized IBufferCache getBufferCache(INCServiceContext ctx) {
    if (bufferCache == null) {
        ICacheMemoryAllocator allocator = new HeapBufferAllocator();
        IPageReplacementStrategy prs = new ClockPageReplacementStrategy(allocator, pageSize, numPages);
        IFileMapProvider fileMapProvider = getFileMapProvider();
        bufferCache = new BufferCache(ctx.getIoManager(), prs, new DelayPageCleanerPolicy(1000), (IFileMapManager) fileMapProvider, maxOpenFiles, threadFactory);
    }
    return bufferCache;
}
Also used : IFileMapProvider(org.apache.hyracks.storage.common.file.IFileMapProvider) HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) DelayPageCleanerPolicy(org.apache.hyracks.storage.common.buffercache.DelayPageCleanerPolicy) ICacheMemoryAllocator(org.apache.hyracks.storage.common.buffercache.ICacheMemoryAllocator) BufferCache(org.apache.hyracks.storage.common.buffercache.BufferCache) IBufferCache(org.apache.hyracks.storage.common.buffercache.IBufferCache) IFileMapManager(org.apache.hyracks.storage.common.file.IFileMapManager) IPageReplacementStrategy(org.apache.hyracks.storage.common.buffercache.IPageReplacementStrategy) ClockPageReplacementStrategy(org.apache.hyracks.storage.common.buffercache.ClockPageReplacementStrategy)

Example 3 with HeapBufferAllocator

use of org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator in project asterixdb by apache.

the class TestVirtualBufferCacheProvider method getVirtualBufferCaches.

@Override
public List<IVirtualBufferCache> getVirtualBufferCaches(INCServiceContext ctx, FileReference fileRef) throws HyracksDataException {
    List<IVirtualBufferCache> vbcs = new ArrayList<>();
    for (int i = 0; i < 2; i++) {
        IVirtualBufferCache vbc = new VirtualBufferCache(new HeapBufferAllocator(), pageSize, numPages / 2);
        vbcs.add(vbc);
    }
    return vbcs;
}
Also used : HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) VirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) ArrayList(java.util.ArrayList)

Example 4 with HeapBufferAllocator

use of org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator in project asterixdb by apache.

the class LSMInvertedIndexTestHarness method setUp.

public void setUp() throws HyracksDataException {
    ioManager = TestStorageManagerComponentHolder.getIOManager();
    ioDeviceId = 0;
    onDiskDir = ioManager.getIODevices().get(ioDeviceId).getMount() + sep + "lsm_invertedindex_" + simpleDateFormat.format(new Date()) + sep;
    ctx = TestUtils.create(getHyracksFrameSize());
    TestStorageManagerComponentHolder.init(diskPageSize, diskNumPages, diskMaxOpenFiles);
    diskBufferCache = TestStorageManagerComponentHolder.getBufferCache(ctx.getJobletContext().getServiceContext());
    diskFileMapProvider = TestStorageManagerComponentHolder.getFileMapProvider();
    virtualBufferCaches = new ArrayList<>();
    for (int i = 0; i < numMutableComponents; i++) {
        IVirtualBufferCache virtualBufferCache = new MultitenantVirtualBufferCache(new VirtualBufferCache(new HeapBufferAllocator(), memPageSize, memNumPages / numMutableComponents));
        virtualBufferCaches.add(virtualBufferCache);
        virtualBufferCache.open();
    }
    rnd.setSeed(RANDOM_SEED);
    invIndexFileRef = ioManager.resolveAbsolutePath(onDiskDir + invIndexFileName);
}
Also used : HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) MultitenantVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.MultitenantVirtualBufferCache) VirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache) MultitenantVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.MultitenantVirtualBufferCache) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) Date(java.util.Date)

Example 5 with HeapBufferAllocator

use of org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator in project asterixdb by apache.

the class VirtualBufferCacheTest method test01.

/**
     * Pins NUM_PAGES randomly distributed across NUM_FILES and checks that each
     * set of cached pages pinned on behalf of a file are disjoint from all other sets of
     * cached pages pinned on behalf of other files.
     * Additionally, the test perform the same test when pinning over soft cap (NUM_PAGES)
     * of pages.
     */
@Test
public void test01() throws Exception {
    TestStorageManagerComponentHolder.init(PAGE_SIZE, NUM_PAGES, NUM_FILES);
    ioManager = TestStorageManagerComponentHolder.getIOManager();
    ICacheMemoryAllocator allocator = new HeapBufferAllocator();
    vbc = new VirtualBufferCache(allocator, PAGE_SIZE, NUM_PAGES);
    vbc.open();
    createFiles();
    kPins(NUM_PAGES);
    assertTrue(pagesDisjointed());
    kPins(NUM_OVERPIN);
    assertTrue(pagesDisjointed());
    deleteFiles();
    vbc.close();
}
Also used : HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) VirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache) ICacheMemoryAllocator(org.apache.hyracks.storage.common.buffercache.ICacheMemoryAllocator) Test(org.junit.Test)

Aggregations

HeapBufferAllocator (org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator)9 VirtualBufferCache (org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache)7 IVirtualBufferCache (org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache)4 Date (java.util.Date)3 ICacheMemoryAllocator (org.apache.hyracks.storage.common.buffercache.ICacheMemoryAllocator)3 VirtualFreePageManager (org.apache.hyracks.storage.am.lsm.common.freepage.VirtualFreePageManager)2 BufferCache (org.apache.hyracks.storage.common.buffercache.BufferCache)2 ClockPageReplacementStrategy (org.apache.hyracks.storage.common.buffercache.ClockPageReplacementStrategy)2 DelayPageCleanerPolicy (org.apache.hyracks.storage.common.buffercache.DelayPageCleanerPolicy)2 IBufferCache (org.apache.hyracks.storage.common.buffercache.IBufferCache)2 IPageReplacementStrategy (org.apache.hyracks.storage.common.buffercache.IPageReplacementStrategy)2 IFileMapManager (org.apache.hyracks.storage.common.file.IFileMapManager)2 Test (org.junit.Test)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ActiveManager (org.apache.asterix.active.ActiveManager)1 AppRuntimeContextProviderForRecovery (org.apache.asterix.api.common.AppRuntimeContextProviderForRecovery)1 IDatasetLifecycleManager (org.apache.asterix.common.api.IDatasetLifecycleManager)1 ThreadExecutor (org.apache.asterix.common.api.ThreadExecutor)1 ClusterPartition (org.apache.asterix.common.cluster.ClusterPartition)1