TransactionLogReader reader = log.getReader();
// reader may be null in the case of an empty file
if (reader == null) {
continue;
}
TransactionEdit edit = null;
while ((edit = reader.next()) != null) {
editCnt++;
switch (edit.getState()) {
case INPROGRESS:
addInProgressAndAdvance(edit.getWritePointer(), edit.getVisibilityUpperBound(),
edit.getExpiration(), edit.getNextWritePointer());
break;
case COMMITTING:
addCommittingChangeSet(edit.getWritePointer(), edit.getChanges());
break;
case COMMITTED:
doCommit(edit.getWritePointer(), edit.getChanges(),
edit.getNextWritePointer(), edit.getCanCommit());
break;
case INVALID:
doInvalidate(edit.getWritePointer());
break;
case ABORTED:
doAbort(edit.getWritePointer());
break;
default:
// unknown type!
throw new IllegalArgumentException("Invalid state for WAL entry: " + edit.getState());
}
}
} catch (IOException ioe) {
throw Throwables.propagate(ioe);
}