use of org.hsqldb_voltpatches.rowio.RowInputInterface in project voltdb by VoltDB.
the class DataFileDefrag method writeTransactionRows.
void writeTransactionRows() {
for (int i = 0, size = transactionRowLookup.size(); i < size; i++) {
if (transactionRowLookup.getValue(i) != 0) {
continue;
}
int key = transactionRowLookup.getKey(i);
try {
transactionRowLookup.setValue(i, (int) (fileOffset / scale));
RowInputInterface rowIn = cache.readObject(key);
fileStreamOut.write(rowIn.getBuffer(), 0, rowIn.getSize());
fileOffset += rowIn.getSize();
} catch (HsqlException e) {
} catch (IOException e) {
}
}
}
use of org.hsqldb_voltpatches.rowio.RowInputInterface in project voltdb by VoltDB.
the class DataFileCache method getFromFile.
private CachedObject getFromFile(int pos, PersistentStore store, boolean keep) {
CachedObject object = null;
boolean outOfMemory = false;
writeLock.lock();
try {
for (int j = 0; j < 5; j++) {
outOfMemory = false;
try {
RowInputInterface rowInput = readObject(pos);
if (rowInput == null) {
return null;
}
object = store.get(rowInput);
break;
} catch (OutOfMemoryError err) {
cache.cleanUp();
outOfMemory = true;
database.logger.appLog.logContext(err, null);
}
}
if (outOfMemory) {
throw Error.error(ErrorCode.OUT_OF_MEMORY);
}
// for text tables with empty rows at the beginning,
// pos may move forward in readObject
pos = object.getPos();
cache.put(pos, object);
if (keep) {
object.keepInMemory(true);
}
store.set(object);
return object;
} catch (HsqlException e) {
database.logger.appLog.logContext(e, fileName + " get pos: " + pos);
throw e;
} finally {
writeLock.unlock();
}
}
Aggregations