18 #ifndef FOEDUS_LOG_LOGGER_IMPL_HPP_
19 #define FOEDUS_LOG_LOGGER_IMPL_HPP_
175 uint8_t in_node_ordinal,
177 const std::vector< thread::ThreadId > &assigned_thread_ids)
178 :
LoggerRef(engine, control_block, id, numa_node, in_node_ordinal),
179 log_folder_(log_folder),
180 assigned_thread_ids_(assigned_thread_ids) {}
202 void handle_logger();
208 ErrorStack update_durable_epoch(
Epoch new_durable_epoch,
bool had_any_log);
213 Epoch calculate_min_durable_epoch();
255 uint64_t from_offset,
256 uint64_t upto_offset);
259 void assert_consistent();
261 void assert_written_logs(
Epoch write_epoch,
const char* logs, uint64_t bytes)
const;
264 const std::vector< thread::ThreadId > assigned_thread_ids_;
266 std::thread logger_thread_;
292 std::vector< thread::Thread* > assigned_threads_;
295 std::mutex epoch_switch_mutex_;
299 "LoggerControlBlock is too large.");
302 #endif // FOEDUS_LOG_LOGGER_IMPL_HPP_
std::atomic< LogFileOrdinal > current_ordinal_
Ordinal of the log file this logger is currently appending to.
std::atomic< uint64_t > oldest_file_offset_begin_
Inclusive beginning of active region in the oldest log file.
std::atomic< Epoch::EpochInteger > durable_epoch_
Upto what epoch the logger flushed logs in all buffers assigned to it.
Forward declarations of classes in filesystem package.
ErrorStack initialize_once() override
Epoch marked_epoch_
Upto what epoch the logger has put epoch marker in the log file.
A thread-local log buffer.
soc::SharedPolling wakeup_cond_
The logger sleeps on this conditional.
Logger(Engine *engine, LoggerControlBlock *control_block, LoggerId id, thread::ThreadGroupId numa_node, uint8_t in_node_ordinal, const fs::Path &log_folder, const std::vector< thread::ThreadId > &assigned_thread_ids)
Forward declarations of classes in log manager package.
void initialize(bool recursive=false)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
bool is_epoch_history_empty() const
Typedefs of ID types used in thread package.
LogFileOrdinal get_current_ordinal() const
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
std::atomic< LogFileOrdinal > oldest_ordinal_
Ordinal of the oldest active log file of this logger.
uint32_t get_tail_epoch_history() const
A polling-wait mechanism that can be placed in shared memory and used from multiple processes...
Typical implementation of Initializable as a skeleton base class.
std::atomic< uint64_t > current_file_durable_offset_
We called fsync on current file up to this offset.
std::atomic< bool > stop_requested_
Whether this logger should terminate.
Typedefs of ID types used in log package.
bool is_stop_requested() const
A mutex that can be placed in shared memory and used from multiple processes.
A view of Logger object for other SOCs and master engine.
soc::SharedMutex epoch_history_mutex_
the followings are covered this mutex
Analogue of boost::filesystem::path.
uint32_t LogFileOrdinal
Ordinal of log files (eg "log.0", "log.1").
LoggerControlBlock * control_block_
The shared data on shared memory that has been initialized in some SOC or master engine.
A log writer that writes out buffered logs to stable storages.
Database engine object that holds all resources and provides APIs.
EpochHistory epoch_histories_[kMaxEpochHistory]
Remembers all epoch switching in this logger.
friend std::ostream & operator<<(std::ostream &o, const Logger &v)
uint32_t epoch_history_head_
index of the oldest history in epoch_histories_
LoggerControlBlock()=delete
ErrorStack uninitialize_once() override
Forward declarations of classes in savepoint manager package.
Logger & operator=(const Logger &other)=delete
Represents an I/O stream on one file without filesystem caching.
Represents one memory block aligned to actual OS/hardware pages.
std::string to_string() const
Max number of active epoch histories.
Forward declarations of classes in thread package.
uint16_t LoggerId
Typedef for an ID of Logger.
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
static uint32_t wrap_epoch_history_index(uint32_t index)
uint32_t epoch_history_count_
number of active entries in epoch_histories_ .
Represents an event where a logger switched its epoch.
~LoggerControlBlock()=delete