31#ifndef ddl0impl_merge_h
32#define ddl0impl_merge_h
67 using Range = std::pair<os_offset_t, os_offset_t>;
89 Output_file &output_file)
noexcept;
98 Output_file &output_file,
Class used to report ALTER TABLE progress via performance_schema.
Definition: ut0stage.h:80
dberr_t
Definition: db0err.h:38
For scanning the temporary file.
The general architecture is that the work is done in two phases, roughly the read and write phase.
Definition: btr0load.cc:41
std::deque< os_offset_t, ut::allocator< os_offset_t > > Merge_offsets
Start offsets in the file, from where to merge records.
Definition: ddl0impl.h:63
size_t buffer_size(const ConstBufferSequence &buffers) noexcept
Definition: buffer.h:314
For loading indexes.
Definition: ddl0impl-builder.h:47
Cursor for reading the data.
Definition: ddl0impl-cursor.h:40
Structure for reporting duplicate records.
Definition: ddl0ddl.h:131
Context to use for merging the files/runs.
Definition: ddl0impl-merge.h:52
Alter_stage * m_stage
PFS progress monitoring.
Definition: ddl0impl-merge.h:63
size_t m_n_threads
Number of scan threads used, for memory buffer calculation.
Definition: ddl0impl-merge.h:60
Dup * m_dup
For reporting duplicates, it has the index instance too.
Definition: ddl0impl-merge.h:57
ddl::file_t * m_file
File to sort.
Definition: ddl0impl-merge.h:54
Cursor for merging blocks from the same file.
Definition: ddl0merge.cc:52
For writing out the merged rows.
Definition: ddl0merge.cc:107
Merge the blocks in the file.
Definition: ddl0impl-merge.h:42
uint64_t m_n_rows
Number of rows in the sorted file.
Definition: ddl0impl-merge.h:117
dberr_t merge_rows(Cursor &cursor, Output_file &output_file) noexcept
Merge the rows.
Definition: ddl0merge.cc:407
std::pair< os_offset_t, os_offset_t > Range
Start of the record lists to merge.
Definition: ddl0impl-merge.h:67
Dup * m_dup
To check and report duplicates.
Definition: ddl0impl-merge.h:108
Merge_file_sort(Context *merge_ctx) noexcept
Constructor.
Definition: ddl0impl-merge.h:71
Range next_range(Merge_offsets &offsets) noexcept
Move to the next range of pages to merge.
Definition: ddl0merge.cc:389
Context * m_merge_ctx
Meta data for merging blocks.
Definition: ddl0impl-merge.h:111
Merge_offsets m_next_offsets
Page numbers to merge for the next pass.
Definition: ddl0impl-merge.h:114
static constexpr size_t N_WAY_MERGE
The design is generalized as an N way merge, however we stick with 2 for now.
Definition: ddl0impl-merge.h:49
dberr_t merge_ranges(Cursor &cursor, Merge_offsets &offsets, Output_file &output_file, size_t buffer_size) noexcept
Merge the blocks in the ranges.
Definition: ddl0merge.cc:434
dberr_t sort(Builder *builder, Merge_offsets &offsets) noexcept
Merge the the blocks.
Definition: ddl0merge.cc:473
uint64_t get_n_rows() const noexcept
Definition: ddl0impl-merge.h:81
Information about temporary files used in merge sort.
Definition: ddl0impl.h:66