18 #ifndef FOEDUS_SNAPSHOT_SNAPSHOT_MANAGER_PIMPL_HPP_
19 #define FOEDUS_SNAPSHOT_SNAPSHOT_MANAGER_PIMPL_HPP_
226 bool wait_completion,
227 Epoch suggested_snapshot_epoch);
284 std::map<storage::StorageId, storage::SnapshotPagePointer>* new_root_page_pointers);
293 const std::map<storage::StorageId, storage::SnapshotPagePointer>& new_root_page_pointers);
308 const std::map<storage::StorageId, storage::SnapshotPagePointer>& new_root_page_pointers);
312 const std::map<storage::StorageId, storage::SnapshotPagePointer>& new_root_page_pointers,
314 uint16_t parallel_id);
361 "SnapshotManagerControlBlock is too large.");
365 #endif // FOEDUS_SNAPSHOT_SNAPSHOT_MANAGER_PIMPL_HPP_
std::atomic< bool > gleaning_
Whether the log gleaner is now running.
LogGleanerControlBlock()=delete
SnapshotId get_previous_snapshot_id_weak() const
void handle_snapshot()
Main routine for snapshot_thread_ in master engine.
ErrorStack read_snapshot_metadata(SnapshotId snapshot_id, SnapshotMetadata *out)
Epoch get_snapshot_epoch() const
void drop_volatile_pages_parallel(const Snapshot &new_snapshot, const std::map< storage::StorageId, storage::SnapshotPagePointer > &new_root_page_pointers, void *result_memory, uint16_t parallel_id)
subroutine invoked by one thread for one node.
Epoch get_requested_snapshot_epoch() const
Typedefs of ID types used in snapshot package.
SnapshotManagerControlBlock * control_block_
const SnapshotOptions & get_option() const
shorthand for engine_->get_options().snapshot_.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
ErrorStack handle_snapshot_triggered(Snapshot *new_snapshot)
handle_snapshot() calls this when it should start snapshotting.
SnapshotId get_previous_snapshot_id() const
Forward declarations of classes in root package.
Local resource for the log gleaner, which runs only in the master node.
Brings error stacktrace information as return value of functions.
Forward declarations of classes in snapshot manager package.
ErrorStack initialize_once() override
uint16_t reducers_count_
Total number of mappers.
A polling-wait mechanism that can be placed in shared memory and used from multiple processes...
Typical implementation of Initializable as a skeleton base class.
SnapshotManagerPimpl(Engine *engine)
ErrorStack snapshot_savepoint(const Snapshot &new_snapshot)
Sub-routine of handle_snapshot_triggered().
std::atomic< SnapshotId > previous_snapshot_id_
ID of previously completed snapshot.
std::atomic< uint16_t > exit_count_
count of mappers/reducers that have exitted.
LogGleanerResource gleaner_resource_
Local resources for gleaner, which runs only in the master node.
Zero is always reserved for invalid epoch.
bool is_error() const
If this returns true, all mappers and reducers should exit as soon as possible.
LogGleanerControlBlock gleaner_
Gleaner-related variables.
SnapshotId issue_next_snapshot_id()
uint16_t mappers_count_
Total number of mappers.
Analogue of boost::filesystem::path.
std::atomic< uint16_t > error_count_
count of mappers/reducers that have exitted with some error.
SnapshotId get_previous_snapshot_id_weak() const
ErrorStack uninitialize_once() override
Database engine object that holds all resources and provides APIs.
uint16_t all_count_
mappers_count_ + reducers_count_.
~LogGleanerControlBlock()=delete
void wakeup_snapshot_children()
Fires snapshot_children_wakeup_.
soc::SharedPolling snapshot_wakeup_
Snapshot thread sleeps on this condition variable.
ErrorStack snapshot_metadata(const Snapshot &new_snapshot, const std::map< storage::StorageId, storage::SnapshotPagePointer > &new_root_page_pointers)
Sub-routine of handle_snapshot_triggered().
std::vector< Snapshot > snapshots_
All previously taken snapshots.
Epoch get_snapshot_epoch() const
SnapshotId increment(SnapshotId id)
Increment SnapshotId.
Represents one snapshot that converts all logs from base epoch to valid_until epoch into snapshot fil...
std::chrono::system_clock::time_point previous_snapshot_time_
When snapshot_thread_ took snapshot last time.
std::atomic< Epoch::EpochInteger > requested_snapshot_epoch_
When a caller wants to immediately invoke snapshot, it calls trigger_snapshot_immediate(), which sets this value and then wakes up snapshot_thread_.
Set of options for snapshot manager.
uint16_t SnapshotId
Unique ID of Snapshot.
fs::Path get_snapshot_metadata_file_path(SnapshotId snapshot_id) const
each snapshot has a snapshot-metadata file "snapshot_metadata_.xml" in first node's firs...
const SnapshotId kNullSnapshotId
LogReducer * local_reducer_
Reducer in this node.
Epoch get_snapshot_epoch_weak() const
Shared data in SnapshotManagerPimpl.
std::vector< LogMapper * > local_mappers_
Mappers in this node.
Epoch get_snapshot_epoch_weak() const
Snapshot cur_snapshot_
The snapshot we are now taking.
ErrorStack drop_volatile_pages(const Snapshot &new_snapshot, const std::map< storage::StorageId, storage::SnapshotPagePointer > &new_root_page_pointers)
Sub-routine of handle_snapshot_triggered().
bool is_stop_requested() const
std::atomic< bool > terminating_
Whether the engine is being terminated.
void stop_snapshot_thread()
This is a hidden API called at the beginning of engine shutdown (namely restart manager).
std::atomic< uint16_t > completed_count_
count of mappers/reducers that have completed processing the current epoch.
soc::SharedPolling snapshot_taken_
Fired (notify_all) whenever snapshotting is completed.
Pimpl object of SnapshotManager.
ErrorStack glean_logs(const Snapshot &new_snapshot, std::map< storage::StorageId, storage::SnapshotPagePointer > *new_root_page_pointers)
Sub-routine of handle_snapshot_triggered().
std::atomic< Epoch::EpochInteger > snapshot_epoch_
The most recently snapshot-ed epoch, all logs upto this epoch is safe to delete.
void handle_snapshot_child()
Main routine for snapshot_thread_ in child engines.
Shared data for LogGleaner.
std::thread snapshot_thread_
The daemon thread of snapshot manager.
SnapshotManagerPimpl()=delete
soc::SharedPolling snapshot_children_wakeup_
Child snapshot managers (the ones in SOC engines) sleep on this condition until the master snapshot m...
SnapshotManagerControlBlock()=delete
void memory_fence_release()
Equivalent to std::atomic_thread_fence(std::memory_order_release).
A log reducer, which receives log entries sent from mappers and applies them to construct new snapsho...
void trigger_snapshot_immediate(bool wait_completion, Epoch suggested_snapshot_epoch)
~SnapshotManagerControlBlock()=delete
std::atomic< bool > cancelled_
Whether the log gleaner has been cancalled.
std::atomic< bool > stop_requested_
To locally shutdown snapshot_thread_.
void signal()
Signal it to let waiters exit.
std::atomic< uint16_t > completed_mapper_count_
We also have a separate count for mappers only to know if all mappers are done.
SnapshotId get_previous_snapshot_id() const