libfoedus-core
FOEDUS Core Library
foedus::snapshot::MergeSort::InputStatus Struct Referencefinal

Current status of each input. More...

Detailed Description

Current status of each input.

"Current" means the first log that is not yet processed. "Chunk" means the last log in the current chunk to be batch-processed. "Previous chunk" is the previous chunk of this input in the same batch, thus all logs in the previous chunk are guaranteed to be smaller than the batch-threshold. "End" means the end of input.

Definition at line 167 of file merge_sort.hpp.

#include <merge_sort.hpp>

Public Member Functions

void assert_consistent () const __attribute__((always_inline))
 
const log::RecordLogTypeget_cur_log () const __attribute__((always_inline))
 
const log::RecordLogTypeget_chunk_log () const __attribute__((always_inline))
 
const log::RecordLogTypefrom_byte_pos (uint64_t pos) const __attribute__((always_inline))
 
const log::RecordLogTypefrom_compact_pos (BufferPosition pos) const __attribute__((always_inline))
 
uint64_t to_absolute_pos (uint64_t relative_pos) const __attribute__((always_inline))
 
bool is_last_window () const __attribute__((always_inline))
 
bool is_ended () const __attribute__((always_inline))
 
bool is_last_chunk_in_window () const __attribute__((always_inline))
 
bool is_last_chunk_overall () const __attribute__((always_inline))
 

Public Attributes

const char * window_
 
uint64_t cur_relative_pos_
 
uint64_t chunk_relative_pos_
 
char padding_ [6]
 
uint64_t previous_chunk_relative_pos_
 
uint64_t window_offset_
 relative pos counts from this offset More...
 
uint64_t window_size_
 
uint64_t end_absolute_pos_
 

Member Function Documentation

void foedus::snapshot::MergeSort::InputStatus::assert_consistent ( ) const
inline

Definition at line 181 of file merge_sort.hpp.

References ASSERT_ND, chunk_relative_pos_, foedus::log::BaseLogType::header_, and foedus::log::LogHeader::log_length_.

Referenced by from_byte_pos(), from_compact_pos(), get_chunk_log(), get_cur_log(), foedus::snapshot::MergeSort::initialize_once(), is_ended(), is_last_window(), and to_absolute_pos().

181  {
182 #ifndef NDEBUG
183  // be careful on infinite loop! don't call any function here
195  const log::RecordLogType* l
196  = reinterpret_cast<const log::RecordLogType*>(window_ + chunk_relative_pos_);
197  ASSERT_ND(chunk_relative_pos_ + l->header_.log_length_ <= window_size_);
198  }
199 #endif // NDEBUG
200  }
uint64_t window_offset_
relative pos counts from this offset
Definition: merge_sort.hpp:177
#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 caller graph for this function:

const log::RecordLogType* foedus::snapshot::MergeSort::InputStatus::from_byte_pos ( uint64_t  pos) const
inline

Definition at line 209 of file merge_sort.hpp.

References assert_consistent(), and ASSERT_ND.

209  {
211  ASSERT_ND(pos < window_size_);
212  return reinterpret_cast<const log::RecordLogType*>(window_ + pos);
213  }
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181
#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:

const log::RecordLogType* foedus::snapshot::MergeSort::InputStatus::from_compact_pos ( BufferPosition  pos) const
inline

Definition at line 214 of file merge_sort.hpp.

References assert_consistent(), and ASSERT_ND.

Referenced by foedus::snapshot::MergeSort::fetch_logs(), foedus::snapshot::MergeSort::AdjustComparatorMasstree::operator()(), and foedus::snapshot::MergeSort::resolve_merged_position().

214  {
216  ASSERT_ND(pos * 8ULL < window_size_);
217  return reinterpret_cast<const log::RecordLogType*>(window_ + pos * 8ULL);
218  }
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181
#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:

const log::RecordLogType* foedus::snapshot::MergeSort::InputStatus::get_chunk_log ( ) const
inline

Definition at line 205 of file merge_sort.hpp.

References assert_consistent(), and chunk_relative_pos_.

Referenced by is_last_chunk_in_window().

205  {
207  return reinterpret_cast<const log::RecordLogType*>(window_ + chunk_relative_pos_);
208  }
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181

Here is the call graph for this function:

Here is the caller graph for this function:

const log::RecordLogType* foedus::snapshot::MergeSort::InputStatus::get_cur_log ( ) const
inline

Definition at line 201 of file merge_sort.hpp.

References assert_consistent(), and cur_relative_pos_.

201  {
203  return reinterpret_cast<const log::RecordLogType*>(window_ + cur_relative_pos_);
204  }
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181

Here is the call graph for this function:

bool foedus::snapshot::MergeSort::InputStatus::is_ended ( ) const
inline

Definition at line 227 of file merge_sort.hpp.

References assert_consistent(), end_absolute_pos_, and to_absolute_pos().

227  {
230  }
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181
uint64_t to_absolute_pos(uint64_t relative_pos) const __attribute__((always_inline))
Definition: merge_sort.hpp:219

Here is the call graph for this function:

bool foedus::snapshot::MergeSort::InputStatus::is_last_chunk_in_window ( ) const
inline

Definition at line 231 of file merge_sort.hpp.

References ASSERT_ND, end_absolute_pos_, get_chunk_log(), foedus::log::BaseLogType::header_, is_last_window(), foedus::snapshot::MergeSort::kWindowChunkReserveBytes, foedus::log::LogHeader::log_length_, to_absolute_pos(), and window_size_.

Referenced by is_last_chunk_overall().

231  {
232  if (is_last_window()) {
233  // in last window, we accurately determines the last chunk
234  uint64_t chunk_abs_pos = to_absolute_pos(chunk_relative_pos_);
235  ASSERT_ND(chunk_abs_pos <= end_absolute_pos_);
236  if (chunk_abs_pos >= end_absolute_pos_) {
237  return true;
238  }
239  uint16_t length = get_chunk_log()->header_.log_length_;
240  ASSERT_ND(length > 0);
241  ASSERT_ND(chunk_abs_pos + length <= end_absolute_pos_);
242  return chunk_abs_pos + length >= end_absolute_pos_;
243  } else {
244  // in this case, we conservatively determines the last chunk
246  }
247  }
uint64_t to_absolute_pos(uint64_t relative_pos) const __attribute__((always_inline))
Definition: merge_sort.hpp:219
bool is_last_window() const __attribute__((always_inline))
Definition: merge_sort.hpp:223
To avoid handling the case where a log spans an end of window, chunks leave at least this many bytes ...
Definition: merge_sort.hpp:101
uint16_t log_length_
Byte size of this log entry including this header itself and everything.
const log::RecordLogType * get_chunk_log() const __attribute__((always_inline))
Definition: merge_sort.hpp:205
#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:

bool foedus::snapshot::MergeSort::InputStatus::is_last_chunk_overall ( ) const
inline

Definition at line 248 of file merge_sort.hpp.

References is_last_chunk_in_window(), and is_last_window().

248  {
250  }
bool is_last_chunk_in_window() const __attribute__((always_inline))
Definition: merge_sort.hpp:231
bool is_last_window() const __attribute__((always_inline))
Definition: merge_sort.hpp:223

Here is the call graph for this function:

bool foedus::snapshot::MergeSort::InputStatus::is_last_window ( ) const
inline

Definition at line 223 of file merge_sort.hpp.

References assert_consistent(), end_absolute_pos_, and to_absolute_pos().

Referenced by is_last_chunk_in_window(), and is_last_chunk_overall().

223  {
226  }
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181
uint64_t to_absolute_pos(uint64_t relative_pos) const __attribute__((always_inline))
Definition: merge_sort.hpp:219

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t foedus::snapshot::MergeSort::InputStatus::to_absolute_pos ( uint64_t  relative_pos) const
inline

Definition at line 219 of file merge_sort.hpp.

References assert_consistent().

Referenced by is_ended(), is_last_chunk_in_window(), and is_last_window().

219  {
221  return window_offset_ + relative_pos;
222  }
uint64_t window_offset_
relative pos counts from this offset
Definition: merge_sort.hpp:177
void assert_consistent() const __attribute__((always_inline))
Definition: merge_sort.hpp:181

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

uint64_t foedus::snapshot::MergeSort::InputStatus::chunk_relative_pos_
Invariant
cur_relative_pos_ <= chunk_relative_pos_ < window_size_

Definition at line 172 of file merge_sort.hpp.

Referenced by assert_consistent(), get_chunk_log(), and foedus::snapshot::MergeSort::initialize_once().

uint64_t foedus::snapshot::MergeSort::InputStatus::cur_relative_pos_
Invariant
cur_relative_pos_ < window_size_

Definition at line 170 of file merge_sort.hpp.

Referenced by get_cur_log(), and foedus::snapshot::MergeSort::initialize_once().

uint64_t foedus::snapshot::MergeSort::InputStatus::end_absolute_pos_
char foedus::snapshot::MergeSort::InputStatus::padding_[6]

Definition at line 173 of file merge_sort.hpp.

uint64_t foedus::snapshot::MergeSort::InputStatus::previous_chunk_relative_pos_
Invariant
previous_chunk_relative_pos_ <= chunk_relative_pos_

Definition at line 175 of file merge_sort.hpp.

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

const char* foedus::snapshot::MergeSort::InputStatus::window_

Definition at line 168 of file merge_sort.hpp.

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

uint64_t foedus::snapshot::MergeSort::InputStatus::window_offset_

relative pos counts from this offset

Definition at line 177 of file merge_sort.hpp.

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

uint64_t foedus::snapshot::MergeSort::InputStatus::window_size_

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