Search in sources :

Example 1 with OWOWCache

use of com.orientechnologies.orient.core.storage.cache.local.OWOWCache in project orientdb by orientechnologies.

the class WOWCacheTest method initBuffer.

private void initBuffer() throws IOException {
    wowCache = new OWOWCache(true, pageSize, new OByteBufferPool(pageSize), 10000, writeAheadLog, 10, 100, 100, storageLocal, false, files, 1);
    wowCache.loadRegisteredFiles();
}
Also used : OWOWCache(com.orientechnologies.orient.core.storage.cache.local.OWOWCache) OByteBufferPool(com.orientechnologies.common.directmemory.OByteBufferPool)

Example 2 with OWOWCache

use of com.orientechnologies.orient.core.storage.cache.local.OWOWCache in project orientdb by orientechnologies.

the class OPerformanceStatisticManager method getWowCache.

/**
   * @return Returns current instance of write cache and initializes local reference if such one is not initialized yet.
   */
private OWOWCache getWowCache() {
    if (wowCacheInitialized)
        return wowCache;
    final OWriteCache writeCache = storage.getWriteCache();
    if (writeCache instanceof OWOWCache)
        this.wowCache = (OWOWCache) writeCache;
    else
        this.wowCache = null;
    wowCacheInitialized = true;
    return this.wowCache;
}
Also used : OWriteCache(com.orientechnologies.orient.core.storage.cache.OWriteCache) OWOWCache(com.orientechnologies.orient.core.storage.cache.local.OWOWCache)

Example 3 with OWOWCache

use of com.orientechnologies.orient.core.storage.cache.local.OWOWCache in project orientdb by orientechnologies.

the class ReadWriteDiskCacheTest method testFlushTillLSN.

public void testFlushTillLSN() throws Exception {
    closeBufferAndDeleteFile();
    File file = new File(storageLocal.getConfiguration().getDirectory());
    if (!file.exists())
        file.mkdir();
    writeAheadLog = new ODiskWriteAheadLog(1024, -1, 10 * 1024, null, true, storageLocal, 10);
    final OStorageSegmentConfiguration segmentConfiguration = new OStorageSegmentConfiguration(storageLocal.getConfiguration(), "readWriteDiskCacheTest.tst", 0);
    segmentConfiguration.fileType = OFileClassic.NAME;
    writeBuffer = new OWOWCache(false, 8 + systemOffset, new OByteBufferPool(8 + systemOffset), 10000, writeAheadLog, 100, 2 * (8 + systemOffset), 2 * (8 + systemOffset) + 4 * (8 + systemOffset), storageLocal, false, files, 10);
    writeBuffer.loadRegisteredFiles();
    readBuffer = new O2QCache(4 * (8 + systemOffset), 8 + systemOffset, false, 20);
    long fileId = readBuffer.addFile(fileName, writeBuffer);
    OLogSequenceNumber lsnToFlush = null;
    for (int i = 0; i < 8; i++) {
        OCacheEntry cacheEntry = readBuffer.load(fileId, i, false, writeBuffer, 1);
        if (cacheEntry == null) {
            cacheEntry = readBuffer.allocateNewPage(fileId, writeBuffer);
            Assert.assertEquals(cacheEntry.getPageIndex(), i);
        }
        OCachePointer dataPointer = cacheEntry.getCachePointer();
        dataPointer.acquireExclusiveLock();
        OLogSequenceNumber pageLSN = writeAheadLog.log(new WriteAheadLogTest.TestRecord(30, false));
        setLsn(dataPointer.getSharedBuffer(), pageLSN);
        lsnToFlush = pageLSN;
        cacheEntry.markDirty();
        dataPointer.releaseExclusiveLock();
        readBuffer.release(cacheEntry, writeBuffer);
    }
    Thread.sleep(1000);
    Assert.assertEquals(writeAheadLog.getFlushedLsn(), lsnToFlush);
}
Also used : WriteAheadLogTest(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.WriteAheadLogTest) OByteBufferPool(com.orientechnologies.common.directmemory.OByteBufferPool) ODiskWriteAheadLog(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog) OCacheEntry(com.orientechnologies.orient.core.storage.cache.OCacheEntry) OLogSequenceNumber(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OLogSequenceNumber) OWOWCache(com.orientechnologies.orient.core.storage.cache.local.OWOWCache) OStorageSegmentConfiguration(com.orientechnologies.orient.core.config.OStorageSegmentConfiguration) File(java.io.File) OCachePointer(com.orientechnologies.orient.core.storage.cache.OCachePointer)

Example 4 with OWOWCache

use of com.orientechnologies.orient.core.storage.cache.local.OWOWCache in project orientdb by orientechnologies.

the class OLocalPaginatedStorage method initWalAndDiskCache.

protected void initWalAndDiskCache() throws IOException {
    if (configuration.getContextConfiguration().getValueAsBoolean(OGlobalConfiguration.USE_WAL)) {
        checkpointExecutor = Executors.newSingleThreadExecutor(new FullCheckpointThreadFactory());
        final ODiskWriteAheadLog diskWriteAheadLog = new ODiskWriteAheadLog(this);
        diskWriteAheadLog.addLowDiskSpaceListener(this);
        diskWriteAheadLog.checkFreeSpace();
        writeAheadLog = diskWriteAheadLog;
        writeAheadLog.addFullCheckpointListener(this);
    } else
        writeAheadLog = null;
    long diskCacheSize = OGlobalConfiguration.DISK_CACHE_SIZE.getValueAsLong() * 1024 * 1024;
    long writeCacheSize = (long) Math.floor((((double) OGlobalConfiguration.DISK_WRITE_CACHE_PART.getValueAsInteger()) / 100.0) * diskCacheSize);
    final OWOWCache wowCache = new OWOWCache(false, OGlobalConfiguration.DISK_CACHE_PAGE_SIZE.getValueAsInteger() * ONE_KB, OByteBufferPool.instance(), OGlobalConfiguration.DISK_WRITE_CACHE_PAGE_TTL.getValueAsLong() * 1000, writeAheadLog, OGlobalConfiguration.DISK_WRITE_CACHE_PAGE_FLUSH_INTERVAL.getValueAsInteger(), writeCacheSize, diskCacheSize, this, true, files, getId());
    wowCache.loadRegisteredFiles();
    wowCache.addLowDiskSpaceListener(this);
    wowCache.addBackgroundExceptionListener(this);
    writeCache = wowCache;
}
Also used : ODiskWriteAheadLog(com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog) OWOWCache(com.orientechnologies.orient.core.storage.cache.local.OWOWCache)

Example 5 with OWOWCache

use of com.orientechnologies.orient.core.storage.cache.local.OWOWCache in project orientdb by orientechnologies.

the class ReadWriteCacheConcurrentTest method initBuffer.

private void initBuffer() throws IOException {
    writeBuffer = new OWOWCache(false, 8 + systemOffset, new OByteBufferPool(8 + systemOffset), 10000, null, -1, 15000 * (8 + systemOffset), 4 * (8 + systemOffset) + 15000 * (8 + systemOffset), storageLocal, true, files, 1);
    writeBuffer.loadRegisteredFiles();
    readBuffer = new O2QCache(4 * (8 + systemOffset), 8 + systemOffset, true, 20);
}
Also used : OWOWCache(com.orientechnologies.orient.core.storage.cache.local.OWOWCache) OByteBufferPool(com.orientechnologies.common.directmemory.OByteBufferPool) O2QCache(com.orientechnologies.orient.core.storage.cache.local.twoq.O2QCache)

Aggregations

OWOWCache (com.orientechnologies.orient.core.storage.cache.local.OWOWCache)6 OByteBufferPool (com.orientechnologies.common.directmemory.OByteBufferPool)4 ODiskWriteAheadLog (com.orientechnologies.orient.core.storage.impl.local.paginated.wal.ODiskWriteAheadLog)2 OStorageSegmentConfiguration (com.orientechnologies.orient.core.config.OStorageSegmentConfiguration)1 OCacheEntry (com.orientechnologies.orient.core.storage.cache.OCacheEntry)1 OCachePointer (com.orientechnologies.orient.core.storage.cache.OCachePointer)1 OWriteCache (com.orientechnologies.orient.core.storage.cache.OWriteCache)1 O2QCache (com.orientechnologies.orient.core.storage.cache.local.twoq.O2QCache)1 OLogSequenceNumber (com.orientechnologies.orient.core.storage.impl.local.paginated.wal.OLogSequenceNumber)1 WriteAheadLogTest (com.orientechnologies.orient.core.storage.impl.local.paginated.wal.WriteAheadLogTest)1 File (java.io.File)1