libfoedus-core
FOEDUS Core Library
foedus::snapshot::MergeSort::SortEntry Struct Reference

Entries we actually sort. More...

Detailed Description

Entries we actually sort.

  • 0-7 bytes: the key. ArrayOffset, or the most significant 8 bytes of other storages' key.
  • 8-9 bytes: compressed epoch (difference from base_epoch)
  • 10-12 bytes: in-epoch-ordinal
  • 13 byte's 1st bit: Whether the key needs additional comparison if the 8-bytes are the same. This is set to true only in masstree and the key length is not 8 bytes.
  • 13 byte's other bits -15 bytes: Position in MergeSort's buffer.

It's quite important to keep this 16 bytes. But, in some cases, we need more than 16 bytes to compare logs. In that case, we have to addtionally invoke batch_sort_adjust_sort().

Definition at line 116 of file merge_sort.hpp.

#include <merge_sort.hpp>

Public Member Functions

void set (uint64_t key, uint16_t compressed_epoch, uint32_t in_epoch_ordinal, bool needs_additional_check, MergedPosition position) __attribute__((always_inline))
 
uint64_t get_key () const __attribute__((always_inline))
 
bool needs_additional_check () const __attribute__((always_inline))
 
MergedPosition get_position () const __attribute__((always_inline))
 

Public Attributes

__uint128_t data_
 

Member Function Documentation

uint64_t foedus::snapshot::MergeSort::SortEntry::get_key ( ) const
inline

Definition at line 132 of file merge_sort.hpp.

References data_.

Referenced by foedus::storage::array::ArrayComposeContext::execute(), and foedus::storage::hash::HashComposeContext::execute().

132  {
133  return static_cast<uint64_t>(data_ >> 64);
134  }

Here is the caller graph for this function:

MergedPosition foedus::snapshot::MergeSort::SortEntry::get_position ( ) const
inline
bool foedus::snapshot::MergeSort::SortEntry::needs_additional_check ( ) const
inline

Definition at line 135 of file merge_sort.hpp.

References data_.

Referenced by set().

135  {
136  return data_ & (1U << 23);
137  }

Here is the caller graph for this function:

void foedus::snapshot::MergeSort::SortEntry::set ( uint64_t  key,
uint16_t  compressed_epoch,
uint32_t  in_epoch_ordinal,
bool  needs_additional_check,
MergedPosition  position 
)
inline

Definition at line 117 of file merge_sort.hpp.

References ASSERT_ND, data_, foedus::snapshot::MergeSort::kMaxMergedPosition, and needs_additional_check().

Referenced by foedus::snapshot::MergeSort::assert_sorted().

122  {
123  ASSERT_ND(in_epoch_ordinal < (1U << 24));
124  ASSERT_ND(position < kMaxMergedPosition);
125  data_
126  = static_cast<__uint128_t>(key) << 64
127  | static_cast<__uint128_t>(compressed_epoch) << 48
128  | static_cast<__uint128_t>(in_epoch_ordinal) << 24
129  | static_cast<__uint128_t>(needs_additional_check ? 1U << 23 : 0)
130  | static_cast<__uint128_t>(position);
131  }
bool needs_additional_check() const __attribute__((always_inline))
Definition: merge_sort.hpp:135
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

__uint128_t foedus::snapshot::MergeSort::SortEntry::data_

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