libfoedus-core
FOEDUS Core Library
|
A remote view of LogReducer from all engines. More...
A remote view of LogReducer from all engines.
Definition at line 40 of file log_reducer_ref.hpp.
#include <log_reducer_ref.hpp>
Public Member Functions | |
LogReducerRef () | |
LogReducerRef (Engine *engine, uint16_t node) | |
uint16_t | get_id () const |
std::string | to_string () const |
void | clear () |
uint32_t | get_total_storage_count () const |
storage::Page * | get_root_info_pages () |
void | append_log_chunk (storage::StorageId storage_id, const char *send_buffer, uint32_t log_count, uint64_t send_buffer_size, uint32_t shortest_key_length, uint32_t longest_key_length) |
Append the log entries of one storage in the given buffer to this reducer's buffer. More... | |
Protected Member Functions | |
const Snapshot & | get_cur_snapshot () const |
uint64_t | get_buffer_size () const |
uint32_t | get_current_buffer_index_atomic () const |
void * | get_buffer (uint32_t index) const |
bool | verify_log_chunk (storage::StorageId storage_id, const char *send_buffer, uint32_t log_count, uint64_t send_buffer_size) const |
used only in debug mode More... | |
Protected Attributes | |
Engine * | engine_ |
LogReducerControlBlock * | control_block_ |
void * | buffers_ [2] |
storage::Page * | root_info_pages_ |
Friends | |
std::ostream & | operator<< (std::ostream &o, const LogReducerRef &v) |
|
inline |
Definition at line 42 of file log_reducer_ref.hpp.
References buffers_, control_block_, CXX11_NULLPTR, engine_, and root_info_pages_.
foedus::snapshot::LogReducerRef::LogReducerRef | ( | Engine * | engine, |
uint16_t | node | ||
) |
Definition at line 36 of file log_reducer_ref.cpp.
References buffers_, control_block_, engine_, foedus::soc::SharedMemoryRepo::get_node_memory_anchors(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), foedus::soc::NodeMemoryAnchors::log_reducer_buffers_, foedus::soc::NodeMemoryAnchors::log_reducer_memory_, foedus::soc::NodeMemoryAnchors::log_reducer_root_info_pages_, and root_info_pages_.
void foedus::snapshot::LogReducerRef::append_log_chunk | ( | storage::StorageId | storage_id, |
const char * | send_buffer, | ||
uint32_t | log_count, | ||
uint64_t | send_buffer_size, | ||
uint32_t | shortest_key_length, | ||
uint32_t | longest_key_length | ||
) |
Append the log entries of one storage in the given buffer to this reducer's buffer.
[in] | storage_id | all log entries are of this storage |
[in] | send_buffer | contains log entries to copy |
[in] | log_count | number of log entries to copy |
[in] | send_buffer_size | byte count to copy |
[in] | shortest_key_length | [masstree/hash] shortest key length in the log entries |
[in] | longest_key_length | [masstree/hash] longest key length in the log entries |
This is the interface via which mappers send log entries to reducers. Internally, this atomically changes the status of the current reducer buffer to reserve a contiguous space and then copy without blocking other mappers. If this methods hits a situation where the current buffer becomes full, this methods wakes up the reducer and lets it switch the current buffer. All log entries are contiguously copied. One block doesn't span two buffers.
Definition at line 121 of file log_reducer_ref.cpp.
References foedus::snapshot::ReducerBufferStatus::Components::active_writers_, ASSERT_ND, foedus::snapshot::BlockHeaderBase::block_length_, buffers_, foedus::snapshot::ReducerBufferStatus::components, control_block_, foedus::debugging::RdtscWatch::elapsed(), engine_, foedus::snapshot::ReducerBufferStatus::Components::flags_, foedus::snapshot::from_buffer_position(), get_buffer(), get_buffer_size(), foedus::snapshot::LogReducerControlBlock::get_buffer_status_address(), foedus::snapshot::LogReducerControlBlock::get_buffer_status_atomic(), get_current_buffer_index_atomic(), foedus::Engine::get_options(), foedus::snapshot::kFlagNoMoreWriters, foedus::snapshot::BlockHeaderBase::kFullBlockHeaderMagicWord, foedus::snapshot::FullBlockHeader::log_count_, foedus::snapshot::SnapshotOptions::log_reducer_buffer_mb_, foedus::snapshot::FullBlockHeader::longest_key_length_, foedus::snapshot::BlockHeaderBase::magic_word_, foedus::snapshot::FullBlockHeader::shortest_key_length_, foedus::EngineOptions::snapshot_, foedus::debugging::RdtscWatch::stop(), foedus::snapshot::FullBlockHeader::storage_id_, foedus::snapshot::ReducerBufferStatus::Components::tail_position_, foedus::snapshot::to_buffer_position(), to_string(), verify_log_chunk(), and foedus::snapshot::ReducerBufferStatus::word.
void foedus::snapshot::LogReducerRef::clear | ( | ) |
Definition at line 53 of file log_reducer_ref.cpp.
References foedus::snapshot::LogReducerControlBlock::clear(), and control_block_.
|
protected |
Definition at line 71 of file log_reducer_ref.cpp.
References engine_, get_id(), foedus::soc::SharedMemoryRepo::get_node_memory_anchors(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), and foedus::soc::NodeMemoryAnchors::log_reducer_buffers_.
Referenced by append_log_chunk().
|
protected |
Definition at line 65 of file log_reducer_ref.cpp.
References engine_, foedus::Engine::get_options(), foedus::snapshot::SnapshotOptions::log_reducer_buffer_mb_, and foedus::EngineOptions::snapshot_.
Referenced by append_log_chunk().
|
protected |
Definition at line 77 of file log_reducer_ref.cpp.
References engine_, foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::soc::SocManager::get_shared_memory_repo(), and foedus::Engine::get_soc_manager().
Referenced by verify_log_chunk().
|
protected |
Definition at line 61 of file log_reducer_ref.cpp.
References control_block_, and foedus::snapshot::LogReducerControlBlock::current_buffer_.
Referenced by append_log_chunk().
uint16_t foedus::snapshot::LogReducerRef::get_id | ( | ) | const |
Definition at line 46 of file log_reducer_ref.cpp.
References control_block_, and foedus::snapshot::LogReducerControlBlock::id_.
Referenced by get_buffer(), and to_string().
|
inline |
Definition at line 55 of file log_reducer_ref.hpp.
References root_info_pages_.
uint32_t foedus::snapshot::LogReducerRef::get_total_storage_count | ( | ) | const |
Definition at line 57 of file log_reducer_ref.cpp.
References control_block_, and foedus::snapshot::LogReducerControlBlock::total_storage_count_.
std::string foedus::snapshot::LogReducerRef::to_string | ( | ) | const |
Definition at line 49 of file log_reducer_ref.cpp.
References get_id().
Referenced by append_log_chunk().
|
protected |
used only in debug mode
Definition at line 82 of file log_reducer_ref.cpp.
References ASSERT_ND, foedus::snapshot::Snapshot::base_epoch_, get_cur_snapshot(), foedus::xct::XctId::get_epoch(), foedus::log::LogHeader::get_kind(), foedus::xct::XctId::get_ordinal(), foedus::log::LogHeader::get_type(), foedus::log::BaseLogType::header_, foedus::snapshot::Snapshot::id_, foedus::Epoch::is_valid(), foedus::xct::XctId::is_valid(), foedus::log::kLogCodeEpochMarker, foedus::log::kLogCodeFiller, foedus::log::kLogCodeInvalid, foedus::snapshot::kNullSnapshotId, foedus::log::kRecordLogs, foedus::log::LogHeader::log_length_, foedus::snapshot::Snapshot::max_storage_id_, foedus::log::LogHeader::storage_id_, foedus::snapshot::Snapshot::valid_until_epoch_, and foedus::log::LogHeader::xct_id_.
Referenced by append_log_chunk().
|
friend |
|
protected |
Definition at line 96 of file log_reducer_ref.hpp.
Referenced by append_log_chunk(), and LogReducerRef().
|
protected |
Definition at line 95 of file log_reducer_ref.hpp.
Referenced by append_log_chunk(), clear(), get_current_buffer_index_atomic(), get_id(), get_total_storage_count(), and LogReducerRef().
|
protected |
Definition at line 94 of file log_reducer_ref.hpp.
Referenced by append_log_chunk(), get_buffer(), get_buffer_size(), get_cur_snapshot(), and LogReducerRef().
|
protected |
Definition at line 97 of file log_reducer_ref.hpp.
Referenced by get_root_info_pages(), and LogReducerRef().