libfoedus-core
FOEDUS Core Library
foedus::savepoint Namespace Reference

Savepoint Manager, which durably and atomically remembers what happened in the engine occasionally (eg. More...

Detailed Description

Savepoint Manager, which durably and atomically remembers what happened in the engine occasionally (eg.

every group commit).

Overview
In nutshell, this package durably and atomically (*) writes out a tiny file (savepoint file) whenever we advance the global epoch, replacing the savepoint file durably and atomically. The savepoint file is an XML file that describes the progress of individual loggers, log gleaners, and whatever we have to take note for durability and serializablity. These are very compact data, essentially only one or two integers per modules/threads. Thus, the dominating cost is fsync(), which is not cheap but we are okay to pay assuming epoch-based commit and reasonably fast media (SSD/NVRAM).
Why XML
As writing savepoint files happens only occasionally, file format doesn't matter for performance. Thus, we use XML for better debuggability and flexibility. We already use tinyxml for config files, so why not.
Terminology
We named this package savepoint rather than checkpoint. Checkpoint has a slightly different meaning in DBMS, so we avoid that. Savepoint also has a different meaning in DBMS, but it's very different, so no confusion.
See also
foedus::fs::durable_atomic_rename()

Classes

struct  FixedSavepoint
 Savepoint that can be stored in shared memory. More...
 
struct  LoggerSavepointInfo
 Information in savepoint for one logger. More...
 
struct  Savepoint
 The information we maintain in savepoint manager and externalize to a file. More...
 
class  SavepointManager
 Savepoint manager that atomically and durably writes out a savepoint file. More...
 
struct  SavepointManagerControlBlock
 Shared data in SavepointManagerPimpl. More...
 
class  SavepointManagerPimpl
 Pimpl object of SavepointManager. More...
 
struct  SavepointOptions
 Set of options for savepoint manager. More...
 

Class Documentation

struct foedus::savepoint::LoggerSavepointInfo

Information in savepoint for one logger.

Definition at line 140 of file savepoint.hpp.

Class Members
LogFileOrdinal current_log_file_ Indicates the log file each logger is currently appending to.
uint64_t current_log_file_offset_durable_ Indicates the exclusive end of durable region in the current log file.

In other words, epochs are larger than durable_epoch_ from this offset. During restart, current log files are truncated to this size to discard incomplete logs.

LogFileOrdinal oldest_log_file_ Ordinal of the oldest active log file in each logger.
Invariant
oldest_log_files_[x] <= current_log_files_[x]

Each logger writes out files suffixed with ordinal (eg ".0", ".1"...). The older logs files are deactivated and deleted after log gleaner consumes them. This variable indicates the oldest active file for each logger.

uint64_t oldest_log_file_offset_begin_ Indicates the inclusive beginning of active region in the oldest log file.