File external_sort.c¶
FileList > cubrid > src > storage > external_sort.c
Go to the source code of this file
#include "config.h"#include <stdio.h>#include <string.h>#include <stddef.h>#include <stdlib.h>#include <math.h>#include "error_manager.h"#include "system_parameter.h"#include "memory_alloc.h"#include "external_sort.h"#include "file_manager.h"#include "page_buffer.h"#include "log_manager.h"#include "disk_manager.h"#include "slotted_page.h"#include "overflow_file.h"#include "boot_sr.h"#include "connection_error.h"#include "server_support.h"#include "thread_entry_task.hpp"#include "thread_manager.hpp"#include "list_file.h"#include "query_manager.h"#include "object_representation.h"#include "px_worker_manager.hpp"#include "px_callable_task.hpp"#include "px_parallel.hpp"#include "px_sort.h"#include "btree_load.h"#include "px_ftab_set.hpp"#include <functional>#include "memory_wrapper.hpp"
Classes¶
| Type | Name |
|---|---|
| struct | file_contents |
| struct | run_struct |
| struct | slot |
| struct | slotted_pheader |
| struct | sort_param |
| struct | sort_rec_list |
| struct | sort_stack |
| struct | srun |
| struct | vol_info |
| struct | vol_list |
Public Types¶
| Type | Name |
|---|---|
| typedef struct file_contents | FILE_CONTENTS |
| typedef void | FIND_RUN_FN |
| typedef void | MERGE_RUN_FN |
| typedef struct run_struct | RUN |
| typedef struct slot | SLOT |
| typedef struct slotted_pheader | SLOTTED_PAGE_HEADER |
| typedef struct sort_param | SORT_PARAM |
| typedef struct sort_rec_list | SORT_REC_LIST |
| typedef struct sort_stack | SORT_STACK |
| typedef struct srun | SRUN |
| typedef struct vol_info | VOL_INFO |
| typedef struct vol_list | VOL_LIST |
Public Functions¶
Public Static Functions¶
Macros¶
| Type | Name |
|---|---|
| define | SORT_CHECK_DUPLICATE (a, b) /* multi line expression */ |
| define | SORT_EXPAND_DYN_ARRAY_RATIO 1.5 |
| define | SORT_INITIAL_DYN_ARRAY_SIZE 30 |
| define | SORT_MAXREC_LENGTH (([**ssize\_t**](broker__monitor_8c.md#function-timeout))([**DB\_PAGESIZE**](storage__common_8h.md#define-db_pagesize) - [**sizeof**](broker__monitor_8c.md#function-timeout)([**SLOTTED\_PAGE\_HEADER**](external__sort_8c.md#typedef-slotted_page_header)) - [**sizeof**](broker__monitor_8c.md#function-timeout)([**SLOT**](external__sort_8c.md#typedef-slot)))) |
| define | SORT_MAX_HALF_FILES 4 |
| define | SORT_MAX_TOT_FILES [**SORT\_MAX\_HALF\_FILES**](external__sort_8c.md#define-sort_max_half_files) \* 2 |
| define | SORT_MIN_HALF_FILES 2 |
| define | SORT_MULTIPAGE_FILE_SIZE_ESTIMATE 20 |
| define | SORT_SWAP_PTR (a, b) { [**char**](broker__monitor_8c.md#function-timeout) \*\*temp; temp = [**a**](broker__monitor_8c.md#function-timeout); [**a**](broker__monitor_8c.md#function-timeout) = b; b = temp; } |
Public Types Documentation¶
typedef FILE_CONTENTS¶
typedef FIND_RUN_FN¶
typedef MERGE_RUN_FN¶
typedef RUN¶
typedef SLOT¶
typedef SLOTTED_PAGE_HEADER¶
typedef SORT_PARAM¶
typedef SORT_REC_LIST¶
typedef SORT_STACK¶
typedef SRUN¶
typedef VOL_INFO¶
typedef VOL_LIST¶
Public Functions Documentation¶
function sort_check_parallelism¶
function sort_copy_sort_param¶
int sort_copy_sort_param (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param,
int parallel_num
)
function sort_end_parallelism¶
int sort_end_parallelism (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param
)
function sort_listfile¶
int sort_listfile (
THREAD_ENTRY * thread_p,
INT16 volid,
int est_inp_pg_cnt,
SORT_GET_FUNC * get_fn,
void * get_arg,
SORT_PUT_FUNC * put_fn,
void * put_arg,
SORT_CMP_FUNC * cmp_fn,
void * cmp_arg,
SORT_DUP_OPTION option,
int limit,
bool includes_tde_class,
SORT_PARALLEL_TYPE parallel_type
)
function sort_listfile_execute¶
function sort_merge_nruns¶
function sort_merge_nruns_parallel¶
function sort_merge_run_for_parallel¶
int sort_merge_run_for_parallel (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param,
int parallel_num
)
function sort_put_result_for_parallel¶
function sort_put_result_from_tmpfile¶
int sort_put_result_from_tmpfile (
THREAD_ENTRY * thread_p,
SORT_PARAM * sort_param,
int start_pagenum
)
function sort_split_input_temp_file¶
int sort_split_input_temp_file (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param,
int parallel_num
)
function sort_split_last_run¶
void sort_split_last_run (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param,
int parallel_num
)
function sort_start_parallelism¶
int sort_start_parallelism (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param
)
Public Static Functions Documentation¶
function sort_add_new_file¶
static int sort_add_new_file (
THREAD_ENTRY * thread_p,
VFID * vfid,
int file_pg_cnt_est,
bool force_alloc,
bool tde_encrypted
)
function sort_append¶
function sort_checkalloc_numpages_of_outfiles¶
static int sort_checkalloc_numpages_of_outfiles (
THREAD_ENTRY * thread_p,
SORT_PARAM * sort_param
)
function sort_exphase_merge¶
function sort_exphase_merge_elim_dup¶
function sort_find_inbuf_size¶
function sort_get_avg_numpages_of_nonempty_tmpfile¶
function sort_get_num_file_contents¶
function sort_get_num_half_tmpfiles¶
function sort_get_numpages_of_active_infiles¶
function sort_inphase_sort¶
static int sort_inphase_sort (
THREAD_ENTRY * thread_p,
SORT_PARAM * sort_param,
SORT_GET_FUNC * get_next,
void * arguments,
unsigned int * total_numrecs
)
function sort_listfile_internal¶
function sort_merge_run_for_parallel_index_leaf_build¶
static int sort_merge_run_for_parallel_index_leaf_build (
THREAD_ENTRY * thread_p,
SORT_PARAM * px_sort_param,
SORT_PARAM * sort_param,
int parallel_num
)
function sort_print_file_contents¶
function sort_read_area¶
static int sort_read_area (
THREAD_ENTRY * thread_p,
VFID * vfid,
int first_page,
INT32 num_pages,
char * area_start
)
function sort_retrieve_longrec¶
function sort_return_used_resources¶
static void sort_return_used_resources (
THREAD_ENTRY * thread_p,
SORT_PARAM * sort_param,
PARALLEL_TYPE parallel_type
)
function sort_run_add_new¶
function sort_run_find¶
static void sort_run_find (
char ** source,
long * top,
SORT_STACK * st_p,
long limit,
SORT_CMP_FUNC * compare,
void * comp_arg,
SORT_DUP_OPTION option
)
function sort_run_flip¶
function sort_run_flush¶
static int sort_run_flush (
THREAD_ENTRY * thread_p,
SORT_PARAM * sort_param,
int out_curfile,
int * cur_page,
char * output_buffer,
char ** index_area,
int numrecs,
int rec_type
)
function sort_run_merge¶
static void sort_run_merge (
char ** low,
char ** high,
SORT_STACK * st_p,
SORT_CMP_FUNC * compare,
void * comp_arg,
SORT_DUP_OPTION option
)
function sort_run_remove_first¶
function sort_run_sort¶
static char ** sort_run_sort (
THREAD_ENTRY * thread_p,
SORT_PARAM * sort_param,
char ** base,
long limit,
long sort_numrecs,
char ** otherbase,
long * srun_limit
)
function sort_spage_compact¶
function sort_spage_dump¶
function sort_spage_dump_hdr¶
function sort_spage_dump_sptr¶
function sort_spage_find_free¶
static INT16 sort_spage_find_free (
PAGE_PTR pgptr,
SLOT ** sptr,
INT16 length,
INT16 type,
INT16 * space
)
function sort_spage_get_numrecs¶
function sort_spage_get_record¶
static SCAN_CODE sort_spage_get_record (
PAGE_PTR pgptr,
INT16 slotid,
RECDES * recdes,
bool peek_p
)
function sort_spage_initialize¶
function sort_spage_insert¶
function sort_spage_offsetcmp¶
function sort_validate¶
function sort_write_area¶
static int sort_write_area (
THREAD_ENTRY * thread_p,
VFID * vfid,
int first_page,
INT32 num_pages,
char * area_start,
bool tde_encrypted
)
Macro Definition Documentation¶
define SORT_CHECK_DUPLICATE¶
define SORT_EXPAND_DYN_ARRAY_RATIO¶
define SORT_INITIAL_DYN_ARRAY_SIZE¶
define SORT_MAXREC_LENGTH¶
#define SORT_MAXREC_LENGTH `(( ssize_t )( DB_PAGESIZE - sizeof ( SLOTTED_PAGE_HEADER ) - sizeof ( SLOT )))`
define SORT_MAX_HALF_FILES¶
define SORT_MAX_TOT_FILES¶
define SORT_MIN_HALF_FILES¶
define SORT_MULTIPAGE_FILE_SIZE_ESTIMATE¶
define SORT_SWAP_PTR¶
The documentation for this class was generated from the following file cubrid/src/storage/external_sort.c