67
67
static int writekeys(MI_SORT_PARAM *sort_param);
68
68
static int sort_one_index(MI_CHECK *param, MI_INFO *info,MI_KEYDEF *keyinfo,
69
69
my_off_t pagepos, File new_file);
70
static int sort_key_read(MI_SORT_PARAM *sort_param,void *key);
71
static int sort_get_next_record(MI_SORT_PARAM *sort_param);
72
static int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,const void *b);
73
static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a);
74
static my_off_t get_record_for_key(MI_INFO *info,MI_KEYDEF *keyinfo,
76
static int sort_insert_key(MI_SORT_PARAM *sort_param,
77
register SORT_KEY_BLOCKS *key_block,
78
unsigned char *key, my_off_t prev_block);
79
static int sort_delete_record(MI_SORT_PARAM *sort_param);
72
int sort_key_read(MI_SORT_PARAM *sort_param,void *key);
73
int sort_get_next_record(MI_SORT_PARAM *sort_param);
74
int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,const void *b);
75
int sort_key_write(MI_SORT_PARAM *sort_param, const void *a);
76
my_off_t get_record_for_key(MI_INFO *info,MI_KEYDEF *keyinfo,
78
int sort_insert_key(MI_SORT_PARAM *sort_param,
79
register SORT_KEY_BLOCKS *key_block,
80
unsigned char *key, my_off_t prev_block);
81
int sort_delete_record(MI_SORT_PARAM *sort_param);
80
83
/*static int flush_pending_blocks(MI_CHECK *param);*/
81
84
static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint32_t blocks,
82
85
uint32_t buffer_length);
2868
2871
/* Read next record and return next key */
2870
static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
2873
int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
2873
2876
SORT_INFO *sort_info=sort_param->sort_info;
3393
3396
/* Compare two keys from _create_index_by_sort */
3395
static int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,
3398
int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a, const void *b)
3398
3400
uint32_t not_used[2];
3399
3401
return (ha_key_cmp(sort_param->seg, *((unsigned char* const *) a), *((unsigned char* const *) b),
3401
3403
} /* sort_key_cmp */
3404
static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
3406
int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
3406
3408
uint32_t diff_pos[2];
3407
3409
char llbuff[22],llbuff2[22];
3459
3461
/* get pointer to record from a key */
3461
static my_off_t get_record_for_key(MI_INFO *info, MI_KEYDEF *keyinfo,
3463
my_off_t get_record_for_key(MI_INFO *info, MI_KEYDEF *keyinfo,
3464
unsigned char *key) {
3464
3465
return _mi_dpos(info,0,key+_mi_keylength(keyinfo,key));
3465
3466
} /* get_record_for_key */
3468
3469
/* Insert a key in sort-key-blocks */
3470
static int sort_insert_key(MI_SORT_PARAM *sort_param,
3471
register SORT_KEY_BLOCKS *key_block, unsigned char *key,
3472
my_off_t prev_block)
3471
int sort_insert_key(MI_SORT_PARAM *sort_param,
3472
register SORT_KEY_BLOCKS *key_block, unsigned char *key,
3473
my_off_t prev_block)
3474
3475
uint32_t a_length,t_length,nod_flag;
3475
3476
my_off_t filepos,key_file_length;