libfoedus-core
FOEDUS Core Library
foedus::storage::DualPagePointer Struct Reference

Represents a pointer to another page (usually a child page). More...

Detailed Description

Represents a pointer to another page (usually a child page).

Duality of Page Pointer

All page pointers in our storages have duality; a pointer to volatile page and a pointer to snapshot page. The volatile pointer always points to the latest in-memory image of the page. The snapshot page points to a potentially-stale snapshot image of the page which is guaranteed to be read only in all regards, even in its descendent pages.

None, either, or both of the two pointers might null.

  • Both are null; the page doesn't exist yet.
  • Only snapshot pointer is null; it's a newly created page. no snapshot taken yet.
  • Only volatile pointer is null; the snapshot page is the latest and we don't have a modification on the page since then (or not published by RCU-ing thread yet).

Atomic Compare-And-Exchange

Dual page pointer is, unfortunately, 128 bits. When we have to atomically swap either or both 64-bit parts depending on the current value of the entire 128 bit, we need a double-word CAS. The current implementation uses a processor-specific assembly, assuming recent processors. This might restrict our portability, so let's minimize the use of this operation and revisit the design. Do we really need atomic swap for this object?

POD

This is a POD struct. Default destructor/copy-constructor/assignment operator work fine.

Definition at line 271 of file storage_id.hpp.

#include <storage_id.hpp>

Collaboration diagram for foedus::storage::DualPagePointer:

Public Member Functions

 DualPagePointer ()
 
bool operator== (const DualPagePointer &other) const
 
bool operator!= (const DualPagePointer &other) const
 
bool atomic_compare_exchange_strong (const DualPagePointer &expected, const DualPagePointer &desired)
 128-bit atomic CAS (strong version) for the dual pointer. More...
 
bool atomic_compare_exchange_weak (const DualPagePointer &expected, const DualPagePointer &desired)
 128-bit atomic CAS (weak version) for the dual pointer. More...
 
bool is_both_null () const
 

Public Attributes

SnapshotPagePointer snapshot_pointer_
 
VolatilePagePointer volatile_pointer_
 

Friends

std::ostream & operator<< (std::ostream &o, const DualPagePointer &v)
 

Constructor & Destructor Documentation

foedus::storage::DualPagePointer::DualPagePointer ( )
inline

Definition at line 272 of file storage_id.hpp.

References volatile_pointer_, and foedus::storage::VolatilePagePointer::word.

272  : snapshot_pointer_(0) {
274  }
VolatilePagePointer volatile_pointer_
Definition: storage_id.hpp:308
SnapshotPagePointer snapshot_pointer_
Definition: storage_id.hpp:307

Member Function Documentation

bool foedus::storage::DualPagePointer::atomic_compare_exchange_strong ( const DualPagePointer expected,
const DualPagePointer desired 
)
inline

128-bit atomic CAS (strong version) for the dual pointer.

Definition at line 287 of file storage_id.hpp.

References foedus::assorted::raw_atomic_compare_exchange_strong_uint128().

288  {
290  reinterpret_cast<uint64_t*>(this),
291  reinterpret_cast<const uint64_t*>(&expected),
292  reinterpret_cast<const uint64_t*>(&desired));
293  }
bool raw_atomic_compare_exchange_strong_uint128(uint64_t *ptr, const uint64_t *old_value, const uint64_t *new_value)
Atomic 128-bit CAS, which is not in the standard yet.
Definition: raw_atomics.cpp:25

Here is the call graph for this function:

bool foedus::storage::DualPagePointer::atomic_compare_exchange_weak ( const DualPagePointer expected,
const DualPagePointer desired 
)
inline

128-bit atomic CAS (weak version) for the dual pointer.

Definition at line 295 of file storage_id.hpp.

References foedus::assorted::raw_atomic_compare_exchange_weak_uint128().

296  {
298  reinterpret_cast<uint64_t*>(this),
299  reinterpret_cast<const uint64_t*>(&expected),
300  reinterpret_cast<const uint64_t*>(&desired));
301  }
bool raw_atomic_compare_exchange_weak_uint128(uint64_t *ptr, const uint64_t *old_value, const uint64_t *new_value)
Weak version of raw_atomic_compare_exchange_strong_uint128().

Here is the call graph for this function:

bool foedus::storage::DualPagePointer::operator!= ( const DualPagePointer other) const
inline

Definition at line 280 of file storage_id.hpp.

References operator==().

280  {
281  return !operator==(other);
282  }
bool operator==(const DualPagePointer &other) const
Definition: storage_id.hpp:276

Here is the call graph for this function:

bool foedus::storage::DualPagePointer::operator== ( const DualPagePointer other) const
inline

Definition at line 276 of file storage_id.hpp.

References snapshot_pointer_, volatile_pointer_, and foedus::storage::VolatilePagePointer::word.

Referenced by operator!=().

276  {
277  return snapshot_pointer_ == other.snapshot_pointer_
278  && volatile_pointer_.word == other.volatile_pointer_.word;
279  }
VolatilePagePointer volatile_pointer_
Definition: storage_id.hpp:308
SnapshotPagePointer snapshot_pointer_
Definition: storage_id.hpp:307

Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const DualPagePointer v 
)
friend

Definition at line 56 of file storage_id.cpp.

56  {
57  o << "<DualPagePointer>";
58  describe_snapshot_pointer(&o, v.snapshot_pointer_);
59  describe_volatile_pointer(&o, v.volatile_pointer_);
60  o << "</DualPagePointer>";
61  return o;
62 }
void describe_volatile_pointer(std::ostream *o, VolatilePagePointer pointer)
Definition: storage_id.cpp:44
void describe_snapshot_pointer(std::ostream *o, SnapshotPagePointer pointer)
Definition: storage_id.cpp:27

Member Data Documentation

SnapshotPagePointer foedus::storage::DualPagePointer::snapshot_pointer_

Definition at line 307 of file storage_id.hpp.

Referenced by foedus::storage::masstree::Adopt::adopt_case_b(), foedus::storage::masstree::MasstreeIntermediatePage::append_minipage_snapshot(), foedus::storage::masstree::MasstreeBorderPage::append_next_layer_snapshot(), foedus::storage::masstree::MasstreeIntermediatePage::append_pointer_snapshot(), foedus::storage::sequential::SequentialComposer::compose(), foedus::storage::array::ArrayComposer::construct_root(), foedus::storage::masstree::MasstreeComposer::construct_root(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread(), foedus::storage::masstree::MasstreeStoragePimpl::debugout_single_thread(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread_data(), foedus::storage::masstree::MasstreeStoragePimpl::debugout_single_thread_follow(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread_intermediate(), foedus::storage::masstree::SplitIntermediate::decide_strategy(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::masstree::MasstreePartitioner::design_partition(), foedus::storage::array::ArrayComposer::drop_volatiles(), foedus::storage::hash::HashComposer::drop_volatiles(), 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::hash::ComposedBinsMergedStream::init(), foedus::storage::StorageControlBlock::initialize(), foedus::storage::masstree::MasstreeBorderPage::initialize_as_layer_root_physical(), foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot(), foedus::storage::sequential::SequentialPage::initialize_snapshot_page(), foedus::storage::sequential::SequentialPage::initialize_volatile_page(), foedus::thread::ThreadPimpl::install_a_volatile_page(), is_both_null(), foedus::storage::array::ArrayStoragePimpl::load(), foedus::storage::array::ArrayStoragePimpl::load_empty(), foedus::storage::masstree::MasstreeStoragePimpl::load_empty(), foedus::storage::hash::HashStoragePimpl::locate_record_in_snapshot(), foedus::storage::hash::ComposedBinsMergedStream::open_path(), foedus::storage::operator<<(), operator==(), foedus::storage::masstree::MasstreeStoragePimpl::prefetch_pages_follow(), foedus::storage::array::ArrayStoragePimpl::prefetch_pages_recurse(), foedus::storage::hash::ComposedBinsMergedStream::process_a_bin(), foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot(), foedus::storage::masstree::MasstreeBorderPage::replace_next_layer_snapshot(), foedus::storage::masstree::ReserveRecords::run(), and foedus::storage::hash::HashStoragePimpl::track_moved_record_search().

VolatilePagePointer foedus::storage::DualPagePointer::volatile_pointer_

Definition at line 308 of file storage_id.hpp.

Referenced by foedus::storage::masstree::Adopt::adopt_case_b(), foedus::storage::masstree::MasstreeIntermediatePage::append_minipage_snapshot(), foedus::storage::masstree::MasstreeBorderPage::append_next_layer_snapshot(), foedus::storage::masstree::MasstreeIntermediatePage::append_pointer_snapshot(), foedus::storage::sequential::SequentialStoragePimpl::append_record(), foedus::storage::hash::ReserveRecords::create_new_record_in_tail_page(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread(), foedus::storage::masstree::MasstreeStoragePimpl::debugout_single_thread(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread_data(), foedus::storage::masstree::MasstreeStoragePimpl::debugout_single_thread_follow(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread_intermediate(), foedus::storage::masstree::SplitIntermediate::decide_strategy(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::masstree::MasstreePartitioner::design_partition(), foedus::storage::masstree::design_partition_first_parallel_recurse(), foedus::storage::hash::HashPartitioner::design_partition_task(), foedus::storage::array::ArrayComposer::drop_root_volatile(), foedus::storage::hash::HashComposer::drop_root_volatile(), foedus::storage::masstree::MasstreeComposer::drop_root_volatile(), foedus::storage::array::ArrayComposer::drop_volatiles(), foedus::storage::hash::HashComposer::drop_volatiles(), foedus::storage::masstree::MasstreeComposer::drop_volatiles(), foedus::storage::sequential::SequentialComposer::drop_volatiles(), DualPagePointer(), foedus::storage::hash::ReserveRecords::find_and_lock_spacious_tail(), foedus::storage::hash::ReserveRecords::find_or_create_or_expand(), 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::masstree::grow_case_a_common(), foedus::storage::masstree::grow_case_b_common(), foedus::storage::array::ArrayStoragePimpl::hcc_reset_all_temperature_stat(), foedus::storage::hash::HashStoragePimpl::hcc_reset_all_temperature_stat(), foedus::storage::masstree::MasstreeStoragePimpl::hcc_reset_all_temperature_stat(), foedus::storage::array::ArrayStoragePimpl::hcc_reset_all_temperature_stat_intermediate(), foedus::storage::hash::HashStoragePimpl::hcc_reset_all_temperature_stat_intermediate(), foedus::storage::masstree::MasstreeStoragePimpl::hcc_reset_all_temperature_stat_recurse(), foedus::storage::hash::ComposedBinsMergedStream::init(), foedus::storage::StorageControlBlock::initialize(), foedus::storage::masstree::MasstreeBorderPage::initialize_as_layer_root_physical(), foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot(), foedus::storage::sequential::SequentialPage::initialize_snapshot_page(), foedus::storage::sequential::SequentialPage::initialize_volatile_page(), is_both_null(), foedus::storage::array::ArrayStoragePimpl::load(), foedus::storage::array::ArrayStoragePimpl::load_empty(), foedus::storage::masstree::MasstreeStoragePimpl::load_empty(), foedus::storage::hash::HashStoragePimpl::locate_bin(), foedus::storage::hash::HashStoragePimpl::locate_record(), foedus::storage::hash::HashStoragePimpl::locate_record_in_snapshot(), foedus::storage::operator<<(), operator==(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_next_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::thread::ThreadPimpl::place_a_new_volatile_page(), foedus::storage::masstree::MasstreeStoragePimpl::prefetch_pages_follow(), foedus::storage::array::ArrayStoragePimpl::prefetch_pages_recurse(), foedus::storage::hash::ComposedBinsMergedStream::process_a_bin(), foedus::storage::StorageManagerPimpl::reinitialize_for_recovered_snapshot(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive(), foedus::storage::hash::HashDataPage::release_pages_recursive(), foedus::storage::array::ArrayStoragePimpl::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::masstree::MasstreeBorderPage::replace_next_layer_snapshot(), foedus::storage::masstree::GrowFirstLayerRoot::run(), foedus::storage::masstree::GrowNonFirstLayerRoot::run(), foedus::storage::masstree::ReserveRecords::run(), foedus::storage::hash::ReserveRecords::search_within_page(), foedus::storage::masstree::MasstreeBorderPage::track_moved_record_next_layer(), foedus::storage::hash::HashStoragePimpl::track_moved_record_search(), foedus::storage::array::ArrayStoragePimpl::verify_single_thread(), and foedus::storage::hash::HashStoragePimpl::verify_single_thread_intermediate().


The documentation for this struct was generated from the following file: