18 #ifndef FOEDUS_STORAGE_HASH_HASH_COMPOSED_BINS_IMPL_HPP_
19 #define FOEDUS_STORAGE_HASH_HASH_COMPOSED_BINS_IMPL_HPP_
158 uint32_t total_pages,
159 uint32_t buffer_size,
193 ASSERT_ND(cursor_bin_ < cursor_bin_count_);
222 const HashRootInfoPage*
const* inputs,
223 uint32_t input_count,
225 uint16_t root_child_index,
229 uint32_t* writer_buffer_pos,
230 uint32_t* writer_higher_buffer_pos,
231 bool* had_any_change);
249 uint32_t* writer_buffer_pos,
250 uint32_t* writer_higher_buffer_pos);
255 uint8_t fixed_upto_level,
258 uint32_t* writer_buffer_pos,
259 uint32_t* writer_higher_buffer_pos);
264 uint32_t* writer_buffer_pos,
265 uint32_t writer_higher_buffer_pos);
282 static_assert(
sizeof(HashRootInfoPage) ==
kPageSize,
"incorrect sizeof(RootInfoPage)");
288 #endif // FOEDUS_STORAGE_HASH_HASH_COMPOSED_BINS_IMPL_HPP_
Represents an output of composer on one bin.
SnapshotPagePointer next_page_
SnapshotPagePointer head_page_id_
Page ID of the head of HashComposedBinsPage for this sub-tree.
snapshot::SnapshotId snapshot_id_
ErrorCode assure_writer_buffer(snapshot::SnapshotWriter *writer, uint32_t *writer_buffer_pos, uint32_t writer_higher_buffer_pos)
Subroutine to flush the writer if needed to make sure it has enough room.
uint16_t cursor_bin_count_
Number of active bins in the current page.
Definitions of IDs in this package and a few related constant values.
ComposedBin bins_[kHashComposedBinsPageMaxBins]
Typedefs of ID types used in snapshot package.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
const uint16_t kHashComposedBinsPageMaxBins
uint32_t total_pages_
Number of HashComposedBinsPage from head_page_id_ contiguously emit by a composer.
uint32_t input_count_
total number of buffers in inputs_
Brings error stacktrace information as return value of functions.
Abstracts how we batch-read several HashComposedBinsPage emit from individual composers.
Forward declarations of classes in snapshot manager package.
Holds a set of read-only file objects for snapshot files.
PagePtr cur_path_[kHashMaxLevels]
The pages we are now composing.
#define LIKELY(x)
Hints that x is highly likely true.
Forward declarations of classes in cache package.
uint32_t buffer_size_
How many pages buffer_ can hold.
const uint8_t kHashMaxLevels
Max level of intermediate pages.
void init(cache::SnapshotFileSet *fileset, SnapshotPagePointer head_page_id, uint32_t total_pages, uint32_t buffer_size, HashComposedBinsPage *buffer)
ErrorCode process_a_bin(uint32_t *installed_count, HashBin *next_lowest_bin)
Consumes inputs for the cur_path_[0] page and install snapshot pointers there.
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
ComposedBinsBuffer * inputs_
ErrorCode next_pages()
Read pages to buffer_.
Represents a range of hash bins in a hash storage, such as what an intermediate page is responsible f...
uint32_t buffer_pos_
index (0=head, total_pages_ - 1=tail, ) of the first page in the buffer_.
SnapshotPagePointer page_id_
std::unique_ptr< ComposedBinsBuffer[] > inputs_memory_
just for auto release
uint16_t SnapshotId
Unique ID of Snapshot.
uint32_t buffer_count_
number of pages so far read in the buffer_.
ErrorCode next_bin() __attribute__((always_inline))
Moves on to next bin.
Represents an intermediate page in Hashtable Storage.
HashIntermediatePage HashRootInfoPage
Output of one compose() call, which are then combined in construct_root().
HashComposedBinsPage * buffer_
The buffer to read contiguous pages in one shot.
uint64_t HashBin
Represents a bin of a hash value.
uint16_t cursor_bin_
Cursor position for bin in the current page.
const HashComposedBinsPage & get_cur_page() const __attribute__((always_inline))
ErrorCode open_path(HashBin bin, uint8_t fixed_upto_level, cache::SnapshotFileSet *fileset, snapshot::SnapshotWriter *writer, uint32_t *writer_buffer_pos, uint32_t *writer_higher_buffer_pos)
Recursively opens pages down from fixed_upto_level.
Represents one memory block aligned to actual OS/hardware pages.
cache::SnapshotFileSet * fileset_
file handles
ErrorCode switch_path(HashBin lowest_bin, cache::SnapshotFileSet *fileset, snapshot::SnapshotWriter *writer, uint32_t *writer_buffer_pos, uint32_t *writer_higher_buffer_pos)
Moves cur_path_ to a page that cotains the specified bin.
HashIntermediatePage * PagePtr
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definitions of IDs in this package and a few related constant values.
static void assure_read_buffer_size(memory::AlignedMemory *read_buffer, uint32_t inputs)
If needed, expand the given read buffer to be used with the inputs.
#define ALWAYS_INLINE
A function suffix to hint that the function should always be inlined.
ErrorStack init(const HashRootInfoPage *const *inputs, uint32_t input_count, PagePtr root_page, uint16_t root_child_index, memory::AlignedMemory *read_buffer, cache::SnapshotFileSet *fileset, snapshot::SnapshotWriter *writer, uint32_t *writer_buffer_pos, uint32_t *writer_higher_buffer_pos, bool *had_any_change)
const uint16_t kPageSize
A constant defining the page size (in bytes) of both snapshot pages and volatile pages.
ErrorCode
Enum of error codes defined in error_code.xmacro.
uint32_t cursor_buffer_
Cursor position for page in the buffer.
Forward declarations of classes in hash storage package.
const ComposedBin & get_cur_bin() const __attribute__((always_inline))
Packages all ComposedBinsBuffer to easily extract bins of current interest.
A page to pack many ComposedBin as an output of composer.
Writes out one snapshot file for all data pages in one reducer.