libfoedus-core
FOEDUS Core Library
|
Represents one intermediate page in Masstree Storage. More...
Represents one intermediate page in Masstree Storage.
An intermediate page consists of bunch of separator keys and pointers to children nodes, which might be another intermediate pages or border nodes.
Definition at line 262 of file masstree_page_impl.hpp.
#include <masstree_page_impl.hpp>
Classes | |
struct | MiniPage |
Public Member Functions | |
MasstreeIntermediatePage ()=delete | |
MasstreeIntermediatePage (const MasstreeIntermediatePage &other)=delete | |
MasstreeIntermediatePage & | operator= (const MasstreeIntermediatePage &other)=delete |
void | prefetch () const |
prefetch upto separators. More... | |
uint8_t | find_minipage (KeySlice slice) const __attribute__((always_inline)) |
Navigates a searching key-slice to one of the mini pages in this page. More... | |
MiniPage & | get_minipage (uint8_t index) __attribute__((always_inline)) |
const MiniPage & | get_minipage (uint8_t index) const __attribute__((always_inline)) |
KeySlice | get_separator (uint8_t index) const __attribute__((always_inline)) |
void | release_pages_recursive_parallel (Engine *engine) |
This method is used when we release a large number of volatile pages, most likely when we drop a storage. More... | |
void | release_pages_recursive (const memory::GlobalVolatilePageResolver &page_resolver, memory::PageReleaseBatch *batch) |
void | initialize_volatile_page (StorageId storage_id, VolatilePagePointer page_id, uint8_t layer, uint8_t level, KeySlice low_fence, KeySlice high_fence) |
void | initialize_snapshot_page (StorageId storage_id, SnapshotPagePointer page_id, uint8_t layer, uint8_t level, KeySlice low_fence, KeySlice high_fence) |
void | append_pointer_snapshot (KeySlice low_fence, SnapshotPagePointer pointer) |
Appends a new poiner and separator in an existing mini page, used only by snapshot composer. More... | |
void | append_minipage_snapshot (KeySlice low_fence, SnapshotPagePointer pointer) |
Appends a new separator and the initial pointer in new mini page, used only by snapshot composer. More... | |
bool | is_full_snapshot () const |
Whether this page is full of poiters, used only by snapshot composer (or when no race) More... | |
void | extract_separators_snapshot (uint8_t index, uint8_t index_mini, KeySlice *separator_low, KeySlice *separator_high) const |
Retrieves separators defining the index, used only by snapshot composer, thus no race. More... | |
void | extract_separators_volatile (uint8_t index, uint8_t index_mini, KeySlice *separator_low, KeySlice *separator_high) const |
Retrieves separators defining the index, used for volatile page, which requires appropriate locks or retries by the caller. More... | |
void | extract_separators_common (uint8_t index, uint8_t index_mini, KeySlice *separator_low, KeySlice *separator_high) const |
Retrieves separators defining the index, used only by snapshot composer (or when no race) More... | |
void | verify_separators () const |
void | set_separator (uint8_t minipage_index, KeySlice new_separator) |
Place a new separator for a new minipage. More... | |
![]() | |
MasstreePage ()=delete | |
MasstreePage (const MasstreePage &other)=delete | |
MasstreePage & | operator= (const MasstreePage &other)=delete |
PageHeader & | header () |
const PageHeader & | header () const |
VolatilePagePointer | get_volatile_page_id () const |
SnapshotPagePointer | get_snapshot_page_id () const |
bool | is_border () const __attribute__((always_inline)) |
bool | is_empty_range () const __attribute__((always_inline)) |
An empty-range page, either intermediate or border, never has any entries. More... | |
KeySlice | get_low_fence () const __attribute__((always_inline)) |
KeySlice | get_high_fence () const __attribute__((always_inline)) |
bool | is_high_fence_supremum () const __attribute__((always_inline)) |
bool | is_low_fence_infimum () const __attribute__((always_inline)) |
bool | is_layer_root () const __attribute__((always_inline)) |
KeySlice | get_foster_fence () const __attribute__((always_inline)) |
bool | is_foster_minor_null () const __attribute__((always_inline)) |
bool | is_foster_major_null () const __attribute__((always_inline)) |
VolatilePagePointer | get_foster_minor () const __attribute__((always_inline)) |
VolatilePagePointer | get_foster_major () const __attribute__((always_inline)) |
void | set_foster_twin (VolatilePagePointer minor, VolatilePagePointer major) |
void | install_foster_twin (VolatilePagePointer minor, VolatilePagePointer major, KeySlice foster_fence) |
bool | within_fences (KeySlice slice) const __attribute__((always_inline)) |
bool | within_foster_minor (KeySlice slice) const __attribute__((always_inline)) |
bool | within_foster_major (KeySlice slice) const __attribute__((always_inline)) |
bool | has_foster_child () const __attribute__((always_inline)) |
uint8_t | get_layer () const __attribute__((always_inline)) |
Layer-0 stores the first 8 byte slice, Layer-1 next 8 byte... More... | |
uint8_t | get_btree_level () const __attribute__((always_inline)) |
used only in masstree. More... | |
SlotIndex | get_key_count () const __attribute__((always_inline)) |
physical key count (those keys might be deleted) in this page. More... | |
void | set_key_count (SlotIndex count) __attribute__((always_inline)) |
void | increment_key_count () __attribute__((always_inline)) |
void | prefetch_general () const __attribute__((always_inline)) |
prefetch upto keys/separators, whether this page is border or interior. More... | |
const PageVersion & | get_version () const __attribute__((always_inline)) |
PageVersion & | get_version () __attribute__((always_inline)) |
const PageVersion * | get_version_address () const __attribute__((always_inline)) |
PageVersion * | get_version_address () __attribute__((always_inline)) |
xct::McsWwLock * | get_lock_address () __attribute__((always_inline)) |
bool | is_locked () const __attribute__((always_inline)) |
bool | is_moved () const __attribute__((always_inline)) |
bool | is_retired () const __attribute__((always_inline)) |
void | set_moved () __attribute__((always_inline)) |
void | set_retired () __attribute__((always_inline)) |
void | release_pages_recursive_common (const memory::GlobalVolatilePageResolver &page_resolver, memory::PageReleaseBatch *batch) |
void | set_foster_major_offset_unsafe (memory::PagePoolOffset offset) __attribute__((always_inline)) |
As the name suggests, this should be used only by composer. More... | |
void | set_high_fence_unsafe (KeySlice high_fence) __attribute__((always_inline)) |
As the name suggests, this should be used only by composer. More... | |
Friends | |
struct | SplitIntermediate |
std::ostream & | operator<< (std::ostream &o, const MasstreeIntermediatePage &v) |
defined in masstree_page_debug.cpp. More... | |
Additional Inherited Members | |
![]() | |
void | initialize_volatile_common (StorageId storage_id, VolatilePagePointer page_id, PageType page_type, uint8_t layer, uint8_t level, KeySlice low_fence, KeySlice high_fence) |
void | initialize_snapshot_common (StorageId storage_id, SnapshotPagePointer page_id, PageType page_type, uint8_t layer, uint8_t level, KeySlice low_fence, KeySlice high_fence) |
![]() | |
PageHeader | header_ |
KeySlice | low_fence_ |
Inclusive low fence of this page. More... | |
KeySlice | high_fence_ |
Inclusive high fence of this page. More... | |
KeySlice | foster_fence_ |
Inclusive low_fence of foster child. More... | |
VolatilePagePointer | foster_twin_ [2] |
Points to foster children, or tentative child pages. More... | |
|
delete |
|
delete |
|
inline |
Appends a new separator and the initial pointer in new mini page, used only by snapshot composer.
Definition at line 1522 of file masstree_page_impl.hpp.
References ASSERT_ND, foedus::storage::VolatilePagePointer::clear(), foedus::storage::masstree::MasstreePage::get_key_count(), get_minipage(), foedus::storage::masstree::MasstreePage::header_, is_full_snapshot(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::pointers_, foedus::storage::masstree::MasstreePage::set_key_count(), foedus::storage::PageHeader::snapshot_, foedus::storage::DualPagePointer::snapshot_pointer_, and foedus::storage::DualPagePointer::volatile_pointer_.
Referenced by append_pointer_snapshot().
|
inline |
Appends a new poiner and separator in an existing mini page, used only by snapshot composer.
Definition at line 1496 of file masstree_page_impl.hpp.
References append_minipage_snapshot(), ASSERT_ND, foedus::storage::VolatilePagePointer::clear(), foedus::storage::extract_snapshot_id_from_snapshot_pointer(), foedus::storage::masstree::MasstreePage::get_high_fence(), foedus::storage::masstree::MasstreePage::get_key_count(), foedus::storage::masstree::MasstreePage::get_low_fence(), foedus::storage::masstree::MasstreePage::header_, is_full_snapshot(), foedus::storage::masstree::MasstreePage::is_high_fence_supremum(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::pointers_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::separators_, foedus::storage::PageHeader::snapshot_, foedus::storage::DualPagePointer::snapshot_pointer_, and foedus::storage::DualPagePointer::volatile_pointer_.
|
inline |
Retrieves separators defining the index, used only by snapshot composer (or when no race)
Definition at line 1539 of file masstree_page_impl.hpp.
References ASSERT_ND, foedus::storage::masstree::MasstreePage::get_high_fence(), foedus::storage::masstree::MasstreePage::get_key_count(), foedus::storage::masstree::MasstreePage::get_low_fence(), get_minipage(), get_separator(), foedus::storage::masstree::MasstreePage::is_border(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, and foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::separators_.
Referenced by extract_separators_snapshot(), and extract_separators_volatile().
|
inline |
Retrieves separators defining the index, used only by snapshot composer, thus no race.
Definition at line 367 of file masstree_page_impl.hpp.
References ASSERT_ND, extract_separators_common(), foedus::storage::masstree::MasstreePage::header_, and foedus::storage::PageHeader::snapshot_.
Referenced by foedus::storage::masstree::MasstreeComposer::construct_root().
|
inline |
Retrieves separators defining the index, used for volatile page, which requires appropriate locks or retries by the caller.
The caller must be careful!
Definition at line 379 of file masstree_page_impl.hpp.
References ASSERT_ND, extract_separators_common(), foedus::storage::masstree::MasstreePage::header_, and foedus::storage::PageHeader::snapshot_.
|
inline |
Navigates a searching key-slice to one of the mini pages in this page.
Definition at line 312 of file masstree_page_impl.hpp.
References ASSERT_ND, and foedus::storage::masstree::MasstreePage::get_key_count().
Referenced by foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root_double(), foedus::storage::masstree::MasstreeStoragePimpl::find_border_physical(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_next_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::storage::masstree::Adopt::run(), and foedus::storage::masstree::MasstreeBorderPage::track_moved_record_next_layer().
|
inline |
Definition at line 322 of file masstree_page_impl.hpp.
Referenced by foedus::storage::masstree::Adopt::adopt_case_a(), foedus::storage::masstree::Adopt::adopt_case_b(), append_minipage_snapshot(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::masstree::count_children_approximate(), foedus::storage::masstree::MasstreeComposer::drop_volatiles(), extract_separators_common(), foedus::storage::masstree::MasstreeStoragePimpl::fatify_first_root_double(), foedus::storage::masstree::MasstreeStoragePimpl::find_border_physical(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::get_high_key(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::get_low_key(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::get_pointer(), foedus::storage::masstree::grow_case_b_common(), initialize_snapshot_page(), initialize_volatile_page(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::is_valid(), foedus::storage::masstree::MasstreeStoragePimpl::load_empty(), foedus::storage::masstree::SplitIntermediate::migrate_pointers(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::next(), foedus::storage::masstree::operator<<(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::storage::masstree::MasstreeStoragePimpl::prefetch_pages_normalized_recurse(), release_pages_recursive(), release_pages_recursive_parallel(), foedus::storage::masstree::Adopt::run(), foedus::storage::masstree::MasstreeBorderPage::track_moved_record_next_layer(), verify_separators(), and foedus::storage::masstree::MasstreeStoragePimpl::verify_single_thread_intermediate().
|
inline |
Definition at line 323 of file masstree_page_impl.hpp.
|
inline |
Definition at line 324 of file masstree_page_impl.hpp.
Referenced by extract_separators_common(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::get_high_key(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::get_low_key(), foedus::storage::masstree::operator<<(), foedus::storage::masstree::MasstreeStoragePimpl::prefetch_pages_normalized_recurse(), and foedus::storage::masstree::MasstreeStoragePimpl::verify_single_thread_intermediate().
void foedus::storage::masstree::MasstreeIntermediatePage::initialize_snapshot_page | ( | StorageId | storage_id, |
SnapshotPagePointer | page_id, | ||
uint8_t | layer, | ||
uint8_t | level, | ||
KeySlice | low_fence, | ||
KeySlice | high_fence | ||
) |
Definition at line 108 of file masstree_page_impl.cpp.
References get_minipage(), foedus::storage::masstree::MasstreePage::initialize_snapshot_common(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::kMasstreeIntermediatePageType, and foedus::storage::masstree::kMaxIntermediateSeparators.
void foedus::storage::masstree::MasstreeIntermediatePage::initialize_volatile_page | ( | StorageId | storage_id, |
VolatilePagePointer | page_id, | ||
uint8_t | layer, | ||
uint8_t | level, | ||
KeySlice | low_fence, | ||
KeySlice | high_fence | ||
) |
Definition at line 88 of file masstree_page_impl.cpp.
References get_minipage(), foedus::storage::masstree::MasstreePage::initialize_volatile_common(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::kMasstreeIntermediatePageType, and foedus::storage::masstree::kMaxIntermediateSeparators.
Referenced by foedus::storage::masstree::grow_case_b_common(), foedus::storage::masstree::MasstreeStoragePimpl::load_empty(), and foedus::storage::masstree::SplitIntermediate::split_impl_no_error().
|
inline |
Whether this page is full of poiters, used only by snapshot composer (or when no race)
Definition at line 1487 of file masstree_page_impl.hpp.
References ASSERT_ND, foedus::storage::masstree::MasstreePage::get_key_count(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, and foedus::storage::masstree::kMaxIntermediateMiniSeparators.
Referenced by append_minipage_snapshot(), and append_pointer_snapshot().
|
delete |
|
inline |
prefetch upto separators.
Definition at line 305 of file masstree_page_impl.hpp.
References foedus::assorted::prefetch_cachelines().
void foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive | ( | const memory::GlobalVolatilePageResolver & | page_resolver, |
memory::PageReleaseBatch * | batch | ||
) |
Definition at line 226 of file masstree_page_impl.cpp.
References ASSERT_ND, foedus::storage::masstree::MasstreePage::foster_twin_, foedus::storage::masstree::MasstreePage::get_key_count(), get_minipage(), foedus::storage::masstree::MasstreePage::header(), foedus::storage::masstree::MasstreePage::header_, foedus::storage::masstree::MasstreePage::is_empty_range(), foedus::storage::PageVersion::is_moved(), foedus::storage::masstree::MasstreePage::is_moved(), foedus::storage::VolatilePagePointer::is_null(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::masstree::kMaxIntermediateMiniSeparators, foedus::storage::masstree::kMaxIntermediateSeparators, foedus::storage::PageHeader::page_id_, foedus::storage::PageHeader::page_version_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::pointers_, foedus::memory::PageReleaseBatch::release(), release_pages_recursive(), foedus::storage::masstree::MasstreePage::release_pages_recursive_common(), foedus::memory::GlobalVolatilePageResolver::resolve_offset(), foedus::storage::DualPagePointer::volatile_pointer_, and foedus::storage::VolatilePagePointer::word.
Referenced by release_pages_recursive(), and foedus::storage::masstree::MasstreePage::release_pages_recursive_common().
void foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive_parallel | ( | Engine * | engine | ) |
This method is used when we release a large number of volatile pages, most likely when we drop a storage.
In that case, we don't need to stick to the current thread. rather, this thread spawns lots of threads to parallelize the work.
Definition at line 188 of file masstree_page_impl.cpp.
References ASSERT_ND, foedus::storage::masstree::MasstreePage::foster_twin_, foedus::storage::masstree::MasstreePage::get_key_count(), foedus::Engine::get_memory_manager(), get_minipage(), foedus::memory::EngineMemory::get_node_memory(), foedus::storage::VolatilePagePointer::get_numa_node(), foedus::storage::VolatilePagePointer::get_offset(), foedus::storage::masstree::MasstreePage::header(), foedus::storage::masstree::MasstreePage::header_, foedus::storage::PageVersion::is_moved(), foedus::storage::VolatilePagePointer::is_null(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::masstree::kMaxIntermediateMiniSeparators, foedus::storage::masstree::kMaxIntermediateSeparators, foedus::storage::PageHeader::page_id_, foedus::storage::PageHeader::page_version_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::pointers_, foedus::memory::PagePool::release_one(), foedus::storage::masstree::release_parallel(), foedus::storage::DualPagePointer::volatile_pointer_, and foedus::storage::VolatilePagePointer::word.
Referenced by foedus::storage::masstree::MasstreeStoragePimpl::drop().
|
inline |
Place a new separator for a new minipage.
Definition at line 397 of file masstree_page_impl.hpp.
Referenced by foedus::storage::masstree::Adopt::adopt_case_b().
void foedus::storage::masstree::MasstreeIntermediatePage::verify_separators | ( | ) | const |
Definition at line 475 of file masstree_page_impl.cpp.
References ASSERT_ND, foedus::storage::masstree::MasstreePage::get_key_count(), get_minipage(), foedus::storage::masstree::MasstreePage::high_fence_, foedus::storage::DualPagePointer::is_both_null(), foedus::storage::masstree::MasstreePage::is_empty_range(), foedus::storage::masstree::MasstreePage::is_moved(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::masstree::MasstreePage::low_fence_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::pointers_, and foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::separators_.
Referenced by foedus::storage::masstree::SplitIntermediate::migrate_pointers(), foedus::storage::masstree::Adopt::run(), and foedus::storage::masstree::SplitIntermediate::split_impl_no_error().
|
friend |
defined in masstree_page_debug.cpp.
Definition at line 54 of file masstree_page_debug.cpp.
|
friend |
Definition at line 264 of file masstree_page_impl.hpp.