libfoedus-core
FOEDUS Core Library
|
A system transaction to split an intermediate page in Master-Tree. More...
A system transaction to split an intermediate page in Master-Tree.
Same as border page split.
This does nothing and returns kErrorCodeOk in the following cases:
Locks taken in this sysxct (in order of taking):
Obviously no chance of deadlocks or even any conditional locks after releasing enclosing user transaction's locks. max_retries=2 should be enough in run_nested_sysxct().
Definition at line 158 of file masstree_split_impl.hpp.
#include <masstree_split_impl.hpp>
Classes | |
struct | SplitStrategy |
Constructed by hierarchically reading all separators and pointers in old page. More... | |
Public Member Functions | |
SplitIntermediate (thread::Thread *context, MasstreeIntermediatePage *target, MasstreePage *piggyback_adopt_child=nullptr) | |
virtual ErrorCode | run (xct::SysxctWorkspace *sysxct_workspace) override |
Interior node's Split. More... | |
void | split_impl_no_error (thread::GrabFreeVolatilePagesScope *free_pages) |
The core implementation after locking relevant pages and acquiring free page resource. More... | |
void | decide_strategy (SplitStrategy *out) const |
Subroutine to decide how we will split this page. More... | |
void | migrate_pointers (const SplitStrategy &strategy, uint16_t from, uint16_t to, KeySlice expected_last_separator, MasstreeIntermediatePage *dest) const |
Subroutine to construct a new page. More... | |
Public Attributes | |
thread::Thread *const | context_ |
Thread context. More... | |
MasstreeIntermediatePage *const | target_ |
The page to split. More... | |
MasstreePage *const | piggyback_adopt_child_ |
An optimization for the common case: splitting the parent page to adopt foster twins of a child page. More... | |
|
inline |
Definition at line 179 of file masstree_split_impl.hpp.
void foedus::storage::masstree::SplitIntermediate::decide_strategy | ( | SplitIntermediate::SplitStrategy * | out | ) | const |
Subroutine to decide how we will split this page.
Definition at line 552 of file masstree_split_impl.cpp.
References ASSERT_ND, foedus::storage::masstree::SplitIntermediate::SplitStrategy::compact_adopt_, foedus::storage::masstree::MasstreePage::get_foster_fence(), foedus::storage::masstree::MasstreePage::get_foster_major(), foedus::storage::masstree::MasstreePage::get_foster_minor(), foedus::storage::masstree::MasstreePage::get_high_fence(), foedus::storage::masstree::MasstreePage::get_low_fence(), foedus::storage::masstree::MasstreePage::header(), foedus::storage::VolatilePagePointer::is_equivalent(), foedus::storage::masstree::MasstreePage::is_locked(), foedus::storage::masstree::MasstreePage::is_moved(), foedus::storage::masstree::MasstreeIntermediatePointerIterator::is_valid(), foedus::storage::masstree::kMaxIntermediatePointers, foedus::storage::masstree::SplitIntermediate::SplitStrategy::mid_index_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::mid_separator_, foedus::storage::PageHeader::page_id_, piggyback_adopt_child_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::pointers_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::separators_, foedus::storage::DualPagePointer::snapshot_pointer_, target_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::total_separator_count_, and foedus::storage::DualPagePointer::volatile_pointer_.
Referenced by split_impl_no_error().
void foedus::storage::masstree::SplitIntermediate::migrate_pointers | ( | const SplitStrategy & | strategy, |
uint16_t | from, | ||
uint16_t | to, | ||
KeySlice | expected_last_separator, | ||
MasstreeIntermediatePage * | dest | ||
) | const |
Subroutine to construct a new page.
Definition at line 624 of file masstree_split_impl.cpp.
References ASSERT_ND, foedus::storage::masstree::MasstreePage::get_key_count(), foedus::storage::masstree::MasstreeIntermediatePage::get_minipage(), foedus::storage::masstree::MasstreePage::header_, foedus::storage::DualPagePointer::is_both_null(), foedus::storage::masstree::kMaxIntermediateMiniSeparators, foedus::storage::masstree::kMaxIntermediateSeparators, foedus::assorted::memory_fence_release(), foedus::storage::masstree::SplitIntermediate::SplitStrategy::pointers_, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::pointers_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::separators_, foedus::storage::PageHeader::set_key_count(), and foedus::storage::masstree::MasstreeIntermediatePage::verify_separators().
Referenced by split_impl_no_error().
|
overridevirtual |
Interior node's Split.
Implements foedus::xct::SysxctFunctor.
Definition at line 443 of file masstree_split_impl.cpp.
References CHECK_ERROR_CODE, context_, foedus::thread::GrabFreeVolatilePagesScope::grab(), foedus::storage::masstree::MasstreePage::has_foster_child(), foedus::storage::masstree::MasstreePage::is_retired(), foedus::kErrorCodeOk, piggyback_adopt_child_, split_impl_no_error(), foedus::thread::Thread::sysxct_batch_page_locks(), foedus::thread::Thread::sysxct_page_lock(), and target_.
void foedus::storage::masstree::SplitIntermediate::split_impl_no_error | ( | thread::GrabFreeVolatilePagesScope * | free_pages | ) |
The core implementation after locking relevant pages and acquiring free page resource.
This method never fails because all lock/resource are already taken.
Definition at line 476 of file masstree_split_impl.cpp.
References ASSERT_ND, foedus::thread::Thread::collect_retired_volatile_page(), foedus::storage::masstree::SplitIntermediate::SplitStrategy::compact_adopt_, context_, decide_strategy(), foedus::thread::GrabFreeVolatilePagesScope::dispatch(), foedus::thread::GrabFreeVolatilePagesScope::get(), foedus::storage::masstree::MasstreePage::get_btree_level(), foedus::storage::masstree::MasstreePage::get_key_count(), foedus::storage::masstree::MasstreePage::get_layer(), foedus::thread::Thread::get_local_volatile_page_resolver(), foedus::thread::Thread::get_numa_node(), foedus::storage::masstree::MasstreePage::get_volatile_page_id(), foedus::storage::masstree::MasstreePage::header(), foedus::storage::masstree::MasstreePage::high_fence_, foedus::storage::masstree::MasstreeIntermediatePage::initialize_volatile_page(), foedus::storage::masstree::MasstreePage::install_foster_twin(), foedus::storage::masstree::MasstreePage::is_empty_range(), foedus::storage::masstree::MasstreePage::low_fence_, foedus::assorted::memory_fence_release(), foedus::storage::masstree::SplitIntermediate::SplitStrategy::mid_index_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::mid_separator_, migrate_pointers(), piggyback_adopt_child_, foedus::storage::VolatilePagePointer::set(), foedus::storage::masstree::MasstreePage::set_key_count(), foedus::storage::masstree::MasstreePage::set_moved(), foedus::storage::masstree::MasstreePage::set_retired(), foedus::storage::PageHeader::snapshot_, foedus::storage::PageHeader::storage_id_, target_, foedus::storage::masstree::SplitIntermediate::SplitStrategy::total_separator_count_, and foedus::storage::masstree::MasstreeIntermediatePage::verify_separators().
Referenced by run().
thread::Thread* const foedus::storage::masstree::SplitIntermediate::context_ |
Thread context.
Definition at line 160 of file masstree_split_impl.hpp.
Referenced by run(), and split_impl_no_error().
MasstreePage* const foedus::storage::masstree::SplitIntermediate::piggyback_adopt_child_ |
An optimization for the common case: splitting the parent page to adopt foster twins of a child page.
The child page whose foster-twins will be adopted in the course of this split. Without this optimization, we need two Sysxct invocation, split and adopt. This also gives a hint whether it might be no-record-split (NRS). null if no such piggy-back adoption (in that case ignores the possibility of NRS).
Definition at line 177 of file masstree_split_impl.hpp.
Referenced by decide_strategy(), run(), and split_impl_no_error().
MasstreeIntermediatePage* const foedus::storage::masstree::SplitIntermediate::target_ |
The page to split.
Definition at line 165 of file masstree_split_impl.hpp.
Referenced by decide_strategy(), run(), and split_impl_no_error().