Search in sources :

Example 11 with NodeAVL

use of org.hsqldb_voltpatches.index.NodeAVL in project voltdb by VoltDB.

the class RowAVLDisk method setInMemory.

public synchronized void setInMemory(boolean in) {
    isInMemory = in;
    if (in) {
        return;
    }
    NodeAVL n = nPrimaryNode;
    while (n != null) {
        n.setInMemory(in);
        n = n.nNext;
    }
    RowAction action = rowAction;
    if (action != null) {
        action.memoryRow = null;
    }
}
Also used : NodeAVL(org.hsqldb_voltpatches.index.NodeAVL)

Example 12 with NodeAVL

use of org.hsqldb_voltpatches.index.NodeAVL in project voltdb by VoltDB.

the class RowAVLDisk method writeNodes.

/**
     *  Writes the Nodes, immediately after the row size.
     *
     * @param out
     *
     * @throws IOException
     */
private void writeNodes(RowOutputInterface out) throws IOException {
    out.writeSize(storageSize);
    NodeAVL n = nPrimaryNode;
    while (n != null) {
        n.write(out);
        n = n.nNext;
    }
    hasNodesChanged = false;
}
Also used : NodeAVL(org.hsqldb_voltpatches.index.NodeAVL)

Example 13 with NodeAVL

use of org.hsqldb_voltpatches.index.NodeAVL in project voltdb by VoltDB.

the class RowStoreAVLMemory method insertIndexNodes.

boolean insertIndexNodes(Index primaryIndex, Index newIndex) {
    int position = newIndex.getPosition();
    RowIterator it = primaryIndex.firstRow(this);
    int rowCount = 0;
    HsqlException error = null;
    try {
        while (it.hasNext()) {
            Row row = it.getNextRow();
            ((RowAVL) row).insertNode(position);
            // count before inserting
            rowCount++;
            newIndex.insert(null, this, row);
        }
        return true;
    } catch (java.lang.OutOfMemoryError e) {
        error = Error.error(ErrorCode.OUT_OF_MEMORY);
    } catch (HsqlException e) {
        error = e;
    }
    // backtrack on error
    // rowCount rows have been modified
    it = primaryIndex.firstRow(this);
    for (int i = 0; i < rowCount; i++) {
        Row row = it.getNextRow();
        NodeAVL backnode = ((RowAVL) row).getNode(0);
        int j = position;
        while (--j > 0) {
            backnode = backnode.nNext;
        }
        backnode.nNext = backnode.nNext.nNext;
    }
    throw error;
}
Also used : NodeAVL(org.hsqldb_voltpatches.index.NodeAVL) RowIterator(org.hsqldb_voltpatches.navigator.RowIterator) Row(org.hsqldb_voltpatches.Row) RowAVL(org.hsqldb_voltpatches.RowAVL) HsqlException(org.hsqldb_voltpatches.HsqlException)

Example 14 with NodeAVL

use of org.hsqldb_voltpatches.index.NodeAVL in project voltdb by VoltDB.

the class RowStoreAVLMemory method dropIndexFromRows.

void dropIndexFromRows(Index primaryIndex, Index oldIndex) {
    RowIterator it = primaryIndex.firstRow(this);
    int position = oldIndex.getPosition() - 1;
    while (it.hasNext()) {
        Row row = it.getNextRow();
        int i = position - 1;
        NodeAVL backnode = ((RowAVL) row).getNode(0);
        while (i-- > 0) {
            backnode = backnode.nNext;
        }
        backnode.nNext = backnode.nNext.nNext;
    }
}
Also used : NodeAVL(org.hsqldb_voltpatches.index.NodeAVL) RowIterator(org.hsqldb_voltpatches.navigator.RowIterator) Row(org.hsqldb_voltpatches.Row) RowAVL(org.hsqldb_voltpatches.RowAVL)

Example 15 with NodeAVL

use of org.hsqldb_voltpatches.index.NodeAVL in project voltdb by VoltDB.

the class RowStoreAVLDisk method setAccessor.

public void setAccessor(Index key, int accessor) {
    CachedObject object = get(accessor, false);
    if (object != null) {
        NodeAVL node = ((RowAVL) object).getNode(key.getPosition());
        object = node;
    }
    setAccessor(key, object);
}
Also used : NodeAVL(org.hsqldb_voltpatches.index.NodeAVL) RowAVL(org.hsqldb_voltpatches.RowAVL)

Aggregations

NodeAVL (org.hsqldb_voltpatches.index.NodeAVL)15 RowAVL (org.hsqldb_voltpatches.RowAVL)4 Row (org.hsqldb_voltpatches.Row)2 NodeAVLDisk (org.hsqldb_voltpatches.index.NodeAVLDisk)2 NodeAVLMemoryPointer (org.hsqldb_voltpatches.index.NodeAVLMemoryPointer)2 RowIterator (org.hsqldb_voltpatches.navigator.RowIterator)2 HsqlException (org.hsqldb_voltpatches.HsqlException)1 NodeAVLMemory (org.hsqldb_voltpatches.index.NodeAVLMemory)1