diff options
author | unknown <marko@hundin.mysql.fi> | 2004-04-01 16:54:22 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-04-01 16:54:22 +0300 |
commit | 41aa345dbb41af75815297bbc546a11cf04b2e63 (patch) | |
tree | 8252343ff9865c289e77cc494d095d7aa748dffd /innobase | |
parent | 025ddfea288890236d4da04b46b3fff926707de3 (diff) | |
parent | a9fb96b2cb1ecce7ba433659eacbec6bc974a0af (diff) | |
download | mariadb-git-41aa345dbb41af75815297bbc546a11cf04b2e63.tar.gz |
Merge marko@build.mysql.com:/home/bk/mysql-4.0
into hundin.mysql.fi:/home/marko/j/mysql-4.0
innobase/fil/fil0fil.c:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/fil/fil0fil.c | 11 | ||||
-rw-r--r-- | innobase/include/srv0srv.h | 13 | ||||
-rw-r--r-- | innobase/os/os0file.c | 32 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 18 |
4 files changed, 49 insertions, 25 deletions
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c index 1abb1b926f2..44f1777bb33 100644 --- a/innobase/fil/fil0fil.c +++ b/innobase/fil/fil0fil.c @@ -1321,7 +1321,7 @@ fil_aio_wait( ut_ad(fil_validate()); if (os_aio_use_native_aio) { - srv_io_thread_op_info[segment] = (char *) "native aio handle"; + srv_set_io_thread_op_info(segment, "native aio handle"); #ifdef WIN_ASYNC_IO ret = os_aio_windows_handle(segment, 0, &fil_node, &message, &type); @@ -1332,7 +1332,7 @@ fil_aio_wait( ut_error; #endif } else { - srv_io_thread_op_info[segment] =(char *)"simulated aio handle"; + srv_set_io_thread_op_info(segment, "simulated aio handle"); ret = os_aio_simulated_handle(segment, (void**) &fil_node, &message, &type); @@ -1340,7 +1340,7 @@ fil_aio_wait( ut_a(ret); - srv_io_thread_op_info[segment] = (char *) "complete io for fil node"; + srv_set_io_thread_op_info(segment, "complete io for fil node"); mutex_enter(&(system->mutex)); @@ -1353,11 +1353,10 @@ fil_aio_wait( /* Do the i/o handling */ if (buf_pool_is_block(message)) { - srv_io_thread_op_info[segment] = - (char *) "complete io for buf page"; + srv_set_io_thread_op_info(segment, "complete io for buf page"); buf_page_io_complete(message); } else { - srv_io_thread_op_info[segment] =(char *) "complete io for log"; + srv_set_io_thread_op_info(segment, "complete io for log"); log_io_complete(message); } } diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 769d55fb66c..3811f6ae167 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -155,8 +155,8 @@ extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, /* Array of English strings describing the current state of an i/o handler thread */ -extern char* srv_io_thread_op_info[]; -extern char* srv_io_thread_function[]; +extern const char* srv_io_thread_op_info[]; +extern const char* srv_io_thread_function[]; typedef struct srv_sys_struct srv_sys_t; @@ -234,6 +234,15 @@ srv_get_thread_type(void); /*=====================*/ /* out: SRV_COM, ... */ /************************************************************************* +Sets the info describing an i/o thread current state. */ + +void +srv_set_io_thread_op_info( +/*======================*/ + ulint i, /* in: the 'segment' of the i/o thread */ + const char* str); /* in: constant char string describing the + state */ +/************************************************************************* Releases threads of the type given from suspension in the thread table. NOTE! The server mutex has to be reserved by the caller! */ diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index abcb2259e84..acc6492fefc 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -1586,7 +1586,7 @@ os_aio_init( os_io_init_simple(); for (i = 0; i < n_segments; i++) { - srv_io_thread_op_info[i] = (char*)"not started yet"; + srv_set_io_thread_op_info(i, "not started yet"); } n_per_seg = n / n_segments; @@ -1597,22 +1597,24 @@ os_aio_init( os_aio_ibuf_array = os_aio_array_create(n_per_seg, 1); - srv_io_thread_function[0] = (char*)"insert buffer thread"; + srv_io_thread_function[0] = "insert buffer thread"; os_aio_log_array = os_aio_array_create(n_per_seg, 1); - srv_io_thread_function[1] = (char*)"log thread"; + srv_io_thread_function[1] = "log thread"; os_aio_read_array = os_aio_array_create(n_read_segs * n_per_seg, n_read_segs); for (i = 2; i < 2 + n_read_segs; i++) { - srv_io_thread_function[i] = (char*)"read thread"; + ut_a(i < SRV_MAX_N_IO_THREADS); + srv_io_thread_function[i] = "read thread"; } os_aio_write_array = os_aio_array_create(n_write_segs * n_per_seg, n_write_segs); for (i = 2 + n_read_segs; i < n_segments; i++) { - srv_io_thread_function[i] = (char*)"write thread"; + ut_a(i < SRV_MAX_N_IO_THREADS); + srv_io_thread_function[i] = "write thread"; } os_aio_sync_array = os_aio_array_create(n_slots_sync, 1); @@ -2324,13 +2326,10 @@ os_aio_windows_handle( n = array->n_slots / array->n_segments; if (array == os_aio_sync_array) { - srv_io_thread_op_info[orig_seg] = - "wait Windows aio for 1 page"; os_event_wait(os_aio_array_get_nth_slot(array, pos)->event); i = pos; } else { - srv_io_thread_op_info[orig_seg] = - "wait Windows aio"; + srv_set_io_thread_op_info(orig_seg, "wait Windows aio"); i = os_event_wait_multiple(n, (array->native_events) + segment * n); } @@ -2341,7 +2340,11 @@ os_aio_windows_handle( ut_a(slot->reserved); - srv_io_thread_op_info[orig_seg] = "get windows aio return value"; + if (orig_seg != ULINT_UNDEFINED) { + srv_set_io_thread_op_info(orig_seg, + "get windows aio return value"); + } + ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE); *message1 = slot->message1; @@ -2663,8 +2666,8 @@ consecutive_loop: offs += consecutive_ios[i]->len; } } - - srv_io_thread_op_info[global_segment] = (char*) "doing file i/o"; + + srv_set_io_thread_op_info(global_segment, "doing file i/o"); if (os_aio_print_debug) { fprintf(stderr, @@ -2714,7 +2717,7 @@ consecutive_loop: } ut_a(ret); - srv_io_thread_op_info[global_segment] = (char*) "file i/o done"; + srv_set_io_thread_op_info(global_segment, "file i/o done"); /* printf("aio: %lu consecutive %lu:th segment, first offs %lu blocks\n", n_consecutive, global_segment, slot->offset @@ -2772,8 +2775,7 @@ wait_for_io: os_mutex_exit(array->mutex); recommended_sleep: - srv_io_thread_op_info[global_segment] = - (char*)"waiting for i/o request"; + srv_set_io_thread_op_info(global_segment, "waiting for i/o request"); os_event_wait(os_aio_segment_wait_events[global_segment]); diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index e4eb3a7f556..87e15037fb6 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -285,8 +285,8 @@ ulint srv_test_n_mutexes = ULINT_MAX; /* Array of English strings describing the current state of an i/o handler thread */ -char* srv_io_thread_op_info[SRV_MAX_N_IO_THREADS]; -char* srv_io_thread_function[SRV_MAX_N_IO_THREADS]; +const char* srv_io_thread_op_info[SRV_MAX_N_IO_THREADS]; +const char* srv_io_thread_function[SRV_MAX_N_IO_THREADS]; time_t srv_last_monitor_time; @@ -514,6 +514,20 @@ are indexed by the type of the thread. */ ulint srv_n_threads_active[SRV_MASTER + 1]; ulint srv_n_threads[SRV_MASTER + 1]; +/************************************************************************* +Sets the info describing an i/o thread current state. */ + +void +srv_set_io_thread_op_info( +/*======================*/ + ulint i, /* in: the 'segment' of the i/o thread */ + const char* str) /* in: constant char string describing the + state */ +{ + ut_a(i < SRV_MAX_N_IO_THREADS); + + srv_io_thread_op_info[i] = str; +} /************************************************************************* Accessor function to get pointer to n'th slot in the server thread |