libfoedus-core
FOEDUS Core Library
|
Shared data of Logger. More...
Shared data of Logger.
Definition at line 51 of file logger_impl.hpp.
#include <logger_impl.hpp>
Public Types | |
enum | Constants { kMaxEpochHistory = 1 << 16 } |
Public Member Functions | |
LoggerControlBlock ()=delete | |
~LoggerControlBlock ()=delete | |
void | initialize () |
void | uninitialize () |
bool | is_epoch_history_empty () const |
uint32_t | get_tail_epoch_history () const |
Static Public Member Functions | |
static uint32_t | wrap_epoch_history_index (uint32_t index) |
Public Attributes | |
std::atomic< Epoch::EpochInteger > | durable_epoch_ |
Upto what epoch the logger flushed logs in all buffers assigned to it. More... | |
soc::SharedPolling | wakeup_cond_ |
The logger sleeps on this conditional. More... | |
Epoch | marked_epoch_ |
Upto what epoch the logger has put epoch marker in the log file. More... | |
std::atomic< LogFileOrdinal > | oldest_ordinal_ |
Ordinal of the oldest active log file of this logger. More... | |
std::atomic< uint64_t > | oldest_file_offset_begin_ |
Inclusive beginning of active region in the oldest log file. More... | |
std::atomic< LogFileOrdinal > | current_ordinal_ |
Ordinal of the log file this logger is currently appending to. More... | |
std::atomic< uint64_t > | current_file_durable_offset_ |
We called fsync on current file up to this offset. More... | |
std::atomic< bool > | stop_requested_ |
Whether this logger should terminate. More... | |
soc::SharedMutex | epoch_history_mutex_ |
the followings are covered this mutex More... | |
uint32_t | epoch_history_head_ |
index of the oldest history in epoch_histories_ More... | |
uint32_t | epoch_history_count_ |
number of active entries in epoch_histories_ . More... | |
EpochHistory | epoch_histories_ [kMaxEpochHistory] |
Remembers all epoch switching in this logger. More... | |
Enumerator | |
---|---|
kMaxEpochHistory |
Max number of active epoch histories. 64k * 24b = 1536 kb. adjust kLoggerMemorySize according to this. |
Definition at line 52 of file logger_impl.hpp.
|
delete |
|
delete |
|
inline |
Definition at line 77 of file logger_impl.hpp.
References epoch_history_count_, epoch_history_head_, and wrap_epoch_history_index().
|
inline |
Definition at line 64 of file logger_impl.hpp.
References epoch_history_count_, epoch_history_head_, epoch_history_mutex_, foedus::soc::SharedMutex::initialize(), foedus::soc::SharedPolling::initialize(), stop_requested_, and wakeup_cond_.
|
inline |
Definition at line 76 of file logger_impl.hpp.
References epoch_history_count_.
|
inline |
Definition at line 71 of file logger_impl.hpp.
References epoch_history_mutex_, and foedus::soc::SharedMutex::uninitialize().
|
inlinestatic |
Definition at line 81 of file logger_impl.hpp.
References kMaxEpochHistory.
Referenced by get_tail_epoch_history().
std::atomic< uint64_t > foedus::log::LoggerControlBlock::current_file_durable_offset_ |
We called fsync on current file up to this offset.
Definition at line 140 of file logger_impl.hpp.
std::atomic< LogFileOrdinal > foedus::log::LoggerControlBlock::current_ordinal_ |
Ordinal of the log file this logger is currently appending to.
Definition at line 133 of file logger_impl.hpp.
Referenced by foedus::log::operator<<().
std::atomic< Epoch::EpochInteger > foedus::log::LoggerControlBlock::durable_epoch_ |
Upto what epoch the logger flushed logs in all buffers assigned to it.
The logger advances this value when it writes out all logs in all buffers in an epoch. The global durable epoch is an aggregate (min) of this value from all loggers. Even when some thread is idle, this value could be advanced upto "global current epoch - 2" because of the way the epoch-chime starts a new epoch. It is guaranteed that no thread will emit any log in that epoch or older.
Definition at line 94 of file logger_impl.hpp.
EpochHistory foedus::log::LoggerControlBlock::epoch_histories_[kMaxEpochHistory] |
Remembers all epoch switching in this logger.
This forms a circular buffer starting from epoch_history_head_. After log gleaning, we can move head forward and reduce epoch_history_count_.
Definition at line 158 of file logger_impl.hpp.
uint32_t foedus::log::LoggerControlBlock::epoch_history_count_ |
number of active entries in epoch_histories_ .
Definition at line 151 of file logger_impl.hpp.
Referenced by get_tail_epoch_history(), initialize(), is_epoch_history_empty(), and foedus::log::operator<<().
uint32_t foedus::log::LoggerControlBlock::epoch_history_head_ |
index of the oldest history in epoch_histories_
Definition at line 149 of file logger_impl.hpp.
Referenced by get_tail_epoch_history(), initialize(), and foedus::log::operator<<().
soc::SharedMutex foedus::log::LoggerControlBlock::epoch_history_mutex_ |
the followings are covered this mutex
Definition at line 146 of file logger_impl.hpp.
Referenced by initialize(), and uninitialize().
Epoch foedus::log::LoggerControlBlock::marked_epoch_ |
Upto what epoch the logger has put epoch marker in the log file.
Usually, this value is always same as durable_epoch_.one_more(). This value becomes smaller than that if the logger had no log to write out when it advanced durable_epoch_. In that case, writing out an epoch marker is a waste (eg when the system is idle for long time, there will be tons of empty epochs), so we do not write out the epoch marker and let this value remain same. When the logger later writes out a log, it checks this value and writes out an epoch mark.
Definition at line 116 of file logger_impl.hpp.
Referenced by foedus::log::operator<<().
std::atomic< uint64_t > foedus::log::LoggerControlBlock::oldest_file_offset_begin_ |
Inclusive beginning of active region in the oldest log file.
Definition at line 129 of file logger_impl.hpp.
Referenced by foedus::log::operator<<().
std::atomic< LogFileOrdinal > foedus::log::LoggerControlBlock::oldest_ordinal_ |
Ordinal of the oldest active log file of this logger.
Definition at line 124 of file logger_impl.hpp.
Referenced by foedus::log::operator<<().
std::atomic<bool> foedus::log::LoggerControlBlock::stop_requested_ |
Whether this logger should terminate.
Definition at line 143 of file logger_impl.hpp.
Referenced by initialize().
soc::SharedPolling foedus::log::LoggerControlBlock::wakeup_cond_ |
The logger sleeps on this conditional.
When someone else (whether in same SOC or other SOC) wants to wake up this logger, they fire this. There is no 'real' condition variable as this is not about correctness. The logger simply wakes on this cond and resumes as far as it wakes up. It might be a spurrious wakeup, but doesn't matter.
Definition at line 102 of file logger_impl.hpp.
Referenced by initialize().