}
private void recoverTransactionEntry(final byte status, final byte operation, final int txId, final ORecordId iRid,
final long oldDataOffset, final int recordVersion, final OPhysicalPosition ppos) throws IOException {
final OCluster cluster = storage.getClusterById(iRid.clusterId);
if (!(cluster instanceof OClusterLocal))
return;
final OClusterLocal logCluster = (OClusterLocal) cluster;
OLogManager.instance().info(this, "Recovering tx <%d>. Operation <%d> was in status <%d> on record %s in data space %d...",
txId, operation, status, iRid, oldDataOffset);
switch (operation) {
case OPERATION_CREATE:
// JUST DELETE THE RECORD
storage.deleteRecord(iRid, -1);
break;
case OPERATION_UPDATE:
// RETRIEVE THE OLD RECORD
// final int recSize = storage.getDataSegment(ppos.dataSegment).getRecordSize(oldDataOffset);
// RETRIEVE THE CURRENT PPOS
cluster.getPhysicalPosition(iRid.clusterPosition, ppos);
long newPosition = ppos.dataPosition;
int newSize = ppos.recordSize;
// REPLACE THE POSITION OF THE OLD RECORD
ppos.dataPosition = oldDataOffset;
// UPDATE THE PPOS WITH THE COORDS OF THE OLD RECORD
storage.getClusterById(iRid.clusterId).setPhysicalPosition(iRid.clusterPosition, ppos.dataSegment, oldDataOffset, ppos.type);
// CREATE A HOLE
storage.getDataSegment(ppos.dataSegment).handleHole(newPosition, newSize);
break;
case OPERATION_DELETE:
// GET THE PPOS
cluster.getPhysicalPosition(iRid.clusterPosition, ppos);
// SAVE THE PPOS WITH THE VERSION TO 0 (VALID IF >-1)
cluster.updateVersion(iRid.clusterPosition, 0);
// REMOVE THE HOLE
logCluster.removeHole(iRid.clusterPosition);
break;
}