Search in sources :

Example 6 with VirtualBufferCache

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

the class LSMBTreeTestHarness method setUp.

public void setUp() throws HyracksDataException {
    ioManager = TestStorageManagerComponentHolder.getIOManager();
    ioDeviceId = 0;
    onDiskDir = ioManager.getIODevices().get(ioDeviceId).getMount() + sep + "lsm_btree_" + simpleDateFormat.format(new Date()) + sep;
    ctx = TestUtils.create(getHyracksFrameSize());
    TestStorageManagerComponentHolder.init(diskPageSize, diskNumPages, diskMaxOpenFiles);
    file = ioManager.resolveAbsolutePath(onDiskDir);
    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)

Example 7 with VirtualBufferCache

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

the class VirtualFreePageManagerTest method test01.

@Test
public void test01() throws HyracksDataException {
    VirtualBufferCache bufferCache = new VirtualBufferCache(new HeapBufferAllocator(), 4096, 128);
    bufferCache.open();
    FileReference fileRef = new FileReference(new IODeviceHandle(new File("target"), "workspace"), "tempfile.tmp");
    bufferCache.createFile(fileRef);
    int fileId = bufferCache.getFileMapProvider().lookupFileId(fileRef);
    bufferCache.openFile(fileId);
    VirtualFreePageManager virtualFreePageManager = new VirtualFreePageManager(bufferCache);
    virtualFreePageManager.open(fileId);
    virtualFreePageManager.init(null, null);
    testInMemoryFreePageManager(virtualFreePageManager);
    // We expect exactly the same behavior after a reset().
    virtualFreePageManager.init(null, null);
    testInMemoryFreePageManager(virtualFreePageManager);
}
Also used : IODeviceHandle(org.apache.hyracks.api.io.IODeviceHandle) HeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.HeapBufferAllocator) VirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.VirtualBufferCache) FileReference(org.apache.hyracks.api.io.FileReference) File(java.io.File) VirtualFreePageManager(org.apache.hyracks.storage.am.lsm.common.freepage.VirtualFreePageManager) Test(org.junit.Test)

Example 8 with VirtualBufferCache

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

the class DatasetVirtualBufferCaches method initializeVirtualBufferCaches.

public List<IVirtualBufferCache> initializeVirtualBufferCaches(IResourceMemoryManager memoryManager, int ioDeviceNum) {
    int numPages = datasetID < firstAvilableUserDatasetID ? storageProperties.getMetadataMemoryComponentNumPages() : storageProperties.getMemoryComponentNumPages();
    List<IVirtualBufferCache> vbcs = new ArrayList<>();
    for (int i = 0; i < storageProperties.getMemoryComponentsNum(); i++) {
        MultitenantVirtualBufferCache vbc = new MultitenantVirtualBufferCache(new VirtualBufferCache(new ResourceHeapBufferAllocator(memoryManager, Integer.toString(datasetID)), storageProperties.getMemoryComponentPageSize(), numPages / storageProperties.getMemoryComponentsNum() / numPartitions));
        vbcs.add(vbc);
    }
    ioDeviceVirtualBufferCaches.put(ioDeviceNum, vbcs);
    return vbcs;
}
Also used : MultitenantVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.impls.MultitenantVirtualBufferCache) IVirtualBufferCache(org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache) 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) ArrayList(java.util.ArrayList) ResourceHeapBufferAllocator(org.apache.hyracks.storage.common.buffercache.ResourceHeapBufferAllocator)

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