simpledb.tx.recovery
Class RecoveryMgr

java.lang.Object
  extended by simpledb.tx.recovery.RecoveryMgr

public class RecoveryMgr
extends Object

The recovery manager. Each transaction has its own recovery manager.

Author:
Edward Sciore

Constructor Summary
RecoveryMgr(int txnum)
          Creates a recovery manager for the specified transaction.
 
Method Summary
 void commit()
          Writes a commit record to the log, and flushes it to disk.
 void recover()
          Recovers uncompleted transactions from the log, then writes a quiescent checkpoint record to the log and flushes it.
 void rollback()
          Writes a rollback record to the log, and flushes it to disk.
 int setInt(Buffer buff, int offset, int newval)
          Writes a setint record to the log, and returns its lsn.
 int setString(Buffer buff, int offset, String newval)
          Writes a setstring record to the log, and returns its lsn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecoveryMgr

public RecoveryMgr(int txnum)
Creates a recovery manager for the specified transaction.

Parameters:
txnum - the ID of the specified transaction
Method Detail

commit

public void commit()
Writes a commit record to the log, and flushes it to disk.


rollback

public void rollback()
Writes a rollback record to the log, and flushes it to disk.


recover

public void recover()
Recovers uncompleted transactions from the log, then writes a quiescent checkpoint record to the log and flushes it.


setInt

public int setInt(Buffer buff,
                  int offset,
                  int newval)
Writes a setint record to the log, and returns its lsn. Updates to temporary files are not logged; instead, a "dummy" negative lsn is returned.

Parameters:
buff - the buffer containing the page
offset - the offset of the value in the page
newval - the value to be written

setString

public int setString(Buffer buff,
                     int offset,
                     String newval)
Writes a setstring record to the log, and returns its lsn. Updates to temporary files are not logged; instead, a "dummy" negative lsn is returned.

Parameters:
buff - the buffer containing the page
offset - the offset of the value in the page
newval - the value to be written


Copyright © 2011. All Rights Reserved.