20 #include <glog/logging.h>
38 : engine_(engine), parent_(engine), id_(id), numa_node_(engine->get_soc_id()), running_(false) {}
41 LOG(INFO) <<
"Launching thread for " <<
to_string();
42 thread_ = std::move(std::thread(&MapReduceBase::handle,
this));
46 LOG(INFO) <<
"Waiting for the completion of thread: " <<
to_string();
50 LOG(INFO) <<
"Observed completion of thread: " <<
to_string();
61 void MapReduceBase::handle() {
63 LOG(FATAL) <<
"Duplicate launch of " <<
to_string();
66 LOG(INFO) <<
"Started running: " <<
to_string() <<
" NUMA node=" <<
static_cast<int>(
numa_node_);
71 LOG(WARNING) <<
to_string() <<
" cancelled";
73 LOG(ERROR) <<
to_string() <<
" got an error while processing:" << result;
78 LOG(INFO) <<
to_string() <<
" successfully finished";
88 LOG(INFO) <<
to_string() <<
" was the last one to finish, waking up gleaner.. ";
93 LOG(INFO) <<
"Stopped running: " <<
to_string();
ErrorCode check_cancelled() const
Derived class's handle_process() should occasionally call this to exit if it's cancelled.
void launch_thread()
Start executing.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Brings error stacktrace information as return value of functions.
std::atomic< bool > running_
only for sanity check
Pin the current thread to the given NUMA node in this object's scope.
uint16_t increment_error_count()
ErrorCode get_error_code() const
Return the integer error code.
0x0602 : "SNAPSHT: (internal error code) Snapshot task cancelled." .
bool is_all_completed() const
Database engine object that holds all resources and provides APIs.
uint16_t increment_exit_count()
uint16_t increment_completed_count()
const uint16_t numa_node_
uint16_t get_all_count() const
virtual ErrorStack handle_process()=0
Implements the specific logics in derived class.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
ErrorCode
Enum of error codes defined in error_code.xmacro.
virtual std::string to_string() const =0
Expects "LogReducer-x", "LogMapper-y" etc.
bool is_error() const
Returns if this return code is not kErrorCodeOk.