use of com.orientechnologies.orient.core.exception.OStorageException in project orientdb by orientechnologies.
the class OClusterPositionMapBucket method resurrect.
public void resurrect(final int index) throws IOException {
final int size = getIntValue(SIZE_OFFSET);
if (index >= size)
throw new OStorageException("Cannot resurrect a record: provided index " + index + " is out of range");
final int position = entryPosition(index);
final byte flag = getByteValue(position);
if (flag == REMOVED)
setByteValue(position, ALLOCATED);
else
throw new OStorageException("Cannot resurrect a record: provided index " + index + " points to a non removed entry");
}
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 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;
}
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 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);
}
Aggregations