libfoedus-core
FOEDUS Core Library
|
Set of option values given to the engine at start-up. More...
Set of option values given to the engine at start-up.
This object is a collection of engine-wide settings and settings for individual modules (XxxOptions). To configure options, instantiate this class then modify values in each sub-module's options. When you start-up the database engine, you have to provide this object.
To instantiate an EngineOptions object, simply call the default constructor like:
This sets default values to all settings. See each module's option classes for the description of their default values.
You can save and load this object to an XML file:
Definition at line 75 of file engine_options.hpp.
#include <engine_options.hpp>
Public Member Functions | |
EngineOptions () | |
Constructs option values with default values. More... | |
EngineOptions (const EngineOptions &other) | |
EngineOptions & | operator= (const EngineOptions &other) |
void | calculate_required_memory (uint64_t *shared_bytes, uint64_t *local_bytes) const |
ErrorStack | prescreen (std::ostream *details_out) const |
Checks the machine environment and raises as many errors as possible before the engine starts up. More... | |
void | prescreen_ulimits (uint64_t required_total_safe_bytes, bool *has_any_error, std::ostream *details_out) const |
Subroutine of prescreen to check ulimit values. More... | |
void | prescreen_sysctl (uint64_t required_shared_safe_bytes, bool *has_any_error, std::ostream *details_out) const |
Subroutine of prescreen to check sysctl values. 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... | |
Static Public Member Functions | |
static uint64_t | read_int_from_proc_fs (const char *path, std::ostream *details_out) |
A utility method to read /proc/ value in linux. More... | |
static uint64_t | get_available_hugepage_memory (std::ostream *details_out) |
A utility method to check how much hugepage memory is currently available. More... | |
![]() | |
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... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const EngineOptions &v) |
foedus::EngineOptions::EngineOptions | ( | ) |
Constructs option values with default values.
Definition at line 38 of file engine_options.cpp.
Referenced by load().
foedus::EngineOptions::EngineOptions | ( | const EngineOptions & | other | ) |
Definition at line 40 of file engine_options.cpp.
References operator=().
|
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 149 of file engine_options.hpp.
void foedus::EngineOptions::calculate_required_memory | ( | uint64_t * | shared_bytes, |
uint64_t * | local_bytes | ||
) | const |
[out] | shared_bytes | Byte size of shared hugepage memory the engine will consume when an engine starts up with these option values. |
[out] | local_bytes | Byte size of node-local hugepage memory the engine will consume when an engine starts up with these option values. |
Definition at line 341 of file engine_options.cpp.
References cache_, foedus::soc::SharedMemoryRepo::calculate_global_memory_size(), foedus::memory::NumaCoreMemory::calculate_local_small_memory_size(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), foedus::thread::ThreadOptions::get_total_thread_count(), foedus::thread::ThreadOptions::group_count_, foedus::xct::XctOptions::local_work_memory_size_mb_, log_, foedus::log::LogOptions::log_buffer_kb_, foedus::log::LogOptions::loggers_per_node_, memory_, foedus::memory::MemoryOptions::page_pool_size_mb_per_node_, foedus::cache::CacheOptions::snapshot_cache_size_mb_per_node_, thread_, and xct_.
Referenced by prescreen().
|
static |
A utility method to check how much hugepage memory is currently available.
Returns byte size of available memory backed by non-transparent hugepages.
[out] | details_out | if there is any concern, we output some message to this stream. |
Definition at line 96 of file engine_options.cpp.
References ASSERT_ND.
Referenced by prescreen().
|
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 149 of file engine_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 79 of file engine_options.cpp.
References CHECK_ERROR, EngineOptions(), foedus::externalize::Externalizable::get_child_element(), foedus::get_children(), and foedus::kRetOk.
EngineOptions & foedus::EngineOptions::operator= | ( | const EngineOptions & | other | ) |
Definition at line 69 of file engine_options.cpp.
References ASSERT_ND, and foedus::get_children().
Referenced by EngineOptions().
ErrorStack foedus::EngineOptions::prescreen | ( | std::ostream * | details_out | ) | const |
Checks the machine environment and raises as many errors as possible before the engine starts up.
[out] | details_out | We write out detailed messages (more like a documentation to help users configure linux) to this stream, not to glog, because glog might not be initialized at this point. |
There are several linux configurations the user must get right. Some, not all, of misconfigurations can be detected beforehand by checking the machine configuration and values of EngineOptions. This method has no side-effect. It just checks the environment.
Definition at line 126 of file engine_options.cpp.
References ASSERT_ND, calculate_required_memory(), ERROR_STACK_MSG, get_available_hugepage_memory(), foedus::assorted::int_div_ceil(), foedus::kErrorCodeEnvPrescreenFailed, foedus::kRetOk, memory_, prescreen_sysctl(), prescreen_ulimits(), foedus::memory::MemoryOptions::rigorous_page_boundary_check_, and foedus::memory::MemoryOptions::suppress_memory_prescreening_.
Referenced by foedus::EnginePimpl::check_valid_options().
void foedus::EngineOptions::prescreen_sysctl | ( | uint64_t | required_shared_safe_bytes, |
bool * | has_any_error, | ||
std::ostream * | details_out | ||
) | const |
Subroutine of prescreen to check sysctl values.
Definition at line 269 of file engine_options.cpp.
References read_int_from_proc_fs().
Referenced by prescreen().
void foedus::EngineOptions::prescreen_ulimits | ( | uint64_t | required_total_safe_bytes, |
bool * | has_any_error, | ||
std::ostream * | details_out | ||
) | const |
Subroutine of prescreen to check ulimit values.
Definition at line 198 of file engine_options.cpp.
References foedus::thread::ThreadOptions::get_total_thread_count(), and thread_.
Referenced by prescreen().
|
static |
A utility method to read /proc/ value in linux.
[in] | path | file path representing a config value, eg "/proc/sys/kernel/shmall" |
[out] | details_out | if there is any concern, we output some message to this stream. |
Definition at line 254 of file engine_options.cpp.
Referenced by prescreen_sysctl().
|
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 87 of file engine_options.cpp.
References foedus::externalize::Externalizable::add_child_element(), CHECK_ERROR, foedus::get_children(), foedus::externalize::Externalizable::insert_comment(), and foedus::kRetOk.
|
friend |
Definition at line 149 of file engine_options.hpp.
cache::CacheOptions foedus::EngineOptions::cache_ |
Definition at line 136 of file engine_options.hpp.
Referenced by calculate_required_memory(), foedus::thread::ThreadPimpl::find_or_read_a_snapshot_page(), foedus::thread::ThreadPimpl::find_or_read_snapshot_pages_batch(), foedus::cache::CacheManagerPimpl::initialize_once(), foedus::memory::NumaNodeMemory::initialize_once(), and foedus::thread::ThreadPimpl::initialize_once().
debugging::DebuggingOptions foedus::EngineOptions::debugging_ |
Definition at line 137 of file engine_options.hpp.
log::LogOptions foedus::EngineOptions::log_ |
Definition at line 138 of file engine_options.hpp.
Referenced by foedus::soc::NodeMemoryAnchors::allocate_arrays(), foedus::snapshot::calculate_logger_id(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), calculate_required_memory(), foedus::snapshot::LogMapper::handle_process(), foedus::log::MetaLogger::initialize_once(), foedus::log::LogManagerPimpl::initialize_once(), foedus::savepoint::SavepointManagerPimpl::initialize_once(), foedus::log::Logger::initialize_once(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::xct::XctManagerPimpl::precommit_xct_readwrite(), foedus::restart::RestartManagerPimpl::redo_meta_logs(), foedus::savepoint::SavepointManagerPimpl::update_shared_savepoint(), and foedus::log::ThreadLogBuffer::wait_for_space().
memory::MemoryOptions foedus::EngineOptions::memory_ |
Definition at line 139 of file engine_options.hpp.
Referenced by foedus::memory::NumaNodeMemory::allocate_numa_memory_general(), foedus::soc::SharedMemoryRepo::allocate_shared_memories(), foedus::soc::SharedMemoryRepo::attach_shared_memories(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), calculate_required_memory(), foedus::cache::CacheManagerPimpl::initialize_once(), foedus::memory::NumaNodeMemory::initialize_once(), foedus::memory::NumaCoreMemory::initialize_once(), foedus::memory::NumaNodeMemoryRef::NumaNodeMemoryRef(), and prescreen().
proc::ProcOptions foedus::EngineOptions::proc_ |
Definition at line 140 of file engine_options.hpp.
Referenced by foedus::soc::SharedMemoryRepo::calculate_node_memory_size().
restart::RestartOptions foedus::EngineOptions::restart_ |
Definition at line 141 of file engine_options.hpp.
savepoint::SavepointOptions foedus::EngineOptions::savepoint_ |
Definition at line 142 of file engine_options.hpp.
Referenced by foedus::savepoint::SavepointManagerPimpl::initialize_once().
snapshot::SnapshotOptions foedus::EngineOptions::snapshot_ |
Definition at line 143 of file engine_options.hpp.
Referenced by foedus::snapshot::LogReducerRef::append_log_chunk(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), foedus::snapshot::LogReducerRef::get_buffer_size(), foedus::snapshot::SnapshotManagerPimpl::get_option(), foedus::cache::SnapshotFileSet::get_or_open_file(), foedus::snapshot::LogMapper::handle_process(), foedus::snapshot::LogMapper::initialize_once(), foedus::snapshot::LogReducer::initialize_once(), foedus::snapshot::LogReducer::LogReducer(), and foedus::snapshot::SnapshotWriter::open().
soc::SocOptions foedus::EngineOptions::soc_ |
Definition at line 144 of file engine_options.hpp.
Referenced by foedus::soc::SharedMemoryRepo::calculate_global_memory_size(), foedus::proc::ProcManagerPimpl::emulated_register(), foedus::soc::SocManager::get_shared_user_memory_size(), foedus::soc::SocManagerPimpl::initialize_master(), foedus::soc::SocManagerPimpl::launch_spawned_children(), foedus::proc::ProcManagerPimpl::pre_register(), foedus::soc::SocManagerPimpl::wait_for_child_attach(), foedus::soc::SocManagerPimpl::wait_for_child_terminate(), and foedus::soc::SocManagerPimpl::wait_for_children_module().
storage::StorageOptions foedus::EngineOptions::storage_ |
Definition at line 145 of file engine_options.hpp.
Referenced by foedus::soc::SharedMemoryRepo::calculate_global_memory_size(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), foedus::storage::hash::HashStoragePimpl::create(), foedus::storage::StorageManagerPimpl::get_max_storages(), foedus::thread::ThreadPimpl::handle_tasks(), foedus::xct::Xct::initialize(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::storage::PartitionerMetadata::locate_data(), and foedus::snapshot::SnapshotManagerPimpl::uninitialize_once().
thread::ThreadOptions foedus::EngineOptions::thread_ |
Definition at line 146 of file engine_options.hpp.
Referenced by foedus::soc::NodeMemoryAnchors::allocate_arrays(), foedus::memory::NumaCoreMemory::calculate_local_small_memory_size(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), calculate_required_memory(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::sequential::SequentialStoragePimpl::drop(), foedus::storage::sequential::SequentialComposer::drop_volatiles(), foedus::memory::EngineMemory::dump_free_memory_stat(), foedus::storage::sequential::SequentialStoragePimpl::for_every_page(), foedus::storage::sequential::SequentialStoragePimpl::get_head_pointer(), foedus::Engine::get_soc_count(), foedus::storage::sequential::SequentialStoragePimpl::get_tail_pointer(), foedus::thread::ThreadPoolPimpl::impersonate(), foedus::thread::ThreadPoolPimpl::impersonate_on_numa_node(), foedus::storage::sequential::SequentialStoragePimpl::initialize_head_tail_pages(), foedus::soc::SocManagerPimpl::initialize_master(), foedus::thread::ThreadGroup::initialize_once(), foedus::thread::ThreadPoolPimpl::initialize_once(), foedus::cache::CacheManagerPimpl::initialize_once(), foedus::memory::EngineMemory::initialize_once(), foedus::memory::NumaCoreMemory::initialize_once(), foedus::EnginePimpl::initialize_once(), foedus::proc::ProcManagerPimpl::initialize_once(), foedus::log::LogManagerPimpl::initialize_once(), foedus::savepoint::SavepointManagerPimpl::initialize_once(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::soc::SocManagerPimpl::launch_emulated_children(), foedus::soc::SocManagerPimpl::launch_forked_children(), foedus::soc::SocManagerPimpl::launch_spawned_children(), prescreen_ulimits(), foedus::thread::ThreadPimpl::set_thread_schedule(), foedus::thread::ThreadGroupRef::ThreadGroupRef(), foedus::savepoint::SavepointManagerPimpl::update_shared_savepoint(), foedus::soc::SocManagerPimpl::wait_for_child_attach(), foedus::soc::SocManagerPimpl::wait_for_child_terminate(), and foedus::soc::SocManagerPimpl::wait_for_children_module().
xct::XctOptions foedus::EngineOptions::xct_ |
Definition at line 147 of file engine_options.hpp.
Referenced by foedus::memory::NumaCoreMemory::calculate_local_small_memory_size(), calculate_required_memory(), foedus::xct::XctManagerPimpl::handle_epoch_chime(), foedus::thread::ThreadPimpl::handle_tasks(), foedus::xct::Xct::initialize(), foedus::memory::NumaCoreMemory::initialize_once(), foedus::thread::ThreadPimpl::initialize_once(), and foedus::xct::XctManagerPimpl::precommit_xct_lock().