libfoedus-core
FOEDUS Core Library
|
A log mapper, which reads log files from one logger and sends them to corresponding log reducers. More...
A log mapper, which reads log files from one logger and sends them to corresponding log reducers.
Mappers read logs per epoch. As log files are guaranteed to be strictly ordered by epoch (see Logger code), we can simply read log files sequentially to achieve this.
Mappers send logs to partitions as follows:
The log gleaner so far simply reads from log files. We have a plan to optimize its behavior when we have a large amount of DRAM by directly reading from the log buffer if it is not blown away yet. ThreadLogBuffer has an additional marker "head" for this purpose, but so far we don't use it to simplify the implementation.
Definition at line 73 of file log_mapper_impl.hpp.
#include <log_mapper_impl.hpp>
Public Member Functions | |
LogMapper (Engine *engine, uint16_t local_ordinal) | |
ErrorStack | initialize_once () override |
ErrorStack | uninitialize_once () override |
std::string | to_string () const override |
Expects "LogReducer-x", "LogMapper-y" etc. More... | |
![]() | |
MapReduceBase (Engine *engine, uint16_t id) | |
MapReduceBase ()=delete | |
MapReduceBase (const MapReduceBase &other)=delete | |
MapReduceBase & | operator= (const MapReduceBase &other)=delete |
LogGleanerRef * | get_parent () |
uint16_t | get_id () const |
uint16_t | get_numa_node () const |
void | launch_thread () |
Start executing. More... | |
void | join_thread () |
![]() | |
DefaultInitializable () | |
virtual | ~DefaultInitializable () |
DefaultInitializable (const DefaultInitializable &)=delete | |
DefaultInitializable & | operator= (const DefaultInitializable &)=delete |
ErrorStack | initialize () override final |
Typical implementation of Initializable::initialize() that provides initialize-once semantics. More... | |
ErrorStack | uninitialize () override final |
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics. More... | |
bool | is_initialized () const override final |
Returns whether the object has been already initialized or not. More... | |
![]() | |
virtual | ~Initializable () |
Protected Member Functions | |
ErrorStack | handle_process () override |
Implements the specific logics in derived class. More... | |
![]() | |
ErrorCode | check_cancelled () const |
Derived class's handle_process() should occasionally call this to exit if it's cancelled. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const LogMapper &v) |
Additional Inherited Members | |
![]() | |
Engine *const | engine_ |
LogGleanerRef | parent_ |
const uint16_t | id_ |
Unique ID of this mapper or reducer. More... | |
const uint16_t | numa_node_ |
std::atomic< bool > | running_ |
only for sanity check More... | |
std::thread | thread_ |
foedus::snapshot::LogMapper::LogMapper | ( | Engine * | engine, |
uint16_t | local_ordinal | ||
) |
Definition at line 58 of file log_mapper_impl.cpp.
|
overrideprotectedvirtual |
Implements the specific logics in derived class.
Implements foedus::snapshot::MapReduceBase.
Definition at line 140 of file log_mapper_impl.cpp.
References foedus::snapshot::align_io_ceil(), foedus::snapshot::align_io_floor(), ASSERT_ND, foedus::log::LogRange::begin_file_ordinal, foedus::log::LogRange::begin_offset, foedus::snapshot::MapReduceBase::check_cancelled(), CHECK_ERROR, foedus::log::LogOptions::construct_suffixed_log_path(), foedus::debugging::StopWatch::elapsed_sec(), foedus::snapshot::SnapshotOptions::emulation_, foedus::log::LogRange::end_file_ordinal, foedus::log::LogRange::end_offset, foedus::snapshot::MapReduceBase::engine_, foedus::fs::file_size(), foedus::snapshot::LogGleanerRef::get_base_epoch(), foedus::Engine::get_log_manager(), foedus::log::LoggerRef::get_log_range(), foedus::log::LogManager::get_logger(), foedus::Engine::get_options(), foedus::memory::AlignedMemory::get_size(), foedus::snapshot::LogGleanerRef::get_valid_until_epoch(), foedus::snapshot::MapReduceBase::id_, foedus::log::LogRange::is_empty(), foedus::fs::DirectIoFile::kDirectIoSeekSet, foedus::kRetOk, foedus::EngineOptions::log_, foedus::snapshot::MapReduceBase::numa_node_, foedus::snapshot::MapReduceBase::parent_, foedus::EngineOptions::snapshot_, foedus::fs::status(), foedus::debugging::StopWatch::stop(), to_string(), and WRAP_ERROR_CODE.
|
overridevirtual |
Implements foedus::DefaultInitializable.
Definition at line 64 of file log_mapper_impl.cpp.
References foedus::memory::AlignedMemory::alloc(), ASSERT_ND, foedus::snapshot::MapReduceBase::engine_, foedus::Engine::get_options(), foedus::memory::AlignedMemory::is_null(), foedus::memory::kHugepageSize, foedus::memory::AlignedMemory::kNumaAllocOnnode, foedus::kRetOk, foedus::snapshot::SnapshotOptions::log_mapper_bucket_kb_, foedus::snapshot::SnapshotOptions::log_mapper_io_buffer_mb_, foedus::snapshot::MapReduceBase::numa_node_, and foedus::EngineOptions::snapshot_.
|
inlineoverridevirtual |
Expects "LogReducer-x", "LogMapper-y" etc.
Used only for logging/debugging.
Implements foedus::snapshot::MapReduceBase.
Definition at line 80 of file log_mapper_impl.hpp.
References foedus::snapshot::MapReduceBase::id_.
Referenced by handle_process().
|
overridevirtual |
Implements foedus::DefaultInitializable.
Definition at line 127 of file log_mapper_impl.cpp.
References foedus::memory::AlignedMemory::release_block(), and SUMMARIZE_ERROR_BATCH.
|
friend |
Definition at line 700 of file log_mapper_impl.cpp.