libfoedus-core
FOEDUS Core Library
|
Log Manager class that provides API to write/read transaction logs. More...
Log Manager class that provides API to write/read transaction logs.
Definition at line 36 of file log_manager.hpp.
#include <log_manager.hpp>
Public Member Functions | |
LogManager (Engine *engine) | |
~LogManager () | |
LogManager ()=delete | |
LogManager (const LogManager &)=delete | |
LogManager & | operator= (const LogManager &)=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... | |
void | copy_logger_states (savepoint::Savepoint *new_savepoint) |
Fillup the given savepoint with the current information of the loggers. More... | |
void | wakeup_loggers () |
Wake up loggers if they are sleeping. More... | |
LoggerRef | get_logger (LoggerId logger_id) |
Returns a reference to the logger of the given ID. More... | |
Epoch | get_durable_global_epoch () const |
Returns the durable epoch of the entire engine. More... | |
Epoch | get_durable_global_epoch_weak () const |
Non-atomic version of the method. More... | |
void | announce_new_durable_global_epoch (Epoch new_epoch) |
Sets the new global durable epoch and also wakes up threads that were waiting for it. More... | |
ErrorCode | wait_until_durable (Epoch commit_epoch, int64_t wait_microseconds=-1) |
Synchronously blocks until the durable global epoch reaches the given commit epoch or the given duration elapses. More... | |
ErrorStack | refresh_global_durable_epoch () |
Called whenever there is a chance that the global durable epoch advances. More... | |
MetaLogger * | get_meta_logger () |
MetaLogBuffer * | get_meta_buffer () |
![]() | |
virtual | ~Initializable () |
|
explicit |
Definition at line 23 of file log_manager.cpp.
foedus::log::LogManager::~LogManager | ( | ) |
Definition at line 26 of file log_manager.cpp.
|
delete |
|
delete |
void foedus::log::LogManager::announce_new_durable_global_epoch | ( | Epoch | new_epoch | ) |
Sets the new global durable epoch and also wakes up threads that were waiting for it.
Definition at line 42 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::announce_new_durable_global_epoch().
Referenced by foedus::savepoint::SavepointManagerPimpl::savepoint_main().
void foedus::log::LogManager::copy_logger_states | ( | savepoint::Savepoint * | new_savepoint | ) |
Fillup the given savepoint with the current information of the loggers.
This is called as a part of taking a savepoint.
Definition at line 57 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::copy_logger_states().
Referenced by foedus::savepoint::SavepointManagerPimpl::savepoint_main().
Epoch foedus::log::LogManager::get_durable_global_epoch | ( | ) | const |
Returns the durable epoch of the entire engine.
This value indicates upto what commit-groups we can return results to client programs. This value is advanced by checking the durable epoch of each logger.
Definition at line 36 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::get_durable_global_epoch().
Referenced by foedus::Engine::get_durable_global_epoch(), foedus::snapshot::SnapshotManagerPimpl::handle_snapshot(), foedus::snapshot::SnapshotManagerPimpl::handle_snapshot_triggered(), foedus::restart::RestartManagerPimpl::recover(), and foedus::snapshot::SnapshotManagerPimpl::trigger_snapshot_immediate().
Epoch foedus::log::LogManager::get_durable_global_epoch_weak | ( | ) | const |
Non-atomic version of the method.
Definition at line 39 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::get_durable_global_epoch_weak().
Referenced by foedus::xct::XctManagerPimpl::precommit_xct_verify_readonly().
Returns a reference to the logger of the given ID.
Definition at line 49 of file log_manager.cpp.
References ASSERT_ND, and foedus::log::LogManagerPimpl::logger_refs_.
Referenced by foedus::log::EpochMarkerLogType::apply_engine(), and foedus::snapshot::LogMapper::handle_process().
MetaLogBuffer * foedus::log::LogManager::get_meta_buffer | ( | ) |
Definition at line 61 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::meta_buffer_.
Referenced by foedus::storage::StorageManagerPimpl::create_storage_and_log(), foedus::storage::StorageManagerPimpl::drop_storage(), and foedus::storage::sequential::SequentialStoragePimpl::truncate().
MetaLogger * foedus::log::LogManager::get_meta_logger | ( | ) |
Definition at line 65 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::meta_logger_.
|
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 31 of file log_manager.cpp.
References foedus::DefaultInitializable::initialize().
|
overridevirtual |
Returns whether the object has been already initialized or not.
Implements foedus::Initializable.
Definition at line 32 of file log_manager.cpp.
References foedus::DefaultInitializable::is_initialized().
Referenced by foedus::storage::StorageManagerPimpl::initialize_once(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::storage::StorageManagerPimpl::uninitialize_once(), and foedus::snapshot::SnapshotManagerPimpl::uninitialize_once().
|
delete |
ErrorStack foedus::log::LogManager::refresh_global_durable_epoch | ( | ) |
Called whenever there is a chance that the global durable epoch advances.
Each logger calls this method when they advance their local durable epoch, which may or may not advance the global durable epoch. This method recalculates global durable epoch.
Definition at line 54 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::refresh_global_durable_epoch().
|
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 33 of file log_manager.cpp.
References foedus::DefaultInitializable::uninitialize().
ErrorCode foedus::log::LogManager::wait_until_durable | ( | Epoch | commit_epoch, |
int64_t | wait_microseconds = -1 |
||
) |
Synchronously blocks until the durable global epoch reaches the given commit epoch or the given duration elapses.
[in] | commit_epoch | Returns kRetOk iff the durable global epoch reaches this value. |
[in] | wait_microseconds | Or, returns a TIMEOUT error when this duration elapses, whichever comes first. Negative value means waiting forever. 0 means conditional, immediately returning without blocking, which is useful to quickly check the committed-ness. |
Client programs can either call this method for each transaction right after precommit_xct() or call this method after a bunch of precommit_xct() calls (group-commit). In either case, remember that both read-only and read-write transactions must not return results to clients until the durable global epoch reaches the given commit epoch. Otherwise, you violate serializability (which might be okay depending on your desired isolation level).
Definition at line 46 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::wait_until_durable().
Referenced by foedus::xct::XctManagerPimpl::wait_for_commit().
void foedus::log::LogManager::wakeup_loggers | ( | ) |
Wake up loggers if they are sleeping.
This method might be called from several places for various events to make sure loggers catch up. As far as you don't call this method too often, like tens of thousands times per second, it wouldn't hurt.
Definition at line 35 of file log_manager.cpp.
References foedus::log::LogManagerPimpl::wakeup_loggers().
Referenced by foedus::xct::XctManagerPimpl::handle_epoch_chime(), and foedus::log::ThreadLogBuffer::wait_for_space().