libfoedus-core
FOEDUS Core Library
|
A system transaction to adopt foster twins into an intermediate page. More...
A system transaction to adopt foster twins into an intermediate page.
This system transaction follows page-splits, which leave foster twins. The sysxct replaces an existing separator and pointer to the old-page with two new separators and pointers to the grandchildren. The parent-page thus need a room for one more separator/pointer, which might require page split.
There are following cases:
The caller of this sysxct reads and follows pointers without page-latch or fences because reads/traversals must be lock-free and as efficient as possible. This sysxct must make sure we are replacing the right pointer with adopted pointer(s).
This does nothing and returns kErrorCodeOk in the following cases:
Locks taken in this sysxct:
So far this sysxct adopts only one child at a time. TASK(Hideaki): Probably it helps by delaying and batching several adoptions.
Definition at line 67 of file masstree_adopt_impl.hpp.
#include <masstree_adopt_impl.hpp>
Public Member Functions | |
Adopt (thread::Thread *context, MasstreeIntermediatePage *parent, MasstreePage *old) | |
virtual ErrorCode | run (xct::SysxctWorkspace *sysxct_workspace) override |
Execute the system transaction. More... | |
ErrorCode | adopt_case_a (uint16_t minipage_index, uint16_t pointer_index) |
ErrorCode | adopt_case_b (uint16_t minipage_index, uint16_t pointer_index) |
Public Attributes | |
thread::Thread *const | context_ |
Thread context. More... | |
MasstreeIntermediatePage *const | parent_ |
The parent page that currently points to the old page. More... | |
MasstreePage *const | old_ |
The old page that was split, whose foster-twins are being adopted. More... | |
|
inline |
Definition at line 78 of file masstree_adopt_impl.hpp.
ErrorCode foedus::storage::masstree::Adopt::adopt_case_a | ( | uint16_t | minipage_index, |
uint16_t | pointer_index | ||
) |
Definition at line 73 of file masstree_adopt_impl.cpp.
References ASSERT_ND, foedus::thread::Thread::collect_retired_volatile_page(), context_, 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::MasstreeIntermediatePage::get_minipage(), foedus::storage::masstree::MasstreePage::get_version_address(), foedus::storage::masstree::MasstreePage::get_volatile_page_id(), foedus::storage::masstree::MasstreePage::header(), foedus::storage::masstree::MasstreePage::is_empty_range(), foedus::storage::masstree::MasstreePage::is_locked(), foedus::kErrorCodeOk, foedus::storage::PageVersionStatus::kRetiredBit, old_, parent_, foedus::thread::Thread::resolve_cast(), foedus::storage::masstree::MasstreePage::set_retired(), foedus::storage::PageHeader::snapshot_, foedus::storage::PageVersionStatus::status_, and foedus::storage::PageVersion::status_.
Referenced by run().
ErrorCode foedus::storage::masstree::Adopt::adopt_case_b | ( | uint16_t | minipage_index, |
uint16_t | pointer_index | ||
) |
Definition at line 118 of file masstree_adopt_impl.cpp.
References ASSERT_ND, CHECK_ERROR_CODE, foedus::thread::Thread::collect_retired_volatile_page(), context_, 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_key_count(), foedus::storage::masstree::MasstreeIntermediatePage::get_minipage(), foedus::storage::masstree::MasstreePage::get_volatile_page_id(), foedus::thread::GrabFreeVolatilePagesScope::grab(), foedus::storage::masstree::MasstreePage::increment_key_count(), foedus::storage::masstree::MasstreePage::is_retired(), foedus::kErrorCodeOk, foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::key_count_, foedus::storage::masstree::kMaxIntermediateMiniSeparators, foedus::storage::masstree::kMaxIntermediateSeparators, foedus::assorted::memory_fence_release(), old_, parent_, foedus::storage::masstree::MasstreePage::set_retired(), foedus::storage::masstree::MasstreeIntermediatePage::set_separator(), foedus::storage::DualPagePointer::snapshot_pointer_, and foedus::storage::DualPagePointer::volatile_pointer_.
Referenced by run().
|
overridevirtual |
Execute the system transaction.
You should override this method.
Implements foedus::xct::SysxctFunctor.
Definition at line 32 of file masstree_adopt_impl.cpp.
References adopt_case_a(), adopt_case_b(), ASSERT_ND, CHECK_ERROR_CODE, context_, foedus::storage::masstree::MasstreeIntermediatePage::find_minipage(), foedus::storage::masstree::MasstreeIntermediatePage::MiniPage::find_pointer(), foedus::storage::masstree::MasstreePage::get_foster_fence(), foedus::storage::masstree::MasstreePage::get_high_fence(), foedus::storage::masstree::MasstreePage::get_low_fence(), foedus::storage::masstree::MasstreeIntermediatePage::get_minipage(), foedus::storage::masstree::MasstreePage::get_volatile_page_id(), foedus::storage::masstree::MasstreePage::header(), foedus::storage::masstree::MasstreePage::is_moved(), foedus::storage::masstree::MasstreePage::is_retired(), foedus::kErrorCodeOk, foedus::storage::masstree::kMaxIntermediateMiniSeparators, old_, parent_, foedus::storage::PageHeader::snapshot_, foedus::thread::Thread::sysxct_batch_page_locks(), and foedus::storage::masstree::MasstreeIntermediatePage::verify_separators().
thread::Thread* const foedus::storage::masstree::Adopt::context_ |
Thread context.
Definition at line 69 of file masstree_adopt_impl.hpp.
Referenced by adopt_case_a(), adopt_case_b(), and run().
MasstreePage* const foedus::storage::masstree::Adopt::old_ |
The old page that was split, whose foster-twins are being adopted.
Definition at line 76 of file masstree_adopt_impl.hpp.
Referenced by adopt_case_a(), adopt_case_b(), and run().
MasstreeIntermediatePage* const foedus::storage::masstree::Adopt::parent_ |
The parent page that currently points to the old page.
Definition at line 71 of file masstree_adopt_impl.hpp.
Referenced by adopt_case_a(), adopt_case_b(), and run().