22 #include <glog/logging.h>
44 master_upid_(::getpid()),
46 master_eid_(reinterpret_cast<uintptr_t>(reinterpret_cast<void*>(engine))),
52 proc_manager_(engine),
53 memory_manager_(engine),
54 savepoint_manager_(engine),
57 snapshot_manager_(engine),
58 cache_manager_(engine),
59 storage_manager_(engine),
61 restart_manager_(engine) {
71 master_upid_(master_upid),
72 master_eid_(master_eid),
76 proc_manager_(engine),
77 memory_manager_(engine),
78 savepoint_manager_(engine),
81 snapshot_manager_(engine),
82 cache_manager_(engine),
83 storage_manager_(engine),
85 restart_manager_(engine) {
92 std::string ret(
"CHILD-");
93 return ret + std::to_string(
soc_id_);
104 if (module_initialize_error.
is_error()) {
105 LOG(ERROR) <<
"*******************************************************************************";
106 LOG(ERROR) <<
"*** ERROR while module initailization in " <<
describe_short() <<
". "
107 << module_initialize_error <<
"";
108 LOG(ERROR) <<
"*******************************************************************************";
121 std::this_thread::sleep_for(std::chrono::milliseconds(5));
123 bool error_happened =
false;
124 bool remaining =
false;
125 for (uint16_t node = 0; node < soc_count; ++node) {
128 error_happened =
true;
137 if (error_happened) {
138 LOG(ERROR) <<
"[FOEDUS] ERROR! error while waiting child kRunning";
141 }
else if (!remaining) {
146 LOG(INFO) <<
"================================================================================";
147 LOG(INFO) <<
"================== FOEDUS ENGINE ("
149 LOG(INFO) <<
"================================================================================";
153 bool running_on_valgrind = RUNNING_ON_VALGRIND;
154 if (running_on_valgrind) {
155 LOG(INFO) <<
"=============== ATTENTION: VALGRIND MODE! ==================";
156 LOG(INFO) <<
"This Engine is running under valgrind, which disables several optimizations";
157 LOG(INFO) <<
"If you see this message while usual execution, something is wrong.";
158 LOG(INFO) <<
"=============== ATTENTION: VALGRIND MODE! ==================";
179 LOG(INFO) <<
"================================================================================";
180 LOG(INFO) <<
"=================== FOEDUS ENGINE ("
182 LOG(INFO) <<
"================================================================================";
190 std::reverse(modules.begin(), modules.end());
192 if (!module.ptr_->is_initialized()) {
220 ErrorStack EnginePimpl::check_minimal_pool_size()
const {
225 uint64_t minimal_page_pool
234 ErrorStack EnginePimpl::check_transparent_hugepage_setting() {
Set of options about threads and thread-groups.
ErrorStack initialize() override
Acquires resources in this object, usually called right after constructor.
ErrorStack wait_for_children_module(bool init, ModuleType module)
Wait for other engines to finish init/uninit the module.
EngineOptions options_
Options given at boot time.
0x0303 : "MEMORY : Page Pool size is too small." .
void emprace_back(ErrorStack &&error_stack)
If the given ErrorStack is an error, this method adds it to the end of this batch.
void change_master_status(MasterEngineStatus::StatusCode new_status)
void on_module_initialized(ModuleType module)
Called whenever each module has completed its initialization.
#define ERROR_STACK(e)
Instantiates ErrorStack with the given foedus::error_code, creating an error stack with the current f...
void on_module_uninitialized(ModuleType module)
Called whenever each module has completed its uninitialization.
ErrorStack check_valid_options()
uint32_t private_page_pool_initial_grab_
How many pages each NumaCoreMemory initially grabs when it is initialized.
Epoch get_current_global_epoch() const
Returns the current global epoch, the epoch a newly started transaction will be in.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
The master is waiting for child engines to terminate.
GlobalMemoryAnchors * get_global_memory_anchors()
Epoch get_current_grace_epoch() const
Returns the current grace-period epoch (global epoch - 1), the epoch some transaction might be still ...
ErrorStack uninitialize() override
An idempotent method to release all resources of this object, if any.
ErrorStack initialize_once() override
void report_engine_fatal_error()
Announce fatal error state of this (either master or child) engine if possible.
Brings error stacktrace information as return value of functions.
FileStatus status(const Path &p)
Returns the status of the file.
ErrorStack wait_for_master_module(bool init, ModuleType module)
Wait for master engine to finish init/uninit the module.
NodeMemoryAnchors * get_node_memory_anchors(SocId node)
soc::SocManager soc_manager_
SOC manager.
0x0C0B : "SOC : Child SOC failed to initialize a module." .
const EngineOptions & get_options() const
ThreadLocalOrdinal thread_count_per_group_
Number of Thread in each ThreadGroup.
std::vector< ModulePtr > get_modules()
Returns in initialization order.
Epoch get_durable_global_epoch() const
Returns the durable epoch of the entire engine.
ErrorStack prescreen(std::ostream *details_out) const
Checks the machine environment and raises as many errors as possible before the engine starts up...
std::string describe_short() const
ModuleType
Enumerates modules in FOEDUS engine.
savepoint::SavepointManager savepoint_manager_
Batches zero or more ErrorStack objects to represent in one ErrorStack.
memory::MemoryOptions memory_
void change_uninit_atomic(ModuleType value)
Epoch get_current_global_epoch() const
Returns the current global epoch, the epoch a newly started transaction will be in.
Database engine object that holds all resources and provides APIs.
Done all initialization and running transactions.
xct::XctManager xct_manager_
Set of options for memory manager.
Set of option values given to the engine at start-up.
EngineType
Type of an engine instance of how to launch it.
bool is_initialized() const override
Returns whether the object has been already initialized or not.
Engine *const engine_
Pointer to the enclosing object.
Current status of a child SOC engine.
uint64_t Upid
Universal (or Unique) ID of a process.
uint16_t group_count_
Number of ThreadGroup in the engine.
The central instance that launches child engines on each NUMA node (SOC).
pair of module pointer and its type.
Repository of all shared memory in one FOEDUS instance.
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
log::LogManager log_manager_
uint16_t SocId
Represents an ID of an SOC, or NUMA node.
Epoch get_durable_global_epoch() const
Returns the durable epoch of the entire engine.
void change_init_atomic(ModuleType value)
thread::ThreadOptions thread_
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
void change_init_atomic(ModuleType value)
uint32_t page_pool_size_mb_per_node_
Size of the page pool in MB per each NUMA node.
const ErrorStack kRetOk
Normal return value for no-error case.
MasterEngineStatus * master_status_memory_
This tiny piece of memory contains the current status of the master engine and its synchronization me...
ErrorStack initialize_modules()
void change_uninit_atomic(ModuleType value)
Epoch get_earliest_epoch() const
ChildEngineStatus * child_status_memory_
This tiny piece of memory contains the current status of the child engine on this node...
Epoch get_current_grace_epoch() const
Returns the current grace-period epoch (global epoch - 1), the epoch some transaction might be still ...
uint64_t Eid
An Engine ID to differentiate two Engine objects instantiated in the same process.
ErrorStack uninitialize_once() override
Done all initialization and running transactions.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Epoch get_earliest_epoch() const
Returns the Earliest-Epoch, the minimum epoch that is valid within this engine.
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
bool is_error() const
Returns if this return code is not kErrorCodeOk.
The child engine observed some unrecoverable error and has exit.
SharedMemoryRepo * get_shared_memory_repo()
Returns the shared memories maintained across SOCs.
void memory_fence_acq_rel()
Equivalent to std::atomic_thread_fence(std::memory_order_acq_rel).