libfoedus-core
FOEDUS Core Library
|
Set of options for log manager. More...
Set of options for log manager.
This is a POD struct. Default destructor/copy-constructor/assignment operator work fine.
Definition at line 39 of file log_options.hpp.
#include <log_options.hpp>
Public Types | |
enum | Constants { kDefaultLogBufferKb = (1 << 16), kDefaultLogSizeMb = (1 << 14) } |
Constant values. More... | |
Public Member Functions | |
LogOptions () | |
Constructs option values with default values. More... | |
std::string | convert_folder_path_pattern (int node, int logger) const |
converts folder_path_pattern_ into a string with the given IDs. More... | |
std::string | construct_suffixed_log_path (int node, int logger, LogFileOrdinal ordinal) const |
construct full path of individual log file (log_folder/LOGGERID_ORDINAL.log) More... | |
std::string | construct_meta_log_path () const |
metadata log file is placed in node-0/logger-0 folder More... | |
ErrorStack | load (tinyxml2::XMLElement *element) override |
Reads the content of this object from the given XML element. More... | |
ErrorStack | save (tinyxml2::XMLElement *element) const override |
Writes the content of this object to the given XML element. More... | |
const char * | get_tag_name () const override |
Returns an XML tag name for this object as a root element. More... | |
void | assign (const foedus::externalize::Externalizable *other) override |
Polymorphic assign operator. More... | |
![]() | |
ErrorStack | load_from_string (const std::string &xml) |
Load the content of this object from the given XML string. More... | |
void | save_to_stream (std::ostream *ptr) const |
Invokes save() and directs the resulting XML text to the given stream. More... | |
ErrorStack | load_from_file (const fs::Path &path) |
Load the content of this object from the specified XML file. More... | |
ErrorStack | save_to_file (const fs::Path &path) const |
Atomically and durably writes out this object to the specified XML file. More... | |
Public Attributes | |
fs::FixedPath | folder_path_pattern_ |
String pattern of path of log folders in each NUMA node. More... | |
uint16_t | loggers_per_node_ |
Number of loggers per NUMA node. More... | |
uint32_t | log_buffer_kb_ |
Size in KB of log buffer for each worker thread. More... | |
uint32_t | log_file_size_mb_ |
Size in MB of each file loggers write out. More... | |
bool | flush_at_shutdown_ |
Whether to flush transaction logs and take savepoint when uninitialize() is called. More... | |
foedus::fs::DeviceEmulationOptions | emulation_ |
Settings to emulate slower logging device. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const LogOptions &v) |
Additional Inherited Members | |
![]() | |
static ErrorStack | insert_comment (tinyxml2::XMLElement *element, const std::string &comment) |
static ErrorStack | append_comment (tinyxml2::XMLElement *parent, const std::string &comment) |
static ErrorStack | create_element (tinyxml2::XMLElement *parent, const std::string &name, tinyxml2::XMLElement **out) |
template<typename T > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value) |
Only declaration in header. More... | |
template<uint MAXLEN, typename CHAR > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const assorted::FixedString< MAXLEN, CHAR > &value) |
template<typename T > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const std::vector< T > &value) |
vector version More... | |
template<typename ENUM > | |
static ErrorStack | add_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, ENUM value) |
enum version More... | |
static ErrorStack | add_child_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const Externalizable &child) |
child Externalizable version More... | |
template<typename T > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0) |
Only declaration in header. More... | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::string *out, bool optional=false, const char *value="") |
string type is bit special. More... | |
template<uint MAXLEN, typename CHAR > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, assorted::FixedString< MAXLEN, CHAR > *out, bool optional=false, const assorted::FixedString< MAXLEN, CHAR > &value=assorted::FixedString< MAXLEN, CHAR >()) |
template<typename ENUM > | |
static ErrorStack | get_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, ENUM *out, bool optional=false, ENUM default_value=static_cast< ENUM >(0)) |
enum version More... | |
template<typename T > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::vector< T > *out, bool optional=false) |
vector version. More... | |
static ErrorStack | get_child_element (tinyxml2::XMLElement *parent, const std::string &tag, Externalizable *child, bool optional=false) |
child Externalizable version More... | |
Constant values.
Enumerator | |
---|---|
kDefaultLogBufferKb |
Default value for log_buffer_kb_. |
kDefaultLogSizeMb |
Default value for log_file_size_mb_. |
Definition at line 41 of file log_options.hpp.
foedus::log::LogOptions::LogOptions | ( | ) |
Constructs option values with default values.
Definition at line 28 of file log_options.cpp.
References flush_at_shutdown_, folder_path_pattern_, kDefaultLogBufferKb, kDefaultLogSizeMb, log_buffer_kb_, log_file_size_mb_, and loggers_per_node_.
|
inlineoverridevirtual |
Polymorphic assign operator.
This should invoke operator= of the derived class.
[in] | other | assigned value. It must be dynamic-castable to the assignee class. |
Implements foedus::externalize::Externalizable.
Definition at line 113 of file log_options.hpp.
std::string foedus::log::LogOptions::construct_meta_log_path | ( | ) | const |
metadata log file is placed in node-0/logger-0 folder
Definition at line 51 of file log_options.cpp.
References convert_folder_path_pattern().
Referenced by foedus::log::MetaLogger::initialize_once(), and foedus::restart::RestartManagerPimpl::redo_meta_logs().
std::string foedus::log::LogOptions::construct_suffixed_log_path | ( | int | node, |
int | logger, | ||
LogFileOrdinal | ordinal | ||
) | const |
construct full path of individual log file (log_folder/LOGGERID_ORDINAL.log)
Definition at line 41 of file log_options.cpp.
References convert_folder_path_pattern().
Referenced by foedus::snapshot::LogMapper::handle_process(), and foedus::log::Logger::initialize_once().
std::string foedus::log::LogOptions::convert_folder_path_pattern | ( | int | node, |
int | logger | ||
) | const |
converts folder_path_pattern_ into a string with the given IDs.
Definition at line 36 of file log_options.cpp.
References folder_path_pattern_, foedus::assorted::replace_all(), and foedus::assorted::FixedString< MAXLEN, CHAR >::str().
Referenced by construct_meta_log_path(), construct_suffixed_log_path(), and foedus::log::LogManagerPimpl::initialize_once().
|
inlineoverridevirtual |
Returns an XML tag name for this object as a root element.
We might want to give a different name for same externalizable objects, so this is used only when it is the root element of xml.
Implements foedus::externalize::Externalizable.
Definition at line 113 of file log_options.hpp.
|
overridevirtual |
Reads the content of this object from the given XML element.
[in] | element | the XML element that represents this object |
Expect errors due to missing-elements, out-of-range values, etc.
Implements foedus::externalize::Externalizable.
Definition at line 55 of file log_options.cpp.
References CHECK_ERROR, emulation_, EXTERNALIZE_LOAD_ELEMENT, flush_at_shutdown_, folder_path_pattern_, foedus::externalize::Externalizable::get_child_element(), foedus::kRetOk, log_buffer_kb_, log_file_size_mb_, and loggers_per_node_.
|
overridevirtual |
Writes the content of this object to the given XML element.
[in] | element | the XML element that represents this object |
Expect only out-of-memory error. We receive the XML element this object will represent, so this method does not determine the XML element name of itself. The parent object determines children's tag names because one parent object might have multiple child objects of the same type with different XML element name.
Implements foedus::externalize::Externalizable.
Definition at line 65 of file log_options.cpp.
References foedus::externalize::Externalizable::add_child_element(), CHECK_ERROR, emulation_, EXTERNALIZE_SAVE_ELEMENT, flush_at_shutdown_, folder_path_pattern_, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, log_buffer_kb_, log_file_size_mb_, and loggers_per_node_.
|
friend |
Definition at line 113 of file log_options.hpp.
foedus::fs::DeviceEmulationOptions foedus::log::LogOptions::emulation_ |
Settings to emulate slower logging device.
Definition at line 104 of file log_options.hpp.
Referenced by foedus::log::MetaLogger::initialize_once(), foedus::log::Logger::initialize_once(), load(), foedus::xct::XctManagerPimpl::precommit_xct_readwrite(), foedus::restart::RestartManagerPimpl::redo_meta_logs(), save(), and foedus::log::ThreadLogBuffer::wait_for_space().
bool foedus::log::LogOptions::flush_at_shutdown_ |
Whether to flush transaction logs and take savepoint when uninitialize() is called.
If false, non-durable transactions since the previous savepoint is lost. This allows quick shutdown when you don't care the aftermath; testcase and experiments. Default is true.
Definition at line 101 of file log_options.hpp.
Referenced by load(), LogOptions(), and save().
fs::FixedPath foedus::log::LogOptions::folder_path_pattern_ |
String pattern of path of log folders in each NUMA node.
This specifies the path of the folder to contain log file written out in each NUMA node. Two special placeholders can be used; $NODE$ and $LOGGER$. $NODE$ is replaced with the NUMA node number. $LOGGER$ is replaced with the logger index in the node (0 to loggers_per_node_ - 1). For example,
Both are optional. You can specify a fixed path without the patterns, which means you will use the same folder for multiple loggers and nodes. Even in that case, log file names include node/logger number, so it wouldn't cause any data corruption. It just makes things harder for poor sysadmins.
The default value is "logs/node_$NODE$/logger_$LOGGER$".
Definition at line 70 of file log_options.hpp.
Referenced by convert_folder_path_pattern(), load(), LogOptions(), and save().
uint32_t foedus::log::LogOptions::log_buffer_kb_ |
Size in KB of log buffer for each worker thread.
Definition at line 83 of file log_options.hpp.
Referenced by foedus::EngineOptions::calculate_required_memory(), load(), LogOptions(), and save().
uint32_t foedus::log::LogOptions::log_file_size_mb_ |
Size in MB of each file loggers write out.
The logger switches to next file when it wrote out a complete log entry and observed that the current log file size is equal to or larger than this value. Thus, the actual log file size might be a bit larger than this value.
Definition at line 92 of file log_options.hpp.
Referenced by load(), LogOptions(), and save().
uint16_t foedus::log::LogOptions::loggers_per_node_ |
Number of loggers per NUMA node.
This value must be at least 1 (which is also default). A larger value might be able to employ more CPU power if you have succient # of cores. For the best performance, the number of loggers in each NUMA node must be a submultiple of the number of cores in the node (s.t. logger assignment is balanced).
Definition at line 80 of file log_options.hpp.
Referenced by foedus::soc::NodeMemoryAnchors::allocate_arrays(), foedus::snapshot::calculate_logger_id(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), foedus::EngineOptions::calculate_required_memory(), foedus::log::LogManagerPimpl::initialize_once(), foedus::savepoint::SavepointManagerPimpl::initialize_once(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), load(), LogOptions(), save(), and foedus::savepoint::SavepointManagerPimpl::update_shared_savepoint().