use of org.hsqldb_voltpatches.Row 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;
}
use of org.hsqldb_voltpatches.Row 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;
}
}
use of org.hsqldb_voltpatches.Row in project voltdb by VoltDB.
the class RowStoreAVLDiskData method getNewCachedObject.
public CachedObject getNewCachedObject(Session session, Object object) {
Row row = new RowAVLDiskData(table, (Object[]) object);
add(row);
RowAction.addAction(session, RowAction.ACTION_INSERT, table, row);
return row;
}
use of org.hsqldb_voltpatches.Row in project voltdb by VoltDB.
the class RowStoreAVLHybrid method getNewCachedObject.
public CachedObject getNewCachedObject(Session session, Object object) {
if (isCached) {
Row row = new RowAVLDisk(table, (Object[]) object);
add(row);
if (isTempTable) {
RowAction.addAction(session, RowAction.ACTION_INSERT, (Table) table, row);
}
return row;
} else {
memoryRowCount++;
if (useCache && memoryRowCount > maxMemoryRowCount) {
changeToDiskTable();
return getNewCachedObject(session, object);
}
Row row = new RowAVL(table, (Object[]) object);
int id = rowIdSequence++;
row.setPos(id);
rowIdMap.put(id, row);
if (isTempTable) {
RowAction.addAction(session, RowAction.ACTION_INSERT, (Table) table, row);
}
return row;
}
}
use of org.hsqldb_voltpatches.Row in project voltdb by VoltDB.
the class RowStoreAVLHybrid method changeToDiskTable.
public void changeToDiskTable() {
cache = session.sessionData.getResultCache();
if (cache != null) {
RowIterator iterator = table.rowIterator(this);
ArrayUtil.fillArray(accessorList, null);
isCached = true;
cache.storeCount++;
while (iterator.hasNext()) {
Row row = iterator.getNextRow();
Row newRow = (Row) getNewCachedObject(session, row.getData());
indexRow(null, newRow);
}
rowIdMap.clear();
}
maxMemoryRowCount = Integer.MAX_VALUE;
}
Aggregations