|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.log.LogSystem
public class LogSystem
The transaction log system is responsible for the write ahead log mechanism
used in this database. A number of LogFile
objects are used (one for
each file).
Field Summary | |
---|---|
static int |
LOG_WRITTEN
This special log position means that the log entry has been written. |
Constructor Summary | |
---|---|
LogSystem(Database database,
java.lang.String fileNamePrefix,
boolean readOnly,
java.lang.String accessMode,
PageStore pageStore)
Create new transaction log object. |
Method Summary | |
---|---|
void |
add(Session session,
DiskFile file,
Record record)
Add an log entry to the last transaction log file. |
void |
addTruncate(Session session,
DiskFile file,
int storageId,
int recordId,
int blockCount)
Add a truncate entry. |
void |
checkpoint()
Flush all data to the transaction log files as well as to the data files and and switch log files. |
void |
close(boolean checkpoint)
Close all log files. |
void |
commit(Session session)
Commit the current transaction of the given session. |
boolean |
containsInDoubtTransactions()
Check if there are any in-doubt transactions. |
void |
flush()
Flush all pending changes to the transaction log files. |
ObjectArray<LogFile> |
getActiveLogFiles()
Get all active log files. |
boolean |
getFlushOnEachCommit()
Check if flush-on-each-commit is enabled. |
ObjectArray<InDoubtTransaction> |
getInDoubtTransactions()
Get the list of in-doubt transactions. |
java.lang.String |
getWritePos()
Get the write position. |
void |
invalidateIndexSummary()
Write a log entry meaning the index summary is invalid. |
void |
open()
Open all existing transaction log files and create a new one if required. |
void |
prepareCommit(Session session,
java.lang.String transaction)
Prepare a transaction. |
boolean |
recover()
Roll back any uncommitted transactions if required, and apply committed changed to the data files. |
void |
setDisabled(boolean disabled)
Enable or disable the transaction log |
void |
setFlushOnEachCommit(boolean b)
Enable or disable-flush-on-each-commit. |
void |
setMaxLogSize(long maxSize)
Set the maximum log file size in megabytes. |
void |
setReadOnly(boolean readOnly)
Set the read only flag for this log system. |
void |
sync()
Flush the transaction log file and sync the data to disk. |
void |
updateKeepFiles(int incrementDecrement)
Increment or decrement the flag to keep (not delete) old log files. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LOG_WRITTEN
Constructor Detail |
---|
public LogSystem(Database database, java.lang.String fileNamePrefix, boolean readOnly, java.lang.String accessMode, PageStore pageStore)
database
- the databasefileNamePrefix
- the name of the database filereadOnly
- if the log should be opened in read-only modeaccessMode
- the file access mode (r, rw, rws, rwd)pageStore
- the page storeMethod Detail |
---|
public void setMaxLogSize(long maxSize)
maxSize
- the new maximum log file sizepublic boolean containsInDoubtTransactions()
public void close(boolean checkpoint) throws java.sql.SQLException
checkpoint
- if a checkpoint should be written
java.sql.SQLException
public boolean recover() throws java.sql.SQLException
java.sql.SQLException
public void open() throws java.sql.SQLException
java.sql.SQLException
public ObjectArray<InDoubtTransaction> getInDoubtTransactions()
public void prepareCommit(Session session, java.lang.String transaction) throws java.sql.SQLException
session
- the sessiontransaction
- the name of the transaction
java.sql.SQLException
public void commit(Session session) throws java.sql.SQLException
session
- the session
java.sql.SQLException
public void flush() throws java.sql.SQLException
java.sql.SQLException
public void addTruncate(Session session, DiskFile file, int storageId, int recordId, int blockCount) throws java.sql.SQLException
session
- the sessionfile
- the disk filestorageId
- the storage idrecordId
- the id of the first recordblockCount
- the number of blocks
java.sql.SQLException
public void add(Session session, DiskFile file, Record record) throws java.sql.SQLException
session
- the sessionfile
- the filerecord
- the record to log
java.sql.SQLException
public void checkpoint() throws java.sql.SQLException
java.sql.SQLException
public ObjectArray<LogFile> getActiveLogFiles()
public void setFlushOnEachCommit(boolean b)
b
- the new valuepublic boolean getFlushOnEachCommit()
public void sync() throws java.sql.SQLException
java.sql.SQLException
public void setDisabled(boolean disabled)
disabled
- true if the log should be switched offpublic void setReadOnly(boolean readOnly)
readOnly
- the new valuepublic void invalidateIndexSummary() throws java.sql.SQLException
java.sql.SQLException
public void updateKeepFiles(int incrementDecrement)
incrementDecrement
- (1 to increment, -1 to decrement)public java.lang.String getWritePos()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |