24#ifndef MERGE_MANY_BUFF_INCLUDED
25#define MERGE_MANY_BUFF_INCLUDED
50template <
typename Merge_param>
57 size_t num_chunks = chunk_array.
size();
58 *p_num_chunks = num_chunks;
76 if (
merge_buffers(thd, param, from_file, to_file, sort_buffer,
82 if (
merge_buffers(thd, param, from_file, to_file, sort_buffer, last_chunk++,
91 num_chunks = last_chunk - chunk_array.
begin();
95 if (to_file == t_file) {
100 *p_num_chunks = num_chunks;
A wrapper class which provides array bounds checking.
Definition: sql_array.h:47
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:134
size_t size() const
Definition: sql_array.h:154
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
void cleanup(void)
Definition: sql_class.cc:1238
#define L
Definition: ctype-tis620.cc:75
static int merge_buffers(THD *thd, Sort_param *param, IO_CACHE *from_file, IO_CACHE *to_file, Sort_buffer sort_buffer, Merge_chunk *last_chunk, Merge_chunk_array chunk_array, bool include_keys)
Merge buffers to one buffer.
Definition: filesort.cc:1912
void close_cached_file(IO_CACHE *cache)
Definition: mf_cache.cc:87
#define MY_WME
Definition: my_sys.h:128
void setup_io_cache(IO_CACHE *info)
Definition: mf_iocache.cc:117
#define flush_io_cache(info)
Definition: my_sys.h:766
bool reinit_io_cache(IO_CACHE *info, enum cache_type type, my_off_t seek_offset, bool use_async_io, bool clear_cache)
Definition: mf_iocache.cc:328
bool open_cached_file(IO_CACHE *cache, const char *dir, const char *prefix, size_t cache_size, myf cache_myflags)
Definition: mf_cache.cc:53
@ WRITE_CACHE
Definition: my_sys.h:290
@ READ_CACHE
Definition: my_sys.h:289
bool merge_many_buff(THD *thd, Merge_param *param, Sort_buffer sort_buffer, Merge_chunk_array chunk_array, size_t *p_num_chunks, IO_CACHE *t_file)
Merges buffers to make < MERGEBUFF2 buffers.
Definition: merge_many_buff.h:51
#define DBUG_TRACE
Definition: my_dbug.h:146
#define MYF(v)
Definition: my_inttypes.h:97
constexpr const unsigned int DISK_BUFFER_SIZE
Definition: my_io.h:164
Common header for many mysys elements.
#define mysql_tmpdir
Definition: mysqld.h:683
#define TEMP_PREFIX
Definition: sql_base.h:79
constexpr size_t MERGEBUFF2
Definition: sql_sort.h:41
Bounds_checked_array< Merge_chunk > Merge_chunk_array
Definition: sql_sort.h:143
constexpr size_t MERGEBUFF
Definition: sql_sort.h:40
static void swap(String &a, String &b) noexcept
Definition: sql_string.h:663
Descriptor for a merge chunk to be sort-merged.
Definition: sql_sort.h:57