Search in sources :

Example 41 with OStorageException

use of com.orientechnologies.orient.core.exception.OStorageException in project orientdb by orientechnologies.

the class ODiskWriteAheadLog method newSegment.

@Override
public void newSegment() throws IOException {
    syncObject.lock();
    try {
        if (!activeOperations.isEmpty())
            throw new OStorageException("Can not change end of WAL because there are active atomic operations in the log.");
        OLogSegment last = logSegments.get(logSegments.size() - 1);
        if (last.filledUpTo() == 0) {
            return;
        }
        last.stopFlush(true);
        last = new OLogSegment(this, new File(walLocation, getSegmentName(last.getOrder() + 1)), fileTTL, maxPagesCacheSize, performanceStatisticManager, new SubScheduledExecutorService(autoFileCloser), new SubScheduledExecutorService(commitExecutor));
        last.init(fileDataBuffer);
        last.startFlush();
        logSegments.add(last);
    } finally {
        syncObject.unlock();
    }
}
Also used : SubScheduledExecutorService(com.orientechnologies.common.concur.executors.SubScheduledExecutorService) OStorageException(com.orientechnologies.orient.core.exception.OStorageException)

Example 42 with OStorageException

use of com.orientechnologies.orient.core.exception.OStorageException in project orientdb by orientechnologies.

the class ODirectMemoryOnlyDiskCache method loadFile.

public long loadFile(long fileId, OWriteCache writeCache) {
    int intId = extractFileId(fileId);
    final MemoryFile memoryFile = files.get(intId);
    if (memoryFile == null)
        throw new OStorageException("File with id " + intId + " does not exist");
    return composeFileId(id, intId);
}
Also used : OStorageException(com.orientechnologies.orient.core.exception.OStorageException)

Example 43 with OStorageException

use of com.orientechnologies.orient.core.exception.OStorageException in project orientdb by orientechnologies.

the class OAtomicOperation method filledUpTo.

public long filledUpTo(long fileId) throws IOException {
    fileId = checkFileIdCompatibilty(fileId, storageId);
    if (deletedFiles.contains(fileId))
        throw new OStorageException("File with id " + fileId + " is deleted.");
    FileChanges changesContainer = fileChanges.get(fileId);
    return internalFilledUpTo(fileId, changesContainer);
}
Also used : OStorageException(com.orientechnologies.orient.core.exception.OStorageException)

Example 44 with OStorageException

use of com.orientechnologies.orient.core.exception.OStorageException in project orientdb by orientechnologies.

the class OAtomicOperation method getChanges.

public OWALChanges getChanges(long fileId, long pageIndex) {
    fileId = checkFileIdCompatibilty(fileId, storageId);
    if (deletedFiles.contains(fileId))
        throw new OStorageException("File with id " + fileId + " is deleted.");
    final FileChanges changesContainer = fileChanges.get(fileId);
    assert changesContainer != null;
    final FilePageChanges pageChangesContainer = changesContainer.pageChangesMap.get(pageIndex);
    assert pageChangesContainer != null;
    return pageChangesContainer.changes;
}
Also used : OStorageException(com.orientechnologies.orient.core.exception.OStorageException)

Example 45 with OStorageException

use of com.orientechnologies.orient.core.exception.OStorageException in project orientdb by orientechnologies.

the class OAtomicOperation method addFile.

public long addFile(String fileName) throws IOException {
    if (newFileNamesId.containsKey(fileName))
        throw new OStorageException("File with name " + fileName + " already exists.");
    final long fileId;
    final boolean isNew;
    if (deletedFileNameIdMap.containsKey(fileName)) {
        fileId = deletedFileNameIdMap.remove(fileName);
        deletedFiles.remove(fileId);
        isNew = false;
    } else {
        fileId = writeCache.bookFileId(fileName);
        isNew = true;
    }
    newFileNamesId.put(fileName, fileId);
    FileChanges fileChanges = new FileChanges();
    fileChanges.isNew = isNew;
    fileChanges.fileName = fileName;
    fileChanges.maxNewPageIndex = -1;
    this.fileChanges.put(fileId, fileChanges);
    return fileId;
}
Also used : OStorageException(com.orientechnologies.orient.core.exception.OStorageException)

Aggregations

OStorageException (com.orientechnologies.orient.core.exception.OStorageException)46 OException (com.orientechnologies.common.exception.OException)13 IOException (java.io.IOException)13 OIndexException (com.orientechnologies.orient.core.index.OIndexException)10 OCacheEntry (com.orientechnologies.orient.core.storage.cache.OCacheEntry)10 OAtomicOperation (com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation)10 OLocalHashTableException (com.orientechnologies.orient.core.exception.OLocalHashTableException)5 OTooBigIndexKeyException (com.orientechnologies.orient.core.exception.OTooBigIndexKeyException)5 OIndexEngineException (com.orientechnologies.orient.core.index.OIndexEngineException)5 OFileClassic (com.orientechnologies.orient.core.storage.fs.OFileClassic)5 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)4 ODatabaseException (com.orientechnologies.orient.core.exception.ODatabaseException)3 OCachePointer (com.orientechnologies.orient.core.storage.cache.OCachePointer)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)3 SubScheduledExecutorService (com.orientechnologies.common.concur.executors.SubScheduledExecutorService)2 OType (com.orientechnologies.orient.core.metadata.schema.OType)2 OSessionStoragePerformanceStatistic (com.orientechnologies.orient.core.storage.impl.local.statistic.OSessionStoragePerformanceStatistic)2 File (java.io.File)2 RandomAccessFile (java.io.RandomAccessFile)2 OInterruptedException (com.orientechnologies.common.concur.lock.OInterruptedException)1