libfoedus-core
FOEDUS Core Library
foedus::savepoint::SavepointManagerPimpl Class Referencefinal

Pimpl object of SavepointManager. More...

Detailed Description

Pimpl object of SavepointManager.

A private pimpl object for SavepointManager. Do not include this header from a client program unless you know what you are doing.

Definition at line 110 of file savepoint_manager_pimpl.hpp.

#include <savepoint_manager_pimpl.hpp>

Inheritance diagram for foedus::savepoint::SavepointManagerPimpl:
Collaboration diagram for foedus::savepoint::SavepointManagerPimpl:

Public Member Functions

 SavepointManagerPimpl ()=delete
 
 SavepointManagerPimpl (Engine *engine)
 
ErrorStack initialize_once () override
 
ErrorStack uninitialize_once () override
 
Epoch get_initial_current_epoch () const
 
Epoch get_initial_durable_epoch () const
 
Epoch get_earliest_epoch () const
 
Epoch get_saved_durable_epoch () const
 
snapshot::SnapshotId get_latest_snapshot_id () const
 
Epoch get_latest_snapshot_epoch () const
 
Epoch get_requested_durable_epoch () const
 
void update_shared_savepoint (const Savepoint &src)
 
LoggerSavepointInfo get_logger_savepoint (log::LoggerId logger_id)
 
ErrorStack take_savepoint (Epoch new_global_durable_epoch)
 
ErrorStack take_savepoint_after_snapshot (snapshot::SnapshotId new_snapshot_id, Epoch new_snapshot_epoch)
 
void savepoint_main ()
 
bool is_stop_requested ()
 
- Public Member Functions inherited from foedus::DefaultInitializable
 DefaultInitializable ()
 
virtual ~DefaultInitializable ()
 
 DefaultInitializable (const DefaultInitializable &)=delete
 
DefaultInitializableoperator= (const DefaultInitializable &)=delete
 
ErrorStack initialize () override final
 Typical implementation of Initializable::initialize() that provides initialize-once semantics. More...
 
ErrorStack uninitialize () override final
 Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics. More...
 
bool is_initialized () const override final
 Returns whether the object has been already initialized or not. More...
 
- Public Member Functions inherited from foedus::Initializable
virtual ~Initializable ()
 

Public Attributes

Engine *const engine_
 
SavepointManagerControlBlockcontrol_block_
 
std::thread savepoint_thread_
 The thread to take savepoints. More...
 
std::atomic< bool > savepoint_thread_stop_requested_
 
fs::Path savepoint_path_
 Path of the savepoint file. More...
 
Savepoint savepoint_
 The current progress of the entire engine. More...
 

Constructor & Destructor Documentation

foedus::savepoint::SavepointManagerPimpl::SavepointManagerPimpl ( )
delete
foedus::savepoint::SavepointManagerPimpl::SavepointManagerPimpl ( Engine engine)
inlineexplicit

Definition at line 113 of file savepoint_manager_pimpl.hpp.

Member Function Documentation

Epoch foedus::savepoint::SavepointManagerPimpl::get_earliest_epoch ( ) const
inline
Epoch foedus::savepoint::SavepointManagerPimpl::get_initial_current_epoch ( ) const
inline
Epoch foedus::savepoint::SavepointManagerPimpl::get_initial_durable_epoch ( ) const
inline
Epoch foedus::savepoint::SavepointManagerPimpl::get_latest_snapshot_epoch ( ) const
inline
snapshot::SnapshotId foedus::savepoint::SavepointManagerPimpl::get_latest_snapshot_id ( ) const
inline
LoggerSavepointInfo foedus::savepoint::SavepointManagerPimpl::get_logger_savepoint ( log::LoggerId  logger_id)

Definition at line 151 of file savepoint_manager_pimpl.cpp.

References ASSERT_ND, control_block_, foedus::savepoint::FixedSavepoint::logger_info_, foedus::savepoint::SavepointManagerControlBlock::savepoint_, savepoint_, and foedus::savepoint::SavepointManagerControlBlock::savepoint_mutex_.

Referenced by foedus::savepoint::SavepointManager::get_logger_savepoint().

151  {
152  // read with mutex to not see garbage
153  soc::SharedMutexScope scope(&control_block_->savepoint_mutex_);
154  ASSERT_ND(logger_id < control_block_->savepoint_.get_total_logger_count());
155  return control_block_->savepoint_.logger_info_[logger_id];
156 }
soc::SharedMutex savepoint_mutex_
Read/write to savepoint_ is protected with this mutex.
FixedSavepoint savepoint_
The content of latest savepoint.
Savepoint savepoint_
The current progress of the entire engine.
LoggerSavepointInfo logger_info_[1U<< 16]
Stores all loggers' information.
Definition: savepoint.hpp:193
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the caller graph for this function:

Epoch foedus::savepoint::SavepointManagerPimpl::get_requested_durable_epoch ( ) const
inline

Definition at line 127 of file savepoint_manager_pimpl.hpp.

References control_block_, and foedus::savepoint::SavepointManagerControlBlock::requested_durable_epoch_.

Referenced by savepoint_main(), and take_savepoint().

127  {
129  }
Epoch::EpochInteger requested_durable_epoch_
Client SOC sets this value and then wakes up the savepoint thread.

Here is the caller graph for this function:

Epoch foedus::savepoint::SavepointManagerPimpl::get_saved_durable_epoch ( ) const
inline

Definition at line 120 of file savepoint_manager_pimpl.hpp.

References control_block_, and foedus::savepoint::SavepointManagerControlBlock::saved_durable_epoch_.

Referenced by foedus::savepoint::SavepointManager::get_saved_durable_epoch(), and take_savepoint().

120 { return Epoch(control_block_->saved_durable_epoch_); }
Epoch::EpochInteger saved_durable_epoch_
The durable epoch that has been made persistent in previous savepoint-ing.

Here is the caller graph for this function:

ErrorStack foedus::savepoint::SavepointManagerPimpl::initialize_once ( )
overridevirtual

Implements foedus::DefaultInitializable.

Definition at line 37 of file savepoint_manager_pimpl.cpp.

References CHECK_ERROR, foedus::savepoint::Savepoint::consistent(), control_block_, foedus::savepoint::Savepoint::current_epoch_, foedus::savepoint::Savepoint::durable_epoch_, foedus::savepoint::SavepointManagerControlBlock::earliest_epoch_, foedus::savepoint::Savepoint::earliest_epoch_, engine_, ERROR_STACK, ERROR_STACK_MSG, foedus::fs::exists(), foedus::Engine::get_options(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), foedus::thread::ThreadOptions::group_count_, foedus::savepoint::SavepointManagerControlBlock::initial_current_epoch_, foedus::savepoint::SavepointManagerControlBlock::initial_durable_epoch_, foedus::savepoint::SavepointManagerControlBlock::initialize(), foedus::Engine::is_master(), foedus::kErrorCodeSpInconsistentSavepoint, foedus::kErrorCodeTimeout, foedus::kRetOk, foedus::externalize::Externalizable::load_from_file(), foedus::EngineOptions::log_, foedus::log::LogOptions::loggers_per_node_, foedus::savepoint::SavepointManagerControlBlock::master_initialized_, foedus::assorted::memory_fence_release(), foedus::savepoint::Savepoint::populate_empty(), foedus::savepoint::SavepointManagerControlBlock::requested_durable_epoch_, foedus::externalize::Externalizable::save_to_file(), foedus::savepoint::SavepointManagerControlBlock::saved_durable_epoch_, foedus::EngineOptions::savepoint_, savepoint_, savepoint_main(), foedus::savepoint::SavepointOptions::savepoint_path_, savepoint_path_, savepoint_thread_, savepoint_thread_stop_requested_, foedus::assorted::FixedString< MAXLEN, CHAR >::str(), foedus::EngineOptions::thread_, and update_shared_savepoint().

37  {
39  get_global_memory_anchors()->savepoint_manager_memory_;
40  if (engine_->is_master()) {
41  // Savepoint takes place only in master
43  savepoint_ = Savepoint();
45  LOG(INFO) << "Initializing SavepointManager.. path=" << savepoint_path_;
46  auto logger_count = engine_->get_options().log_.loggers_per_node_
48  if (fs::exists(savepoint_path_)) {
49  LOG(INFO) << "Existing savepoint file found. Loading..";
50  CHECK_ERROR(savepoint_.load_from_file(savepoint_path_));
51  if (!savepoint_.consistent(logger_count)) {
53  }
54  } else {
55  LOG(INFO) << "Savepoint file does not exist. No savepoint taken so far.";
56  // Create an empty savepoint file now. This makes sure the directory entry for the file
57  // exists.
58  savepoint_.populate_empty(logger_count);
59  CHECK_ERROR(savepoint_.save_to_file(savepoint_path_));
60  }
69  savepoint_thread_ = std::move(std::thread(&SavepointManagerPimpl::savepoint_main, this));
71  } else {
72  // other engines wait for the master engine until it finishes the initialization of
73  // relevant fields. Some of the following modules depend on these values.
74  uint32_t sleep_cont = 0;
75  while (control_block_->master_initialized_ == false) {
76  std::this_thread::sleep_for(std::chrono::milliseconds(10));
77  if (++sleep_cont > 1000ULL) {
78  return ERROR_STACK_MSG(kErrorCodeTimeout, "Master engine couldn't load savepoint??");
79  }
80  }
81  LOG(INFO) << "Okay, master-engine has finished loading initial savepoint.";
82  }
83  return kRetOk;
84 }
fs::Path savepoint_path_
Path of the savepoint file.
#define ERROR_STACK(e)
Instantiates ErrorStack with the given foedus::error_code, creating an error stack with the current f...
Epoch::EpochInteger current_epoch_
Current epoch of the entire engine.
Definition: savepoint.hpp:53
ErrorStack save_to_file(const fs::Path &path) const
Atomically and durably writes out this object to the specified XML file.
0x0008 : "GENERAL: Timeout." .
Definition: error_code.hpp:112
const EngineOptions & get_options() const
Definition: engine.cpp:39
bool is_master() const
Returns if this engine object is a master instance.
Definition: engine.cpp:68
Epoch::EpochInteger saved_durable_epoch_
The durable epoch that has been made persistent in previous savepoint-ing.
fs::FixedPath savepoint_path_
Full path of the savepoint file.
savepoint::SavepointOptions savepoint_
std::basic_string< CHAR > str() const
Convert to a std::string object.
bool exists(const Path &p)
Returns if the file exists.
Definition: filesystem.hpp:128
uint16_t group_count_
Number of ThreadGroup in the engine.
void populate_empty(log::LoggerId logger_count)
Populate variables as an initial state.
Definition: savepoint.cpp:79
thread::ThreadOptions thread_
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
Epoch::EpochInteger earliest_epoch_
The earliest epoch that can exist in this system.
Definition: savepoint.hpp:72
ErrorStack load_from_file(const fs::Path &path)
Load the content of this object from the specified XML file.
const ErrorStack kRetOk
Normal return value for no-error case.
Savepoint savepoint_
The current progress of the entire engine.
soc::SocManager * get_soc_manager() const
See SOC and IPC.
Definition: engine.cpp:59
#define ERROR_STACK_MSG(e, m)
Overload of ERROR_STACK(e) to receive a custom error message.
Epoch::EpochInteger requested_durable_epoch_
Client SOC sets this value and then wakes up the savepoint thread.
0x0701 : "SAVEPNT: Savepoint file is not consistent with other configurations. Check the number of lo...
Definition: error_code.hpp:165
bool consistent(log::LoggerId logger_count) const
Tells if the variables are consistent.
Definition: savepoint.hpp:121
Epoch::EpochInteger durable_epoch_
Latest epoch whose logs were all flushed to disk.
Definition: savepoint.hpp:65
void memory_fence_release()
Equivalent to std::atomic_thread_fence(std::memory_order_release).
std::thread savepoint_thread_
The thread to take savepoints.
uint16_t loggers_per_node_
Number of loggers per NUMA node.
Definition: log_options.hpp:80
SharedMemoryRepo * get_shared_memory_repo()
Returns the shared memories maintained across SOCs.
Definition: soc_manager.cpp:38

Here is the call graph for this function:

bool foedus::savepoint::SavepointManagerPimpl::is_stop_requested ( )
inline

Definition at line 143 of file savepoint_manager_pimpl.hpp.

References savepoint_thread_stop_requested_.

Referenced by savepoint_main().

Here is the caller graph for this function:

void foedus::savepoint::SavepointManagerPimpl::savepoint_main ( )

Definition at line 158 of file savepoint_manager_pimpl.cpp.

References foedus::soc::SharedPolling::acquire_ticket(), foedus::log::LogManager::announce_new_durable_global_epoch(), foedus::savepoint::Savepoint::assert_epoch_values(), COERCE_ERROR, control_block_, foedus::log::LogManager::copy_logger_states(), foedus::savepoint::Savepoint::current_epoch_, foedus::savepoint::Savepoint::durable_epoch_, foedus::log::MetaLogControlBlock::durable_offset_, foedus::savepoint::Savepoint::earliest_epoch_, engine_, foedus::xct::XctManager::get_current_global_epoch(), foedus::Engine::get_earliest_epoch(), foedus::soc::SharedMemoryRepo::get_global_memory_anchors(), foedus::Engine::get_log_manager(), get_requested_durable_epoch(), foedus::soc::SocManager::get_shared_memory_repo(), foedus::Engine::get_soc_manager(), foedus::Engine::get_xct_manager(), is_stop_requested(), foedus::Epoch::kEpochInvalid, foedus::snapshot::kNullSnapshotId, foedus::savepoint::Savepoint::latest_snapshot_epoch_, foedus::savepoint::FixedSavepoint::latest_snapshot_epoch_, foedus::savepoint::Savepoint::latest_snapshot_id_, foedus::savepoint::FixedSavepoint::latest_snapshot_id_, foedus::assorted::memory_fence_release(), foedus::savepoint::Savepoint::meta_log_durable_offset_, foedus::savepoint::Savepoint::meta_log_oldest_offset_, foedus::soc::GlobalMemoryAnchors::meta_logger_memory_, foedus::savepoint::SavepointManagerControlBlock::new_snapshot_epoch_, foedus::savepoint::SavepointManagerControlBlock::new_snapshot_id_, foedus::log::MetaLogControlBlock::oldest_offset_, foedus::savepoint::SavepointManagerControlBlock::requested_durable_epoch_, foedus::savepoint::SavepointManagerControlBlock::save_done_event_, foedus::externalize::Externalizable::save_to_file(), foedus::savepoint::SavepointManagerControlBlock::save_wakeup_, foedus::savepoint::SavepointManagerControlBlock::saved_durable_epoch_, foedus::savepoint::SavepointManagerControlBlock::savepoint_, savepoint_path_, foedus::soc::SharedPolling::signal(), foedus::soc::SharedPolling::timedwait(), update_shared_savepoint(), and foedus::Epoch::value().

Referenced by initialize_once().

158  {
159  LOG(INFO) << "Savepoint thread has started.";
160  while (!is_stop_requested()) {
161  {
162  uint64_t demand = control_block_->save_wakeup_.acquire_ticket();
163  if (!is_stop_requested() &&
166  control_block_->save_wakeup_.timedwait(demand, 100000ULL);
167  }
168  }
169  if (is_stop_requested()) {
170  break;
171  }
174  Savepoint new_savepoint;
175  new_savepoint.current_epoch_ = engine_->get_xct_manager()->get_current_global_epoch().value();
176  Epoch new_durable_epoch = get_requested_durable_epoch();
177  new_savepoint.durable_epoch_ = new_durable_epoch.value();
178  new_savepoint.earliest_epoch_ = engine_->get_earliest_epoch().value();
179  engine_->get_log_manager()->copy_logger_states(&new_savepoint);
180 
182  new_savepoint.latest_snapshot_id_ = control_block_->new_snapshot_id_;
183  new_savepoint.latest_snapshot_epoch_ = control_block_->new_snapshot_epoch_;
186  } else {
187  new_savepoint.latest_snapshot_id_ = control_block_->savepoint_.latest_snapshot_id_;
188  new_savepoint.latest_snapshot_epoch_ = control_block_->savepoint_.latest_snapshot_epoch_;
189  }
190 
191  log::MetaLogControlBlock* metalog_block = engine_->get_soc_manager()->get_shared_memory_repo()
193  // TASK(Hideaki) Here, we should update oldest_offset_ by checking where the snapshot_epoch
194  // ends. So far we don't update this, but metalog is anyway tiny, so isn't a big issue.
195  new_savepoint.meta_log_oldest_offset_ = metalog_block->oldest_offset_;
196  new_savepoint.meta_log_durable_offset_ = metalog_block->durable_offset_;
197  new_savepoint.assert_epoch_values();
198 
199  VLOG(0) << "Writing a savepoint...";
200  VLOG(1) << "Savepoint content=" << new_savepoint;
201  COERCE_ERROR(new_savepoint.save_to_file(savepoint_path_));
202  update_shared_savepoint(new_savepoint); // also write to shared memory
203  VLOG(1) << "Wrote a savepoint.";
205  control_block_->saved_durable_epoch_ = new_durable_epoch.value();
208  }
209  }
210  LOG(INFO) << "Savepoint thread has terminated.";
211 }
fs::Path savepoint_path_
Path of the savepoint file.
FixedSavepoint savepoint_
The content of latest savepoint.
soc::SharedPolling save_wakeup_
savepoint thread sleeps on this condition variable.
Epoch::EpochInteger new_snapshot_epoch_
Set with new_snapshot_id_.
Epoch get_current_global_epoch() const
Returns the current global epoch, the epoch a newly started transaction will be in.
GlobalMemoryAnchors * get_global_memory_anchors()
snapshot::SnapshotId latest_snapshot_id_
Definition: savepoint.hpp:177
log::MetaLogControlBlock * meta_logger_memory_
Tiny memory for metadata logger.
soc::SharedPolling save_done_event_
Whenever a savepoint has been taken, this event is fired.
#define COERCE_ERROR(x)
This macro calls x and aborts if encounters an error.
void copy_logger_states(savepoint::Savepoint *new_savepoint)
Fillup the given savepoint with the current information of the loggers.
Definition: log_manager.cpp:57
Zero is always reserved for invalid epoch.
Definition: epoch.hpp:68
Epoch::EpochInteger saved_durable_epoch_
The durable epoch that has been made persistent in previous savepoint-ing.
uint64_t acquire_ticket() const
Gives the ticket to.
Epoch::EpochInteger latest_snapshot_epoch_
Definition: savepoint.hpp:178
log::LogManager * get_log_manager() const
See Log Manager.
Definition: engine.cpp:49
const SnapshotId kNullSnapshotId
Definition: snapshot_id.hpp:45
xct::XctManager * get_xct_manager() const
See Transaction Manager.
Definition: engine.cpp:61
void announce_new_durable_global_epoch(Epoch new_epoch)
Sets the new global durable epoch and also wakes up threads that were waiting for it...
Definition: log_manager.cpp:42
soc::SocManager * get_soc_manager() const
See SOC and IPC.
Definition: engine.cpp:59
snapshot::SnapshotId new_snapshot_id_
The ID of the new snapshot to remember.
Epoch::EpochInteger requested_durable_epoch_
Client SOC sets this value and then wakes up the savepoint thread.
Epoch get_earliest_epoch() const
Returns the Earliest-Epoch, the minimum epoch that is valid within this engine.
void memory_fence_release()
Equivalent to std::atomic_thread_fence(std::memory_order_release).
uint64_t oldest_offset_
Offset from which log entries are not gleaned yet.
bool timedwait(uint64_t demanded_ticket, uint64_t timeout_microsec, uint64_t polling_spins=kDefaultPollingSpins, uint64_t max_interval_us=kDefaultPollingMaxIntervalUs) const
Wait for signal up to the given timeout.
void signal()
Signal it to let waiters exit.
EpochInteger value() const
Returns the raw integer representation.
Definition: epoch.hpp:102
SharedMemoryRepo * get_shared_memory_repo()
Returns the shared memories maintained across SOCs.
Definition: soc_manager.cpp:38

Here is the call graph for this function:

Here is the caller graph for this function:

ErrorStack foedus::savepoint::SavepointManagerPimpl::take_savepoint ( Epoch  new_global_durable_epoch)

Definition at line 102 of file savepoint_manager_pimpl.cpp.

References foedus::soc::SharedPolling::acquire_ticket(), control_block_, get_requested_durable_epoch(), get_saved_durable_epoch(), foedus::kRetOk, foedus::savepoint::SavepointManagerControlBlock::requested_durable_epoch_, foedus::savepoint::SavepointManagerControlBlock::save_done_event_, foedus::savepoint::SavepointManagerControlBlock::save_wakeup_, foedus::soc::SharedPolling::signal(), foedus::Epoch::value(), and foedus::soc::SharedPolling::wait().

Referenced by foedus::savepoint::SavepointManager::take_savepoint().

102  {
103  while (get_saved_durable_epoch() < new_global_durable_epoch) {
104  if (get_requested_durable_epoch() < new_global_durable_epoch) {
105  if (get_requested_durable_epoch() < new_global_durable_epoch) {
106  control_block_->requested_durable_epoch_ = new_global_durable_epoch.value();
108  }
109  }
110  {
111  uint64_t demand = control_block_->save_done_event_.acquire_ticket();
112  if (get_saved_durable_epoch() >= new_global_durable_epoch) {
113  break;
114  }
116  }
117  }
118  return kRetOk;
119 }
soc::SharedPolling save_wakeup_
savepoint thread sleeps on this condition variable.
void wait(uint64_t demanded_ticket, uint64_t polling_spins=kDefaultPollingSpins, uint64_t max_interval_us=kDefaultPollingMaxIntervalUs) const
Unconditionally wait for signal.
soc::SharedPolling save_done_event_
Whenever a savepoint has been taken, this event is fired.
uint64_t acquire_ticket() const
Gives the ticket to.
const ErrorStack kRetOk
Normal return value for no-error case.
Epoch::EpochInteger requested_durable_epoch_
Client SOC sets this value and then wakes up the savepoint thread.
void signal()
Signal it to let waiters exit.

Here is the call graph for this function:

Here is the caller graph for this function:

ErrorStack foedus::savepoint::SavepointManagerPimpl::take_savepoint_after_snapshot ( snapshot::SnapshotId  new_snapshot_id,
Epoch  new_snapshot_epoch 
)

Definition at line 120 of file savepoint_manager_pimpl.cpp.

References foedus::soc::SharedPolling::acquire_ticket(), ASSERT_ND, control_block_, get_latest_snapshot_epoch(), get_latest_snapshot_id(), foedus::kRetOk, foedus::savepoint::SavepointManagerControlBlock::new_snapshot_epoch_, foedus::savepoint::SavepointManagerControlBlock::new_snapshot_id_, foedus::savepoint::SavepointManagerControlBlock::save_done_event_, foedus::savepoint::SavepointManagerControlBlock::save_wakeup_, foedus::soc::SharedPolling::signal(), foedus::Epoch::value(), and foedus::soc::SharedPolling::wait().

Referenced by foedus::savepoint::SavepointManager::take_savepoint_after_snapshot().

122  {
123  while (get_latest_snapshot_id() != new_snapshot_id) {
124  {
125  control_block_->new_snapshot_id_ = new_snapshot_id;
126  control_block_->new_snapshot_epoch_ = new_snapshot_epoch.value();
128  }
129  {
130  uint64_t demand = control_block_->save_done_event_.acquire_ticket();
131  if (get_latest_snapshot_id() != new_snapshot_id) {
133  }
134  }
135  }
136  ASSERT_ND(get_latest_snapshot_id() == new_snapshot_id);
137  ASSERT_ND(get_latest_snapshot_epoch() == new_snapshot_epoch);
138  return kRetOk;
139 }
soc::SharedPolling save_wakeup_
savepoint thread sleeps on this condition variable.
Epoch::EpochInteger new_snapshot_epoch_
Set with new_snapshot_id_.
snapshot::SnapshotId get_latest_snapshot_id() const
void wait(uint64_t demanded_ticket, uint64_t polling_spins=kDefaultPollingSpins, uint64_t max_interval_us=kDefaultPollingMaxIntervalUs) const
Unconditionally wait for signal.
soc::SharedPolling save_done_event_
Whenever a savepoint has been taken, this event is fired.
uint64_t acquire_ticket() const
Gives the ticket to.
const ErrorStack kRetOk
Normal return value for no-error case.
snapshot::SnapshotId new_snapshot_id_
The ID of the new snapshot to remember.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72
void signal()
Signal it to let waiters exit.

Here is the call graph for this function:

Here is the caller graph for this function:

ErrorStack foedus::savepoint::SavepointManagerPimpl::uninitialize_once ( )
overridevirtual

Implements foedus::DefaultInitializable.

Definition at line 86 of file savepoint_manager_pimpl.cpp.

References control_block_, engine_, foedus::Engine::is_master(), foedus::savepoint::SavepointManagerControlBlock::save_wakeup_, savepoint_thread_, savepoint_thread_stop_requested_, foedus::soc::SharedPolling::signal(), SUMMARIZE_ERROR_BATCH, and foedus::savepoint::SavepointManagerControlBlock::uninitialize().

86  {
87  LOG(INFO) << "Uninitializing SavepointManager..";
88  ErrorStackBatch batch;
89  if (engine_->is_master()) {
90  if (savepoint_thread_.joinable()) {
91  {
94  }
95  savepoint_thread_.join();
96  }
98  }
99  return SUMMARIZE_ERROR_BATCH(batch);
100 }
soc::SharedPolling save_wakeup_
savepoint thread sleeps on this condition variable.
bool is_master() const
Returns if this engine object is a master instance.
Definition: engine.cpp:68
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
std::thread savepoint_thread_
The thread to take savepoints.
void signal()
Signal it to let waiters exit.

Here is the call graph for this function:

void foedus::savepoint::SavepointManagerPimpl::update_shared_savepoint ( const Savepoint src)

Definition at line 141 of file savepoint_manager_pimpl.cpp.

References control_block_, engine_, foedus::Engine::get_options(), foedus::thread::ThreadOptions::group_count_, foedus::EngineOptions::log_, foedus::log::LogOptions::loggers_per_node_, foedus::savepoint::SavepointManagerControlBlock::savepoint_, foedus::savepoint::SavepointManagerControlBlock::savepoint_mutex_, foedus::EngineOptions::thread_, and foedus::savepoint::FixedSavepoint::update().

Referenced by initialize_once(), and savepoint_main().

141  {
142  // write with mutex to not let readers see garbage.
143  // there is only one writer anyway, btw.
144  soc::SharedMutexScope scope(&control_block_->savepoint_mutex_);
148  src);
149 }
soc::SharedMutex savepoint_mutex_
Read/write to savepoint_ is protected with this mutex.
FixedSavepoint savepoint_
The content of latest savepoint.
const EngineOptions & get_options() const
Definition: engine.cpp:39
uint16_t group_count_
Number of ThreadGroup in the engine.
thread::ThreadOptions thread_
uint16_t loggers_per_node_
Number of loggers per NUMA node.
Definition: log_options.hpp:80
void update(uint16_t node_count, uint16_t loggers_per_node_count, const Savepoint &src)
Write out the content of the given Savepoint to this object.
Definition: savepoint.cpp:94

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Engine* const foedus::savepoint::SavepointManagerPimpl::engine_
Savepoint foedus::savepoint::SavepointManagerPimpl::savepoint_

The current progress of the entire engine.

Definition at line 156 of file savepoint_manager_pimpl.hpp.

Referenced by get_logger_savepoint(), and initialize_once().

fs::Path foedus::savepoint::SavepointManagerPimpl::savepoint_path_

Path of the savepoint file.

Definition at line 151 of file savepoint_manager_pimpl.hpp.

Referenced by initialize_once(), and savepoint_main().

std::thread foedus::savepoint::SavepointManagerPimpl::savepoint_thread_

The thread to take savepoints.

Definition at line 146 of file savepoint_manager_pimpl.hpp.

Referenced by initialize_once(), and uninitialize_once().

std::atomic<bool> foedus::savepoint::SavepointManagerPimpl::savepoint_thread_stop_requested_

The documentation for this class was generated from the following files: