Commit 1930ba12 authored by unknown's avatar unknown

make REPAIR killable

parent b05427d0
...@@ -2508,7 +2508,7 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key) ...@@ -2508,7 +2508,7 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
DBUG_RETURN(1); DBUG_RETURN(1);
} }
sort_param->real_key_length= sort_param->real_key_length=
(info->s->rec_reflength+ (info->s->rec_reflength+
_mi_make_key(info, sort_param->key, (uchar*) key, _mi_make_key(info, sort_param->key, (uchar*) key,
sort_param->record, sort_param->filepos)); sort_param->record, sort_param->filepos));
#ifdef HAVE_purify #ifdef HAVE_purify
...@@ -2587,6 +2587,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) ...@@ -2587,6 +2587,9 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
char llbuff[22],llbuff2[22]; char llbuff[22],llbuff2[22];
DBUG_ENTER("sort_get_next_record"); DBUG_ENTER("sort_get_next_record");
if (*killed_ptr(param))
DBUG_RETURN(1);
switch (share->data_file_type) { switch (share->data_file_type) {
case STATIC_RECORD: case STATIC_RECORD:
for (;;) for (;;)
......
...@@ -1636,6 +1636,10 @@ err: ...@@ -1636,6 +1636,10 @@ err:
DBUG_RETURN(1); DBUG_RETURN(1);
} /* sort_record_index */ } /* sort_record_index */
volatile bool *killed_ptr(MI_CHECK *param)
{
return (bool *)(param->thd); /* always NULL */
}
/* print warnings and errors */ /* print warnings and errors */
/* VARARGS */ /* VARARGS */
......
...@@ -648,6 +648,7 @@ void mi_setup_functions(register MYISAM_SHARE *share); ...@@ -648,6 +648,7 @@ void mi_setup_functions(register MYISAM_SHARE *share);
int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size); int _mi_init_bulk_insert(MI_INFO *info, ulong cache_size);
/* Functions needed by mi_check */ /* Functions needed by mi_check */
volatile bool *killed_ptr(MI_CHECK *param);
void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...));
void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...));
void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...));
......
...@@ -284,7 +284,7 @@ pthread_handler_decl(thr_find_all_keys,arg) ...@@ -284,7 +284,7 @@ pthread_handler_decl(thr_find_all_keys,arg)
uint memavl,old_memavl,keys,sort_length; uint memavl,old_memavl,keys,sort_length;
uint idx, maxbuffer; uint idx, maxbuffer;
uchar **sort_keys=0; uchar **sort_keys=0;
error=1; error=1;
if (my_thread_init()) if (my_thread_init())
...@@ -701,6 +701,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, ...@@ -701,6 +701,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
uchar *strpos; uchar *strpos;
BUFFPEK *buffpek,**refpek; BUFFPEK *buffpek,**refpek;
QUEUE queue; QUEUE queue;
volatile bool *killed= killed_ptr(info->sort_info->param);
DBUG_ENTER("merge_buffers"); DBUG_ENTER("merge_buffers");
count=error=0; count=error=0;
...@@ -732,6 +733,10 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, ...@@ -732,6 +733,10 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{ {
for (;;) for (;;)
{ {
if (*killed)
{
error=1; goto err;
}
buffpek=(BUFFPEK*) queue_top(&queue); buffpek=(BUFFPEK*) queue_top(&queue);
if (to_file) if (to_file)
{ {
......
...@@ -87,6 +87,11 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, ...@@ -87,6 +87,11 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
extern "C" { extern "C" {
volatile bool *killed_ptr(MI_CHECK *param)
{
return &(((THD *)(param->thd))->killed);
}
void mi_check_print_error(MI_CHECK *param, const char *fmt,...) void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
{ {
param->error_printed|=1; param->error_printed|=1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment