48 for (
auto& files_in_a_snapshot : files_) {
49 auto& values = files_in_a_snapshot.second;
50 for (
auto& file : values) {
64 auto snapshot = files_.find(snapshot_id);
65 if (snapshot == files_.end()) {
68 snapshot_id, std::map< thread::ThreadGroupId, fs::DirectIoFile* >()));
69 snapshot = files_.find(snapshot_id);
72 ASSERT_ND(snapshot->first == snapshot_id);
73 auto& the_map = snapshot->second;
74 auto node = the_map.find(node_id);
75 if (node != the_map.end()) {
83 ErrorCode open_error = file->open(
true,
false,
false,
false);
88 std::pair< thread::ThreadGroupId, fs::DirectIoFile* > entry(node_id, file);
89 the_map.insert(entry);
103 ASSERT_ND(reinterpret_cast<storage::Page*>(out)->get_header().page_id_ == page_id);
120 for (uint32_t i = 0; i < page_count; ++i) {
121 ASSERT_ND(pages[i].get_header().page_id_ == page_id_begin + i);
128 o <<
"<SnapshotFileSet>";
129 for (
const auto& snapshot : v.files_) {
130 o <<
"<snapshot id=\"" << snapshot.first <<
"\">";
131 for (
const auto& entry : snapshot.second) {
132 o <<
"<node id=\"" << entry.first
133 <<
"\" fd=\"" << entry.second->get_descriptor() <<
"\" />";
ErrorStack uninitialize_once() override
uint64_t SnapshotLocalPageId
Represents a local page ID in each one snapshot file in some NUMA node.
SnapshotLocalPageId extract_local_page_id_from_snapshot_pointer(SnapshotPagePointer pointer)
ErrorCode read_page(storage::SnapshotPagePointer page_id, void *out)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
std::ostream & operator<<(std::ostream &o, const HashFunc &v)
Brings error stacktrace information as return value of functions.
Holds a set of read-only file objects for snapshot files.
const EngineOptions & get_options() const
ErrorCode read_raw(uint64_t desired_bytes, void *buffer)
A version that receives a raw pointer that has to be aligned (be careful to use this ver)...
Batches zero or more ErrorStack objects to represent in one ErrorStack.
Analogue of boost::filesystem::path.
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
snapshot::SnapshotOptions snapshot_
Database engine object that holds all resources and provides APIs.
ErrorStack initialize_once() override
ErrorCode seek(uint64_t offset, SeekType seek_type)
Sets the position of the next byte to be written/extracted from/to the stream.
Just a marker to denote that the memory region represents a data page.
ErrorCode read_pages(storage::SnapshotPagePointer page_id_begin, uint32_t page_count, void *out)
Read contiguous pages in one shot.
uint16_t SnapshotId
Unique ID of Snapshot.
std::string construct_snapshot_file_path(int snapshot_id, int node) const
'folder_path'/snapshot_'snapshot-id'node'node-id'.data.
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
#define CHECK_ERROR_CODE(x)
This macro calls x and checks its returned error code.
ErrorCode get_or_open_file(storage::SnapshotPagePointer page_pointer, fs::DirectIoFile **out)
Represents an I/O stream on one file without filesystem caching.
const ErrorStack kRetOk
Normal return value for no-error case.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
The offset is set to offset bytes.
ErrorCode
Enum of error codes defined in error_code.xmacro.