|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectsimpledb.LogFile
public class LogFile
The format of the log file is as follows:
| Field Summary | |
|---|---|
(package private) static int |
ABORT_RECORD
|
(package private) static int |
BEGIN_RECORD
|
(package private) static int |
CHECKPOINT_RECORD
|
(package private) static int |
COMMIT_RECORD
|
(package private) long |
currentOffset
|
(package private) static int |
INT_SIZE
|
(package private) java.io.File |
logFile
|
(package private) static int |
LONG_SIZE
|
(package private) static long |
NO_CHECKPOINT_ID
|
(package private) int |
pageSize
|
(package private) java.io.RandomAccessFile |
raf
|
(package private) java.lang.Boolean |
recoveryUndecided
|
(package private) java.util.HashMap<java.lang.Long,java.lang.Long> |
tidToFirstLogRecord
|
(package private) int |
totalRecords
|
(package private) static int |
UPDATE_RECORD
|
| Constructor Summary | |
|---|---|
LogFile(java.io.File f)
Constructor. |
|
| Method Summary | |
|---|---|
void |
force()
|
int |
getTotalRecords()
|
void |
logAbort(TransactionId tid)
Write an abort record to the log for the specified tid, force the log to disk, and perform a rollback |
void |
logCheckpoint()
Checkpoint the log and write a checkpoint record. |
void |
logCommit(TransactionId tid)
Write a commit record to disk for the specified tid, and force the log to disk. |
void |
logTruncate()
Truncate any unneeded portion of the log to reduce its space consumption |
void |
logWrite(TransactionId tid,
Page before,
Page after)
Write an UPDATE record to disk for the specified tid and page (with provided before and after images.) |
void |
logXactionBegin(TransactionId tid)
Write a BEGIN record for the specified transaction |
(package private) void |
preAppend()
|
void |
print()
Print out a human readable represenation of the log |
(package private) Page |
readPageData(java.io.RandomAccessFile raf)
|
void |
recover()
Recover the database system by ensuring that the updates of committed transactions are installed and that the updates of uncommitted transactions are not installed. |
void |
rollback(TransactionId tid)
Rollback the specified transaction, setting the state of any of pages it updated to their pre-updated state. |
void |
shutdown()
Shutdown the logging system, writing out whatever state is necessary so that start up can happen quickly (without extensive recovery.) |
(package private) void |
writePageData(java.io.RandomAccessFile raf,
Page p)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
java.io.File logFile
java.io.RandomAccessFile raf
java.lang.Boolean recoveryUndecided
static final int ABORT_RECORD
static final int COMMIT_RECORD
static final int UPDATE_RECORD
static final int BEGIN_RECORD
static final int CHECKPOINT_RECORD
static final long NO_CHECKPOINT_ID
static int INT_SIZE
static int LONG_SIZE
long currentOffset
int pageSize
int totalRecords
java.util.HashMap<java.lang.Long,java.lang.Long> tidToFirstLogRecord
| Constructor Detail |
|---|
public LogFile(java.io.File f)
throws java.io.IOException
f - The log file's name
java.io.IOException| Method Detail |
|---|
void preAppend()
throws java.io.IOException
java.io.IOExceptionpublic int getTotalRecords()
public void logAbort(TransactionId tid)
throws java.io.IOException
tid - The aborting transaction.
java.io.IOException
public void logCommit(TransactionId tid)
throws java.io.IOException
tid - The committing transaction.
java.io.IOException
public void logWrite(TransactionId tid,
Page before,
Page after)
throws java.io.IOException
tid - The transaction performing the writebefore - The before image of the pageafter - The after image of the page
java.io.IOExceptionPage.getBeforeImage()
void writePageData(java.io.RandomAccessFile raf,
Page p)
throws java.io.IOException
java.io.IOException
Page readPageData(java.io.RandomAccessFile raf)
throws java.io.IOException
java.io.IOException
public void logXactionBegin(TransactionId tid)
throws java.io.IOException
tid - The transaction that is beginning
java.io.IOException
public void logCheckpoint()
throws java.io.IOException
java.io.IOException
public void logTruncate()
throws java.io.IOException
java.io.IOException
public void rollback(TransactionId tid)
throws java.util.NoSuchElementException,
java.io.IOException
tid - The transaction to rollback
java.util.NoSuchElementException
java.io.IOExceptionpublic void shutdown()
public void recover()
throws java.io.IOException
java.io.IOException
public void print()
throws java.io.IOException
java.io.IOException
public void force()
throws java.io.IOException
java.io.IOException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||