use of com.orientechnologies.orient.core.exception.OHashTableDirectoryException in project orientdb by orientechnologies.
the class OHashTableDirectory method clear.
public void clear() throws IOException {
startOperation();
try {
OAtomicOperation atomicOperation = startAtomicOperation(true);
acquireExclusiveLock();
try {
truncateFile(atomicOperation, fileId);
init();
endAtomicOperation(false, null);
} catch (IOException e) {
endAtomicOperation(true, e);
throw e;
} catch (Exception e) {
endAtomicOperation(true, e);
throw OException.wrapException(new OHashTableDirectoryException("Error during removing of hash table directory content", this), e);
} finally {
releaseExclusiveLock();
}
} finally {
completeOperation();
}
}
use of com.orientechnologies.orient.core.exception.OHashTableDirectoryException in project orientdb by orientechnologies.
the class OHashTableDirectory method setMaxLeftChildDepth.
public void setMaxLeftChildDepth(int nodeIndex, byte maxLeftChildDepth) throws IOException {
startOperation();
try {
OAtomicOperation atomicOperation = startAtomicOperation(true);
acquireExclusiveLock();
try {
final ODirectoryPage page = loadPage(nodeIndex, true, atomicOperation);
try {
page.setMaxLeftChildDepth(getLocalNodeIndex(nodeIndex), maxLeftChildDepth);
} finally {
releasePage(page, true, atomicOperation);
}
endAtomicOperation(false, null);
} catch (IOException e) {
endAtomicOperation(true, e);
throw e;
} catch (Exception e) {
endAtomicOperation(true, e);
throw OException.wrapException(new OHashTableDirectoryException("Error during setting of max left child depth", this), e);
} finally {
releaseExclusiveLock();
}
} finally {
completeOperation();
}
}
use of com.orientechnologies.orient.core.exception.OHashTableDirectoryException in project orientdb by orientechnologies.
the class OHashTableDirectory method setNodePointer.
public void setNodePointer(int nodeIndex, int index, long pointer) throws IOException {
startOperation();
try {
OAtomicOperation atomicOperation = startAtomicOperation(true);
acquireExclusiveLock();
try {
final ODirectoryPage page = loadPage(nodeIndex, true, atomicOperation);
try {
page.setPointer(getLocalNodeIndex(nodeIndex), index, pointer);
} finally {
releasePage(page, true, atomicOperation);
}
endAtomicOperation(false, null);
} catch (IOException e) {
endAtomicOperation(true, e);
throw e;
} catch (Exception e) {
endAtomicOperation(true, e);
throw OException.wrapException(new OHashTableDirectoryException("Error during setting of node pointer", this), e);
} finally {
releaseExclusiveLock();
}
} finally {
completeOperation();
}
}
use of com.orientechnologies.orient.core.exception.OHashTableDirectoryException in project orientdb by orientechnologies.
the class OHashTableDirectory method deleteWithoutOpen.
public void deleteWithoutOpen() throws IOException {
startOperation();
try {
final OAtomicOperation atomicOperation = startAtomicOperation(false);
acquireExclusiveLock();
try {
if (isFileExists(atomicOperation, getFullName())) {
fileId = openFile(atomicOperation, getFullName());
deleteFile(atomicOperation, fileId);
}
endAtomicOperation(false, null);
} catch (IOException e) {
endAtomicOperation(true, e);
throw e;
} catch (Exception e) {
endAtomicOperation(true, e);
throw OException.wrapException(new OHashTableDirectoryException("Error during deletion of hash table", this), e);
} finally {
releaseExclusiveLock();
}
} finally {
completeOperation();
}
}
use of com.orientechnologies.orient.core.exception.OHashTableDirectoryException in project orientdb by orientechnologies.
the class OHashTableDirectory method deleteNode.
public void deleteNode(int nodeIndex) throws IOException {
startOperation();
try {
final OAtomicOperation atomicOperation = startAtomicOperation(true);
acquireExclusiveLock();
try {
OCacheEntry firstEntry = loadPage(atomicOperation, fileId, firstEntryIndex, true);
firstEntry.acquireExclusiveLock();
try {
ODirectoryFirstPage firstPage = new ODirectoryFirstPage(firstEntry, getChanges(atomicOperation, firstEntry), firstEntry);
if (nodeIndex < ODirectoryFirstPage.NODES_PER_PAGE) {
firstPage.setPointer(nodeIndex, 0, firstPage.getTombstone());
firstPage.setTombstone(nodeIndex);
} else {
final int pageIndex = nodeIndex / ODirectoryPage.NODES_PER_PAGE;
final int localNodeIndex = nodeIndex % ODirectoryPage.NODES_PER_PAGE;
final OCacheEntry cacheEntry = loadPage(atomicOperation, fileId, pageIndex, true);
cacheEntry.acquireExclusiveLock();
try {
ODirectoryPage page = new ODirectoryPage(cacheEntry, getChanges(atomicOperation, cacheEntry), cacheEntry);
page.setPointer(localNodeIndex, 0, firstPage.getTombstone());
firstPage.setTombstone(nodeIndex);
} finally {
cacheEntry.releaseExclusiveLock();
releasePage(atomicOperation, cacheEntry);
}
}
} finally {
firstEntry.releaseExclusiveLock();
releasePage(atomicOperation, firstEntry);
}
endAtomicOperation(false, null);
} catch (IOException e) {
endAtomicOperation(true, e);
throw e;
} catch (Exception e) {
endAtomicOperation(true, e);
throw OException.wrapException(new OHashTableDirectoryException("Error during node deletion", this), e);
} finally {
releaseExclusiveLock();
}
} finally {
completeOperation();
}
}
Aggregations