Logging subsystem¶ ↑
This subsystem is used when recovery from application or system failure is necessary.
The log is stored in one or more files in the environment directory. Each file is named using the format log.NNNNNNNNNN, where NNNNNNNNNN is the sequence number of the file within the log.
If the log region is being created and log files are already present, the log files are reviewed and subsequent log writes are appended to the end of the log, rather than overwriting current log entries.
The lock subsystem is created, initialized, and opened by calls to BDB::Env#open with the BDB::INIT_LOG flag specified.
The following options can be given when the environnement is created
- +“set_lg_bsize”+
-
Set log buffer size
- +“set_lg_dir”+
-
Set the environment logging directory
- +“set_lg_max”+
-
Set log file size
BDB::Env¶ ↑
Methods¶ ↑
log_archive(flags = 0)-
The log_archive function return an array of log or database file names.
flagsvalue must be set to 0 or the valueBDB::ARCH_DATA((|BDB::ARCH_DATA|)), ((|BDB::ARCH_LOG|))
log_checkpoint(string)-
same as +log_put(string, BDB::CHECKPOINT)+
log_curlsn(string)-
same as +log_put(string, BDB::CURLSN)+
log_each { |string, lsn| ... }-
Implement an iterator inside of the log
log_flush([string])-
same as +log_put(string, BDB::FLUSH)+
Without argument, garantee that all records are written to the disk
log_get(flag)-
The
log_getreturn an array +[String, BDB::Lsn]+ according to theflagvalue.flagcan has the valueBDB::CHECKPOINT,BDB::FIRST,BDB::LAST,BDB::NEXT,BDB::PREV,BDB::CURRENT log_put(string, flag = 0)-
The
log_putfunction appends records to the log. It return an objectBDB::Lsnflagcan have the valueBDB::CHECKPOINT,BDB::CURLSN,BDB::FLUSH log_reverse_each { |string, lsn| ... }-
Implement an iterator inside of the log
log_stat-
return log statistics
BDB::Common¶ ↑
Methods¶ ↑
log_register(name)-
The
log_registerfunction registers a filename. log_unregister()-
The
log_unregisterfunction unregisters a file name.
BDB::Lsn¶ ↑
include Comparable
<=>-
compare 2
BDB::Lsn log_file(name)file(name)-
The
log_filefunction mapsBDB::Lsnstructures to file +name+s log_flushflush-
The
log_flushfunction guarantees that all log records whoseDBB:Lsnare less than or equal to the current lsn have been written to disk. log_getget-
return the
Stringassociated with thisBDB::Lsn