Commit 4da72c2e authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

Merge marko@build.mysql.com:/home/bk/mysql-4.0

into hundin.mysql.fi:/home/marko/j/mysql-4.0
parents e00bf403 a169bfa6
......@@ -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);
}
}
......
......@@ -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! */
......
......@@ -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;
......@@ -2664,7 +2667,7 @@ consecutive_loop:
}
}
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]);
......
......@@ -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
......
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