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();
}
}
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);
}
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);
}
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;
}
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;
}
Aggregations