20 #include <glog/logging.h>
39 get_global_memory_anchors()->savepoint_manager_memory_;
45 LOG(INFO) <<
"Initializing SavepointManager.. path=" <<
savepoint_path_;
49 LOG(INFO) <<
"Existing savepoint file found. Loading..";
55 LOG(INFO) <<
"Savepoint file does not exist. No savepoint taken so far.";
74 uint32_t sleep_cont = 0;
76 std::this_thread::sleep_for(std::chrono::milliseconds(10));
77 if (++sleep_cont > 1000ULL) {
81 LOG(INFO) <<
"Okay, master-engine has finished loading initial savepoint.";
87 LOG(INFO) <<
"Uninitializing SavepointManager..";
122 Epoch new_snapshot_epoch) {
159 LOG(INFO) <<
"Savepoint thread has started.";
199 VLOG(0) <<
"Writing a savepoint...";
200 VLOG(1) <<
"Savepoint content=" << new_savepoint;
203 VLOG(1) <<
"Wrote a savepoint.";
210 LOG(INFO) <<
"Savepoint thread has terminated.";
soc::SharedMutex savepoint_mutex_
Read/write to savepoint_ is protected with this mutex.
fs::Path savepoint_path_
Path of the savepoint file.
FixedSavepoint savepoint_
The content of latest savepoint.
#define ERROR_STACK(e)
Instantiates ErrorStack with the given foedus::error_code, creating an error stack with the current f...
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
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).
GlobalMemoryAnchors * get_global_memory_anchors()
snapshot::SnapshotId latest_snapshot_id_
void wait(uint64_t demanded_ticket, uint64_t polling_spins=kDefaultPollingSpins, uint64_t max_interval_us=kDefaultPollingMaxIntervalUs) const
Unconditionally wait for signal.
Epoch::EpochInteger current_epoch_
Current epoch of the entire engine.
Brings error stacktrace information as return value of functions.
ErrorStack save_to_file(const fs::Path &path) const
Atomically and durably writes out this object to the specified XML file.
The information we maintain in savepoint manager and externalize to a file.
uint64_t meta_log_oldest_offset_
Offset from which metadata log entries are not gleaned yet.
0x0008 : "GENERAL: Timeout." .
log::MetaLogControlBlock * meta_logger_memory_
Tiny memory for metadata logger.
Epoch get_saved_durable_epoch() const
soc::SharedPolling save_done_event_
Whenever a savepoint has been taken, this event is fired.
uint64_t meta_log_durable_offset_
Offset upto which metadata log entries are fsynced.
const EngineOptions & get_options() const
#define COERCE_ERROR(x)
This macro calls x and aborts if encounters an error.
bool is_master() const
Returns if this engine object is a master instance.
void copy_logger_states(savepoint::Savepoint *new_savepoint)
Fillup the given savepoint with the current information of the loggers.
Zero is always reserved for invalid epoch.
Epoch::EpochInteger saved_durable_epoch_
The durable epoch that has been made persistent in previous savepoint-ing.
ErrorStack initialize_once() override
fs::FixedPath savepoint_path_
Full path of the savepoint file.
uint64_t acquire_ticket() const
Gives the ticket to.
Batches zero or more ErrorStack objects to represent in one ErrorStack.
SavepointManagerControlBlock * control_block_
Epoch::EpochInteger latest_snapshot_epoch_
ErrorStack uninitialize_once() override
Analogue of boost::filesystem::path.
log::LogManager * get_log_manager() const
See Log Manager.
Epoch::EpochInteger latest_snapshot_epoch_
The most recently snapshot-ed epoch, all logs upto this epoch is safe to delete.
savepoint::SavepointOptions savepoint_
Epoch::EpochInteger initial_durable_epoch_
std::basic_string< CHAR > str() const
Convert to a std::string object.
Auto-lock scope object for SharedMutex.
bool exists(const Path &p)
Returns if the file exists.
ErrorStack take_savepoint(Epoch new_global_durable_epoch)
ErrorStack take_savepoint_after_snapshot(snapshot::SnapshotId new_snapshot_id, Epoch new_snapshot_epoch)
uint16_t group_count_
Number of ThreadGroup in the engine.
uint16_t SnapshotId
Unique ID of Snapshot.
void populate_empty(log::LoggerId logger_count)
Populate variables as an initial state.
Epoch get_requested_durable_epoch() const
const SnapshotId kNullSnapshotId
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
xct::XctManager * get_xct_manager() const
See Transaction Manager.
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...
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.
Epoch get_latest_snapshot_epoch() const
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.
std::atomic< bool > master_initialized_
Atomic fence methods and load/store with fences that work for both C++11/non-C++11 code...
#define ERROR_STACK_MSG(e, m)
Overload of ERROR_STACK(e) to receive a custom error message.
snapshot::SnapshotId new_snapshot_id_
The ID of the new snapshot to remember.
void assert_epoch_values() const
Check invariants on current_epoch_/durable_epoch_.
Epoch::EpochInteger requested_durable_epoch_
Client SOC sets this value and then wakes up the savepoint thread.
LoggerSavepointInfo logger_info_[1U<< 16]
Stores all loggers' information.
0x0701 : "SAVEPNT: Savepoint file is not consistent with other configurations. Check the number of lo...
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
void update_shared_savepoint(const Savepoint &src)
Epoch get_earliest_epoch() const
Returns the Earliest-Epoch, the minimum epoch that is valid within this engine.
bool consistent(log::LoggerId logger_count) const
Tells if the variables are consistent.
Information in savepoint for one logger.
snapshot::SnapshotId latest_snapshot_id_
The most recent complete snapshot.
Epoch::EpochInteger durable_epoch_
Latest epoch whose logs were all flushed to disk.
uint16_t LoggerId
Typedef for an ID of Logger.
void memory_fence_release()
Equivalent to std::atomic_thread_fence(std::memory_order_release).
std::atomic< bool > savepoint_thread_stop_requested_
Epoch::EpochInteger initial_current_epoch_
LoggerSavepointInfo get_logger_savepoint(log::LoggerId logger_id)
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.
std::thread savepoint_thread_
The thread to take savepoints.
void signal()
Signal it to let waiters exit.
uint16_t loggers_per_node_
Number of loggers per NUMA node.
EpochInteger value() const
Returns the raw integer representation.
Epoch::EpochInteger earliest_epoch_
SharedMemoryRepo * get_shared_memory_repo()
Returns the shared memories maintained across SOCs.
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.