Search in sources :

Example 1 with VirtualBufferCache

use of org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache 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 VirtualBufferCache

use of org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache 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 3 with VirtualBufferCache

use of org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache 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 4 with VirtualBufferCache

use of org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache 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)

Example 5 with VirtualBufferCache

use of org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache in project asterixdb by apache.

the class LSMRTreeTestHarness method setUp.

public void setUp() throws HyracksDataException {
    ioManager = TestStorageManagerComponentHolder.getIOManager();
    ioDeviceId = 0;
    onDiskDir = ioManager.getIODevices().get(ioDeviceId).getMount() + sep + "lsm_rtree_" + simpleDateFormat.format(new Date()) + sep;
    file = ioManager.resolveAbsolutePath(onDiskDir);
    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 VirtualBufferCache(new HeapBufferAllocator(), memPageSize, memNumPages / numMutableComponents);
        virtualBufferCaches.add(virtualBufferCache);
    }
    rnd.setSeed(RANDOM_SEED);
}
Also used : HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) VirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) Date(java.util.Date)

Aggregations

VirtualBufferCache (org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache)8 HeapBufferAllocator (org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator)7 IVirtualBufferCache (org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache)5 Date (java.util.Date)3 ArrayList (java.util.ArrayList)2 VirtualFreePageManager (org.apache.hyracks.storage.am.lsm.common.freepage.VirtualFreePageManager)2 MultitenantVirtualBufferCache (org.apache.hyracks.storage.am.lsm.common.impls.MultitenantVirtualBufferCache)2 Test (org.junit.Test)2 File (java.io.File)1 FileReference (org.apache.hyracks.api.io.FileReference)1 IODeviceHandle (org.apache.hyracks.api.io.IODeviceHandle)1 BTreeNSMInteriorFrameFactory (org.apache.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory)1 BTreeNSMLeafFrameFactory (org.apache.hyracks.storage.am.btree.frames.BTreeNSMLeafFrameFactory)1 BTree (org.apache.hyracks.storage.am.btree.impls.BTree)1 IPageManager (org.apache.hyracks.storage.am.common.api.IPageManager)1 ITreeIndexFrameFactory (org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory)1 TypeAwareTupleWriterFactory (org.apache.hyracks.storage.am.common.tuples.TypeAwareTupleWriterFactory)1 ICacheMemoryAllocator (org.apache.hyracks.storage.common.buffercache.ICacheMemoryAllocator)1 ResourceHeapBufferAllocator (org.apache.hyracks.storage.common.buffercache.ResourceHeapBufferAllocator)1 TransientFileMapManager (org.apache.hyracks.storage.common.file.TransientFileMapManager)1