libfoedus-core
FOEDUS Core Library
|
Savepoint manager that atomically and durably writes out a savepoint file. More...
Savepoint manager that atomically and durably writes out a savepoint file.
Definition at line 32 of file savepoint_manager.hpp.
#include <savepoint_manager.hpp>
Public Member Functions | |
SavepointManager (Engine *engine) | |
~SavepointManager () | |
SavepointManager ()=delete | |
SavepointManager (const SavepointManager &)=delete | |
SavepointManager & | operator= (const SavepointManager &)=delete |
ErrorStack | initialize () override |
Acquires resources in this object, usually called right after constructor. More... | |
bool | is_initialized () const override |
Returns whether the object has been already initialized or not. More... | |
ErrorStack | uninitialize () override |
An idempotent method to release all resources of this object, if any. More... | |
LoggerSavepointInfo | get_logger_savepoint (log::LoggerId logger_id) |
Returns the saved information of the given logger in latest savepoint. More... | |
void | get_meta_logger_offsets (uint64_t *oldest_offset, uint64_t *durable_offset) const |
Returns the saved information of metadata logger in lateset savepoint. More... | |
void | change_meta_logger_durable_offset (uint64_t durable_offset) |
Rewrites meta logger's durable_offset. More... | |
Epoch | get_initial_current_epoch () const |
Epoch | get_initial_durable_epoch () const |
Epoch | get_earliest_epoch () const |
Epoch | get_saved_durable_epoch () const |
snapshot::SnapshotId | get_latest_snapshot_id () const |
Epoch | get_latest_snapshot_epoch () const |
ErrorStack | take_savepoint (Epoch new_global_durable_epoch) |
Atomically and durably takes a savepoint for the given epoch advancement. More... | |
ErrorStack | take_savepoint_after_snapshot (snapshot::SnapshotId new_snapshot_id, Epoch new_snapshot_epoch) |
Takes a savepoint just to remember the newly taken snapshot. More... | |
![]() | |
virtual | ~Initializable () |
|
explicit |
Definition at line 24 of file savepoint_manager.cpp.
foedus::savepoint::SavepointManager::~SavepointManager | ( | ) |
Definition at line 27 of file savepoint_manager.cpp.
|
delete |
|
delete |
void foedus::savepoint::SavepointManager::change_meta_logger_durable_offset | ( | uint64_t | durable_offset | ) |
Rewrites meta logger's durable_offset.
This is required because meta logger might adjust its "locally durable" offset at startup. Once we emit "globally durable" offset of meta logger in savepoint, we won't need it. but we do for now.
Definition at line 76 of file savepoint_manager.cpp.
References ASSERT_ND, foedus::savepoint::SavepointManagerPimpl::control_block_, foedus::savepoint::FixedSavepoint::meta_log_durable_offset_, and foedus::savepoint::SavepointManagerControlBlock::savepoint_.
Epoch foedus::savepoint::SavepointManager::get_earliest_epoch | ( | ) | const |
Definition at line 42 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_earliest_epoch().
Referenced by foedus::Engine::get_earliest_epoch().
Epoch foedus::savepoint::SavepointManager::get_initial_current_epoch | ( | ) | const |
Definition at line 36 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_initial_current_epoch().
Referenced by foedus::storage::array::array_volatile_page_init(), foedus::xct::Xct::initialize(), foedus::xct::XctManagerPimpl::initialize_once(), foedus::log::ThreadLogBuffer::initialize_once(), and foedus::storage::array::ArrayStoragePimpl::load_empty().
Epoch foedus::savepoint::SavepointManager::get_initial_durable_epoch | ( | ) | const |
Definition at line 39 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_initial_durable_epoch().
Referenced by foedus::storage::array::ArrayComposer::construct_root(), foedus::log::LogManagerPimpl::initialize_once(), foedus::log::Logger::initialize_once(), and foedus::log::ThreadLogBuffer::initialize_once().
Epoch foedus::savepoint::SavepointManager::get_latest_snapshot_epoch | ( | ) | const |
Definition at line 52 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_latest_snapshot_epoch().
Referenced by foedus::snapshot::SnapshotManagerPimpl::initialize_once(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_savepoint().
snapshot::SnapshotId foedus::savepoint::SavepointManager::get_latest_snapshot_id | ( | ) | const |
Definition at line 49 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_latest_snapshot_id().
Referenced by foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_savepoint().
LoggerSavepointInfo foedus::savepoint::SavepointManager::get_logger_savepoint | ( | log::LoggerId | logger_id | ) |
Returns the saved information of the given logger in latest savepoint.
Note that this is a read-only access, which might see a stale information if it's in race condition. However, we take a lock before copying the entire information. Thus, this method is slow but safe. No garbage information returned.
Definition at line 65 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_logger_savepoint().
Referenced by foedus::log::Logger::initialize_once().
void foedus::savepoint::SavepointManager::get_meta_logger_offsets | ( | uint64_t * | oldest_offset, |
uint64_t * | durable_offset | ||
) | const |
Returns the saved information of metadata logger in lateset savepoint.
Definition at line 69 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::control_block_, foedus::savepoint::FixedSavepoint::meta_log_durable_offset_, foedus::savepoint::FixedSavepoint::meta_log_oldest_offset_, and foedus::savepoint::SavepointManagerControlBlock::savepoint_.
Referenced by foedus::log::MetaLogger::initialize_once(), and foedus::restart::RestartManagerPimpl::redo_meta_logs().
Epoch foedus::savepoint::SavepointManager::get_saved_durable_epoch | ( | ) | const |
Definition at line 46 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::get_saved_durable_epoch().
Referenced by foedus::log::MetaLogger::initialize_once().
|
overridevirtual |
Acquires resources in this object, usually called right after constructor.
If and only if the return value was not an error, is_initialized() will return TRUE. This method is usually not idempotent, but some implementation can choose to be. In that case, the implementation class should clarify that it's idempotent. This method is responsible for releasing all acquired resources when initialization fails. This method itself is NOT thread-safe. Do not call this in a racy situation.
Implements foedus::Initializable.
Definition at line 32 of file savepoint_manager.cpp.
References foedus::DefaultInitializable::initialize().
|
overridevirtual |
Returns whether the object has been already initialized or not.
Implements foedus::Initializable.
Definition at line 33 of file savepoint_manager.cpp.
References foedus::DefaultInitializable::is_initialized().
Referenced by foedus::log::LogManagerPimpl::initialize_once(), and foedus::log::LogManagerPimpl::uninitialize_once().
|
delete |
ErrorStack foedus::savepoint::SavepointManager::take_savepoint | ( | Epoch | new_global_durable_epoch | ) |
Atomically and durably takes a savepoint for the given epoch advancement.
This is called from log manager when it sees all loggers flushed their logs up to the given epoch BEFORE the log manager announces the new global durable epoch to others. This is the last step in the system to adavance a global durable epoch, thus officially committing transactions in the epoch. Until this method completes, the transactions are not yet committed.
Definition at line 56 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::take_savepoint().
Referenced by foedus::log::LogManagerPimpl::refresh_global_durable_epoch().
ErrorStack foedus::savepoint::SavepointManager::take_savepoint_after_snapshot | ( | snapshot::SnapshotId | new_snapshot_id, |
Epoch | new_snapshot_epoch | ||
) |
Takes a savepoint just to remember the newly taken snapshot.
This is only called from snapshot manager after it writes out all snapshot files and metadata. The new snapshot is deemed as effective once this method completes.
Definition at line 59 of file savepoint_manager.cpp.
References foedus::savepoint::SavepointManagerPimpl::take_savepoint_after_snapshot().
Referenced by foedus::snapshot::SnapshotManagerPimpl::snapshot_savepoint().
|
overridevirtual |
An idempotent method to release all resources of this object, if any.
After this method, is_initialized() will return FALSE. Whether this method encounters an error or not, the implementation should make the best effort to release as many resources as possible. In other words, Do not leak all resources because of one issue. This method itself is NOT thread-safe. Do not call this in a racy situation.
Implements foedus::Initializable.
Definition at line 34 of file savepoint_manager.cpp.
References foedus::DefaultInitializable::uninitialize().