Search in sources :

Example 1 with OHashTableDirectoryException

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

the class OHashTableDirectory method setNodeLocalDepth.

public void setNodeLocalDepth(int nodeIndex, byte localNodeDepth) throws IOException {
    startOperation();
    try {
        OAtomicOperation atomicOperation = startAtomicOperation(true);
        acquireExclusiveLock();
        try {
            final ODirectoryPage page = loadPage(nodeIndex, true, atomicOperation);
            try {
                page.setNodeLocalDepth(getLocalNodeIndex(nodeIndex), localNodeDepth);
            } 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 local node depth", this), e);
        } finally {
            releaseExclusiveLock();
        }
    } finally {
        completeOperation();
    }
}
Also used : OAtomicOperation(com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) IOException(java.io.IOException) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException)

Example 2 with OHashTableDirectoryException

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

the class OHashTableDirectory method setNode.

public void setNode(int nodeIndex, long[] node) throws IOException {
    startOperation();
    try {
        OAtomicOperation atomicOperation = startAtomicOperation(true);
        acquireExclusiveLock();
        try {
            final ODirectoryPage page = loadPage(nodeIndex, true, atomicOperation);
            try {
                final int localNodeIndex = getLocalNodeIndex(nodeIndex);
                for (int i = 0; i < LEVEL_SIZE; i++) page.setPointer(localNodeIndex, i, node[i]);
            } 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", this), e);
        } finally {
            releaseExclusiveLock();
        }
    } finally {
        completeOperation();
    }
}
Also used : OAtomicOperation(com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) IOException(java.io.IOException) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException)

Example 3 with OHashTableDirectoryException

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

the class OHashTableDirectory method delete.

public void delete() throws IOException {
    startOperation();
    try {
        final OAtomicOperation atomicOperation = startAtomicOperation(false);
        acquireExclusiveLock();
        try {
            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 hash table deletion", this), e);
        } finally {
            releaseExclusiveLock();
        }
    } finally {
        completeOperation();
    }
}
Also used : OAtomicOperation(com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) IOException(java.io.IOException) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException)

Example 4 with OHashTableDirectoryException

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

the class OHashTableDirectory method init.

private void init() throws IOException {
    OAtomicOperation atomicOperation = startAtomicOperation(false);
    try {
        OCacheEntry firstEntry = loadPage(atomicOperation, fileId, firstEntryIndex, true);
        if (firstEntry == null) {
            firstEntry = addPage(atomicOperation, fileId);
            assert firstEntry.getPageIndex() == 0;
        }
        pinPage(atomicOperation, firstEntry);
        firstEntry.acquireExclusiveLock();
        try {
            ODirectoryFirstPage firstPage = new ODirectoryFirstPage(firstEntry, getChanges(atomicOperation, firstEntry), firstEntry);
            firstPage.setTreeSize(0);
            firstPage.setTombstone(-1);
        } 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 hash table initialization", this), e);
    }
}
Also used : OAtomicOperation(com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation) OCacheEntry(com.orientechnologies.orient.core.storage.cache.OCacheEntry) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) IOException(java.io.IOException) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException)

Example 5 with OHashTableDirectoryException

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

the class OHashTableDirectory method setMaxRightChildDepth.

public void setMaxRightChildDepth(int nodeIndex, byte maxRightChildDepth) throws IOException {
    startOperation();
    try {
        OAtomicOperation atomicOperation = startAtomicOperation(true);
        acquireExclusiveLock();
        try {
            final ODirectoryPage page = loadPage(nodeIndex, true, atomicOperation);
            try {
                page.setMaxRightChildDepth(getLocalNodeIndex(nodeIndex), maxRightChildDepth);
            } 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 right max child depth", this), e);
        } finally {
            releaseExclusiveLock();
        }
    } finally {
        completeOperation();
    }
}
Also used : OAtomicOperation(com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) IOException(java.io.IOException) OHashTableDirectoryException(com.orientechnologies.orient.core.exception.OHashTableDirectoryException) OException(com.orientechnologies.common.exception.OException) IOException(java.io.IOException)

Aggregations

OException (com.orientechnologies.common.exception.OException)11 OHashTableDirectoryException (com.orientechnologies.orient.core.exception.OHashTableDirectoryException)11 OAtomicOperation (com.orientechnologies.orient.core.storage.impl.local.paginated.atomicoperations.OAtomicOperation)11 IOException (java.io.IOException)11 OCacheEntry (com.orientechnologies.orient.core.storage.cache.OCacheEntry)2