libfoedus-core
FOEDUS Core Library
|
Just a marker to denote that a memory region represents a data page. More...
Just a marker to denote that a memory region represents a data page.
Each storage page class contains this at the beginning to declare common properties. In other words, we can always reinterpret_cast a page pointer to this object and get/set basic properties.
#include <page.hpp>
Public Member Functions | |
PageHeader ()=delete | |
PageHeader (const PageHeader &other)=delete | |
PageHeader & | operator= (const PageHeader &other)=delete |
PageType | get_page_type () const |
uint8_t | get_in_layer_level () const |
void | set_in_layer_level (uint8_t level) |
void | init_volatile (VolatilePagePointer page_id, StorageId storage_id, PageType page_type) __attribute__((always_inline)) |
void | init_snapshot (SnapshotPagePointer page_id, StorageId storage_id, PageType page_type) __attribute__((always_inline)) |
void | increment_key_count () __attribute__((always_inline)) |
void | set_key_count (uint8_t key_count) __attribute__((always_inline)) |
bool | contains_hot_records (thread::Thread *context) |
Public Attributes | |
uint64_t | page_id_ |
Page ID of this page. More... | |
StorageId | storage_id_ |
ID of the storage this page belongs to. More... | |
Checksum | checksum_ |
Checksum of the content of this page to detect corrupted pages. More... | |
uint8_t | page_type_ |
Actually of PageType. More... | |
bool | snapshot_ |
Whether this page image is of a snapshot page. More... | |
uint16_t | key_count_ |
physical key count (those keys might be deleted) in this page. More... | |
uint8_t | masstree_layer_ |
used only in masstree. More... | |
uint8_t | masstree_in_layer_level_ |
used only in masstree. More... | |
uint8_t | stat_last_updater_node_ |
A loosely maintained statistics for volatile pages. More... | |
assorted::ProbCounter | hotness_ |
Loosely maintained statistics on data temperature. More... | |
PageVersion | page_version_ |
Used in several storage types as concurrency control mechanism for the page. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const PageHeader &v) |
|
delete |
|
delete |
bool foedus::storage::PageHeader::contains_hot_records | ( | thread::Thread * | context | ) |
Definition at line 81 of file page.cpp.
References foedus::thread::Thread::get_current_xct(), foedus::xct::Xct::get_hot_threshold_for_this_xct(), hotness_, and foedus::assorted::ProbCounter::value_.
Referenced by foedus::xct::RwLockableXctId::is_hot().
|
inline |
Definition at line 281 of file page.hpp.
References masstree_in_layer_level_.
Referenced by foedus::storage::hash::HashIntermediatePage::get_level(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive(), and foedus::storage::hash::HashDataPage::release_pages_recursive().
|
inline |
Definition at line 280 of file page.hpp.
References page_type_.
Referenced by foedus::storage::assert_valid_volatile_page(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::hash::HashStoragePimpl::follow_page(), foedus::storage::hash::HashStoragePimpl::follow_page_bin_head(), foedus::storage::Page::get_page_type(), foedus::storage::hash::hash_data_volatile_page_init(), foedus::storage::hash::hash_intermediate_volatile_page_init(), foedus::storage::hash::HashDataPage::initialize_volatile_page(), foedus::storage::masstree::MasstreePage::is_border(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive(), foedus::storage::masstree::MasstreePage::release_pages_recursive_common(), foedus::storage::hash::release_parallel(), foedus::storage::hash::resolve_data_impl(), foedus::storage::hash::resolve_intermediate_impl(), foedus::storage::masstree::verify_page_basic(), and foedus::storage::hash::HashStoragePimpl::verify_single_thread_intermediate().
|
inline |
Definition at line 318 of file page.hpp.
References key_count_.
Referenced by foedus::storage::hash::ReserveRecords::append_record_to_page(), foedus::storage::hash::HashDataPage::create_record_in_snapshot(), foedus::storage::masstree::MasstreePage::increment_key_count(), and foedus::storage::hash::HashDataPage::reserve_record().
|
inline |
Definition at line 301 of file page.hpp.
References foedus::storage::extract_numa_node_from_snapshot_pointer(), foedus::assorted::ProbCounter::reset(), and foedus::storage::PageVersion::reset().
Referenced by foedus::storage::masstree::MasstreePage::initialize_snapshot_common(), foedus::storage::array::ArrayPage::initialize_snapshot_page(), foedus::storage::hash::HashIntermediatePage::initialize_snapshot_page(), foedus::storage::sequential::SequentialPage::initialize_snapshot_page(), foedus::storage::hash::HashDataPage::initialize_snapshot_page(), and foedus::storage::sequential::SequentialRootPage::initialize_snapshot_page().
|
inline |
Definition at line 284 of file page.hpp.
References foedus::assorted::ProbCounter::reset(), and foedus::storage::PageVersion::reset().
Referenced by foedus::xct::McsMockDataPage::init(), foedus::storage::masstree::MasstreePage::initialize_volatile_common(), foedus::storage::array::ArrayPage::initialize_volatile_page(), foedus::storage::hash::HashIntermediatePage::initialize_volatile_page(), foedus::storage::sequential::SequentialPage::initialize_volatile_page(), and foedus::storage::hash::HashDataPage::initialize_volatile_page().
|
delete |
|
inline |
Definition at line 282 of file page.hpp.
Referenced by foedus::storage::hash::HashIntermediatePage::initialize_snapshot_page(), and foedus::storage::hash::HashIntermediatePage::initialize_volatile_page().
|
inline |
Definition at line 319 of file page.hpp.
Referenced by foedus::storage::masstree::SplitIntermediate::migrate_pointers(), and foedus::storage::masstree::MasstreePage::set_key_count().
|
friend |
Definition at line 52 of file page.cpp.
Checksum foedus::storage::PageHeader::checksum_ |
Checksum of the content of this page to detect corrupted pages.
Changes only when this page becomes a snapshot page.
Definition at line 202 of file page.hpp.
Referenced by foedus::snapshot::SnapshotWriter::open(), and foedus::storage::operator<<().
assorted::ProbCounter foedus::storage::PageHeader::hotness_ |
Loosely maintained statistics on data temperature.
This is a probabilistic counter: 0->1 = 100%, 1->2 = 50%, 2->3 = 25%, etc. So it grows exponentially, which should make it easy enough to tell an obviously hot record/page.
XXX(tzwang): This field only makes sense for volatile pages.
Among the preceeding word-size-algned fields (masstree_layer_, masstree_in_layer_level_, and stat_last_updater_node_), masstree_* are not changed once page constructed; stat_last_updater_node_ is loosely maintained stat. So we don't need to use atomic write for this field.
Assuming 4-byte word size ($getconf WORD_BIT).
Definition at line 268 of file page.hpp.
Referenced by foedus::xct::RetrospectiveLockList::construct(), contains_hot_records(), foedus::storage::hash::HashStoragePimpl::hcc_reset_all_temperature_stat_data(), foedus::storage::array::ArrayStoragePimpl::hcc_reset_all_temperature_stat_intermediate(), foedus::storage::masstree::MasstreeStoragePimpl::hcc_reset_all_temperature_stat_recurse(), foedus::xct::RwLockableXctId::hotter(), foedus::thread::Thread::is_hot_page(), and foedus::storage::operator<<().
uint16_t foedus::storage::PageHeader::key_count_ |
physical key count (those keys might be deleted) in this page.
It depends on the page type what "key count" exactly means. For example, in masstree interior page, key count is a separator count, so it contains pointers of key_count_+1. In many pages, key_count=record_count.
Definition at line 219 of file page.hpp.
Referenced by foedus::storage::sequential::SequentialPage::append_record_nosync(), foedus::storage::masstree::MasstreePage::get_key_count(), foedus::storage::hash::HashDataPage::get_record_count(), foedus::storage::masstree::grow_case_b_common(), increment_key_count(), foedus::storage::masstree::MasstreeBorderPage::initialize_layer_root(), and foedus::storage::operator<<().
uint8_t foedus::storage::PageHeader::masstree_in_layer_level_ |
used only in masstree.
Logical B-tree level of the page. Border pages are always level-0 whether they are foster-child or not. Intermediate pages right above border pages are level-1, their parents are level-2, ... Foster-child of an intermediate page has the same level as its foster parent. Again, this is a logical level, not physical.
Our implementation of masstree might have unbalanced sub-trees. In that case, an interemediate page's level is max(child's level) + 1. This imbalance can happen only at the root page of the first layer because of how the masstree composer work. Other than that, all B-tree nodes are balanced.
Definition at line 243 of file page.hpp.
Referenced by foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::masstree::MasstreePage::get_btree_level(), get_in_layer_level(), foedus::storage::masstree::MasstreePage::initialize_snapshot_common(), foedus::storage::masstree::MasstreePage::initialize_volatile_common(), and foedus::storage::operator<<().
uint8_t foedus::storage::PageHeader::masstree_layer_ |
used only in masstree.
Layer-0 stores the first 8 byte slice, Layer-1 next 8 byte...
Definition at line 226 of file page.hpp.
Referenced by foedus::storage::masstree::extract_page_layer(), foedus::storage::hash::HashDataPage::get_bin_shifts(), foedus::storage::masstree::MasstreePage::get_layer(), foedus::storage::masstree::MasstreePage::initialize_snapshot_common(), foedus::storage::masstree::MasstreePage::initialize_volatile_common(), foedus::storage::operator<<(), and foedus::storage::hash::HashDataPage::protected_set_bin_shifts().
uint64_t foedus::storage::PageHeader::page_id_ |
Page ID of this page.
If this page is a snapshot page, it stores SnapshotPagePointer. If this page is a volatile page, it stores VolatilePagePointer (only numa_node/offset matters).
Definition at line 191 of file page.hpp.
Referenced by foedus::storage::masstree::allocate_new_border_page(), foedus::storage::assert_valid_volatile_page(), foedus::storage::assert_within_valid_volatile_page_impl(), foedus::storage::sequential::SequentialComposer::compose(), foedus::storage::array::ArrayComposer::construct_root(), foedus::storage::hash::HashComposer::construct_root(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::sequential::SequentialComposer::construct_root(), foedus::storage::masstree::SplitIntermediate::decide_strategy(), foedus::thread::ThreadPimpl::find_or_read_a_snapshot_page(), foedus::thread::ThreadPimpl::find_or_read_snapshot_pages_batch(), foedus::storage::hash::HashStoragePimpl::follow_page_bin_head(), foedus::storage::hash::HashIntermediatePage::get_snapshot_page_id(), foedus::storage::masstree::MasstreePage::get_snapshot_page_id(), foedus::storage::hash::HashDataPage::get_snapshot_page_id(), foedus::storage::Page::get_snapshot_page_id(), foedus::storage::hash::HashIntermediatePage::get_volatile_page_id(), foedus::storage::masstree::MasstreePage::get_volatile_page_id(), foedus::storage::hash::HashDataPage::get_volatile_page_id(), foedus::storage::Page::get_volatile_page_id(), foedus::thread::ThreadPimpl::install_a_volatile_page(), foedus::storage::masstree::SplitBorder::lock_existing_records(), foedus::snapshot::SnapshotWriter::open(), foedus::storage::hash::ComposedBinsMergedStream::open_path(), foedus::storage::operator<<(), foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive(), foedus::storage::hash::HashDataPage::release_pages_recursive(), foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive(), foedus::storage::masstree::MasstreeBorderPage::release_pages_recursive(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive_parallel(), foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive_parallel(), foedus::storage::hash::resolve_data_impl(), foedus::storage::hash::resolve_intermediate_impl(), foedus::memory::GlobalVolatilePageResolver::resolve_offset(), and foedus::storage::masstree::ReserveRecords::run().
uint8_t foedus::storage::PageHeader::page_type_ |
Actually of PageType.
Definition at line 205 of file page.hpp.
Referenced by get_page_type(), and foedus::storage::operator<<().
PageVersion foedus::storage::PageHeader::page_version_ |
Used in several storage types as concurrency control mechanism for the page.
Definition at line 272 of file page.hpp.
Referenced by foedus::storage::sequential::SequentialPage::append_record_nosync(), foedus::storage::hash::ReserveRecords::create_new_record_in_tail_page(), foedus::storage::hash::ReserveRecords::find_and_lock_spacious_tail(), foedus::storage::masstree::MasstreePage::get_lock_address(), foedus::storage::masstree::MasstreePage::get_version(), foedus::storage::masstree::MasstreePage::get_version_address(), foedus::storage::masstree::MasstreePage::has_foster_child(), foedus::storage::masstree::MasstreePage::is_locked(), foedus::storage::hash::HashDataPage::is_locked(), foedus::storage::masstree::MasstreePage::is_moved(), foedus::storage::masstree::MasstreePage::is_retired(), foedus::thread::ThreadPimpl::is_volatile_page_retired(), foedus::storage::hash::HashStoragePimpl::locate_record(), foedus::storage::operator<<(), foedus::xct::SysxctLockList::release_all_locks(), foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive(), foedus::storage::masstree::MasstreeBorderPage::release_pages_recursive(), foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive_parallel(), foedus::storage::hash::HashDataPage::reserve_record(), foedus::storage::hash::ReserveRecords::search_within_page(), foedus::storage::masstree::MasstreePage::set_moved(), foedus::storage::masstree::MasstreePage::set_retired(), and foedus::storage::hash::HashStoragePimpl::verify_single_thread_intermediate().
bool foedus::storage::PageHeader::snapshot_ |
Whether this page image is of a snapshot page.
This is one of the properties that don't have permanent meaning.
Definition at line 211 of file page.hpp.
Referenced by foedus::storage::masstree::Adopt::adopt_case_a(), foedus::storage::masstree::MasstreeIntermediatePage::append_minipage_snapshot(), foedus::storage::masstree::MasstreeIntermediatePage::append_pointer_snapshot(), foedus::storage::sequential::SequentialPage::append_record_nosync(), foedus::storage::hash::HashDataPage::assert_entries_impl(), foedus::storage::masstree::MasstreeBorderPage::assert_entries_impl(), foedus::storage::assert_within_valid_volatile_page_impl(), foedus::storage::masstree::MasstreeBorderPage::can_accomodate_snapshot(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::hash::HashDataPage::create_record_in_snapshot(), foedus::storage::masstree::MasstreeIntermediatePage::extract_separators_snapshot(), foedus::storage::masstree::MasstreeIntermediatePage::extract_separators_volatile(), foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root_double(), foedus::storage::masstree::MasstreeBorderPage::find_key_for_snapshot(), foedus::storage::hash::ReserveRecords::find_or_create_or_expand(), foedus::storage::hash::HashStoragePimpl::follow_page(), foedus::storage::hash::HashStoragePimpl::follow_page_bin_head(), foedus::thread::ThreadPimpl::follow_page_pointer(), foedus::thread::ThreadPimpl::follow_page_pointers_for_read_batch(), foedus::thread::ThreadPimpl::follow_page_pointers_for_write_batch(), foedus::storage::array::ArrayStoragePimpl::follow_pointers_for_read_batch(), foedus::storage::array::ArrayStoragePimpl::follow_pointers_for_write_batch(), foedus::storage::masstree::MasstreeStoragePimpl::get_first_root(), foedus::storage::hash::HashIntermediatePage::get_snapshot_page_id(), foedus::storage::masstree::MasstreePage::get_snapshot_page_id(), foedus::storage::hash::HashDataPage::get_snapshot_page_id(), foedus::storage::Page::get_snapshot_page_id(), foedus::storage::hash::HashIntermediatePage::get_volatile_page_id(), foedus::storage::masstree::MasstreePage::get_volatile_page_id(), foedus::storage::hash::HashDataPage::get_volatile_page_id(), foedus::storage::Page::get_volatile_page_id(), foedus::storage::masstree::grow_case_a_common(), foedus::storage::hash::HashStoragePimpl::insert_record(), foedus::thread::ThreadPimpl::install_a_volatile_page(), foedus::storage::hash::HashStoragePimpl::locate_bin(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record(), foedus::storage::hash::HashStoragePimpl::locate_record(), foedus::storage::hash::HashStoragePimpl::locate_record_in_snapshot(), foedus::storage::masstree::MasstreeStoragePimpl::locate_record_normalized(), foedus::storage::array::ArrayStoragePimpl::lookup_for_read(), foedus::storage::array::ArrayStoragePimpl::lookup_for_read_batch(), foedus::storage::array::ArrayStoragePimpl::lookup_for_write(), foedus::storage::array::ArrayStoragePimpl::lookup_for_write_batch(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::MasstreeIntermediatePointerIterator(), foedus::storage::operator<<(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_next_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::thread::ThreadPimpl::place_a_new_volatile_page(), foedus::storage::array::ArrayStoragePimpl::prefetch_pages_recurse(), foedus::storage::hash::ComposedBinsMergedStream::process_a_bin(), foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot(), foedus::storage::masstree::Adopt::run(), foedus::storage::masstree::GrowNonFirstLayerRoot::run(), foedus::storage::masstree::SplitBorder::run(), foedus::storage::masstree::ReserveRecords::run(), foedus::storage::hash::ReserveRecords::search_within_page(), foedus::storage::masstree::MasstreePage::set_foster_major_offset_unsafe(), foedus::storage::masstree::MasstreePage::set_high_fence_unsafe(), foedus::storage::masstree::SplitIntermediate::split_impl_no_error(), foedus::storage::hash::HashStoragePimpl::track_moved_record_search(), foedus::storage::masstree::MasstreeBorderPage::try_expand_record_in_page_physical(), foedus::storage::hash::HashStoragePimpl::upsert_record(), and foedus::storage::masstree::verify_page_basic().
uint8_t foedus::storage::PageHeader::stat_last_updater_node_ |
A loosely maintained statistics for volatile pages.
The NUMA node of the thread that has most recently tried to update this page. This is not atomically/transactionally maintained and should be used only as a stat. Depending on page type, this might not be even maintained (eg implicit in sequential pages).
Definition at line 251 of file page.hpp.
Referenced by foedus::storage::masstree::MasstreeStoragePimpl::delete_general(), foedus::storage::masstree::design_partition_first_parallel_recurse(), foedus::storage::masstree::MasstreeStoragePimpl::increment_general(), foedus::storage::masstree::MasstreeStoragePimpl::insert_general(), foedus::storage::hash::HashStoragePimpl::locate_record(), foedus::storage::operator<<(), foedus::storage::masstree::MasstreeStoragePimpl::overwrite_general(), and foedus::storage::masstree::MasstreeStoragePimpl::upsert_general().
StorageId foedus::storage::PageHeader::storage_id_ |
ID of the storage this page belongs to.
Definition at line 196 of file page.hpp.
Referenced by foedus::storage::sequential::SequentialComposer::compose(), foedus::storage::array::ArrayComposer::construct_root(), foedus::storage::hash::HashComposer::construct_root(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::sequential::SequentialComposer::construct_root(), foedus::storage::hash::ReserveRecords::create_new_tail_page(), foedus::storage::array::ArrayComposeContext::execute(), foedus::storage::hash::HashComposeContext::execute(), foedus::storage::array::ArrayPage::get_storage_id(), foedus::storage::masstree::grow_case_b_common(), foedus::storage::hash::hash_data_volatile_page_init(), foedus::storage::hash::hash_intermediate_volatile_page_init(), foedus::storage::masstree::MasstreeBorderPage::initialize_as_layer_root_physical(), foedus::storage::masstree::SplitBorder::lock_existing_records(), foedus::xct::Xct::on_record_read(), foedus::snapshot::SnapshotWriter::open(), foedus::storage::hash::ComposedBinsMergedStream::open_path(), foedus::storage::operator<<(), foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot(), foedus::storage::masstree::GrowNonFirstLayerRoot::run(), foedus::storage::masstree::SplitBorder::run(), foedus::storage::masstree::ReserveRecords::run(), and foedus::storage::masstree::SplitIntermediate::split_impl_no_error().