Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogRecovery ¶
type LogRecovery struct {
// contains filtered or unexported fields
}
*
- Read log file from disk, redo and undo.
func NewLogRecovery ¶
func NewLogRecovery(disk_manager disk.DiskManager, buffer_pool_manager *buffer.BufferPoolManager, log_manager *recovery.LogManager) *LogRecovery
func (*LogRecovery) DeserializeLogRecord ¶
func (log_recovery *LogRecovery) DeserializeLogRecord(data []byte, log_record *recovery.LogRecord) bool
* deserialize a log record from log buffer * @return: true means deserialize succeed, otherwise can't deserialize cause * incomplete log record
func (*LogRecovery) Redo ¶
func (log_recovery *LogRecovery) Redo(txn *access.Transaction) (types.LSN, bool, bool)
*redo phase on TABLE PAGE level(table/table_page.h) *read log file from the beginning to end (you must prefetch log records into *log buffer to reduce unnecessary I/O operations), remember to compare page's *LSN with log_record's sequence number, and also build active_txn table & *lsn_mapping table * first return value: greatest LSN of log entries * second return value: when undo operation is needed, value is true * third return value: when graceful shutdown is detected, value is true
func (*LogRecovery) Undo ¶
func (log_recovery *LogRecovery) Undo(txn *access.Transaction) bool
*undo phase on TABLE PAGE level(table/table_page.h) *iterate through active txn map and undo each operation * when undo operation occured, return value becomes true