Commit a9fb96b2 authored by unknown's avatar unknown

fil0fil.c, os0file.c, srv0srv.h, srv0srv.c:

  Add an accessor function to set srv_io_thread_op_info, change the type to const char*, also change the type of srv_io_thread_function to const char*


innobase/srv/srv0srv.c:
  Add an accessor function to set srv_io_thread_op_info, change the type to const char*, also change the type of srv_io_thread_function to const char*
innobase/include/srv0srv.h:
  Add an accessor function to set srv_io_thread_op_info, change the type to const char*, also change the type of srv_io_thread_function to const char*
innobase/os/os0file.c:
  Add an accessor function to set srv_io_thread_op_info, change the type to const char*, also change the type of srv_io_thread_function to const char*
innobase/fil/fil0fil.c:
  Add an accessor function to set srv_io_thread_op_info, change the type to const char*, also change the type of srv_io_thread_function to const char*
parent f4b6dab2
...@@ -1331,8 +1331,7 @@ fil_aio_wait( ...@@ -1331,8 +1331,7 @@ fil_aio_wait(
ut_ad(fil_validate()); ut_ad(fil_validate());
if (os_aio_use_native_aio) { if (os_aio_use_native_aio) {
ut_a(segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(segment, "native aio handle");
srv_io_thread_op_info[segment] = (char *) "native aio handle";
#ifdef WIN_ASYNC_IO #ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, &fil_node, &message, ret = os_aio_windows_handle(segment, 0, &fil_node, &message,
&type); &type);
...@@ -1343,8 +1342,7 @@ fil_aio_wait( ...@@ -1343,8 +1342,7 @@ fil_aio_wait(
ut_error; ut_error;
#endif #endif
} else { } else {
ut_a(segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(segment, "simulated aio handle");
srv_io_thread_op_info[segment] =(char *)"simulated aio handle";
ret = os_aio_simulated_handle(segment, (void**) &fil_node, ret = os_aio_simulated_handle(segment, (void**) &fil_node,
&message, &type); &message, &type);
...@@ -1352,8 +1350,7 @@ fil_aio_wait( ...@@ -1352,8 +1350,7 @@ fil_aio_wait(
ut_a(ret); ut_a(ret);
ut_a(segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(segment, "complete io for fil node");
srv_io_thread_op_info[segment] = (char *) "complete io for fil node";
mutex_enter(&(system->mutex)); mutex_enter(&(system->mutex));
...@@ -1366,13 +1363,10 @@ fil_aio_wait( ...@@ -1366,13 +1363,10 @@ fil_aio_wait(
/* Do the i/o handling */ /* Do the i/o handling */
if (buf_pool_is_block(message)) { if (buf_pool_is_block(message)) {
ut_a(segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(segment, "complete io for buf page");
srv_io_thread_op_info[segment] =
(char *) "complete io for buf page";
buf_page_io_complete(message); buf_page_io_complete(message);
} else { } else {
ut_a(segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(segment, "complete io for log");
srv_io_thread_op_info[segment] =(char *) "complete io for log";
log_io_complete(message); log_io_complete(message);
} }
} }
......
...@@ -155,8 +155,8 @@ extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs, ...@@ -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 /* Array of English strings describing the current state of an
i/o handler thread */ i/o handler thread */
extern char* srv_io_thread_op_info[]; extern const char* srv_io_thread_op_info[];
extern char* srv_io_thread_function[]; extern const char* srv_io_thread_function[];
typedef struct srv_sys_struct srv_sys_t; typedef struct srv_sys_struct srv_sys_t;
...@@ -234,6 +234,15 @@ srv_get_thread_type(void); ...@@ -234,6 +234,15 @@ srv_get_thread_type(void);
/*=====================*/ /*=====================*/
/* out: SRV_COM, ... */ /* 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. Releases threads of the type given from suspension in the thread table.
NOTE! The server mutex has to be reserved by the caller! */ NOTE! The server mutex has to be reserved by the caller! */
......
...@@ -1586,8 +1586,7 @@ os_aio_init( ...@@ -1586,8 +1586,7 @@ os_aio_init(
os_io_init_simple(); os_io_init_simple();
for (i = 0; i < n_segments; i++) { for (i = 0; i < n_segments; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(i, "not started yet");
srv_io_thread_op_info[i] = (char*)"not started yet";
} }
n_per_seg = n / n_segments; n_per_seg = n / n_segments;
...@@ -1598,24 +1597,24 @@ os_aio_init( ...@@ -1598,24 +1597,24 @@ os_aio_init(
os_aio_ibuf_array = os_aio_array_create(n_per_seg, 1); 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); 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, os_aio_read_array = os_aio_array_create(n_read_segs * n_per_seg,
n_read_segs); n_read_segs);
for (i = 2; i < 2 + n_read_segs; i++) { for (i = 2; i < 2 + n_read_segs; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS); ut_a(i < SRV_MAX_N_IO_THREADS);
srv_io_thread_function[i] = (char*)"read thread"; srv_io_thread_function[i] = "read thread";
} }
os_aio_write_array = os_aio_array_create(n_write_segs * n_per_seg, os_aio_write_array = os_aio_array_create(n_write_segs * n_per_seg,
n_write_segs); n_write_segs);
for (i = 2 + n_read_segs; i < n_segments; i++) { for (i = 2 + n_read_segs; i < n_segments; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS); ut_a(i < SRV_MAX_N_IO_THREADS);
srv_io_thread_function[i] = (char*)"write thread"; srv_io_thread_function[i] = "write thread";
} }
os_aio_sync_array = os_aio_array_create(n_slots_sync, 1); os_aio_sync_array = os_aio_array_create(n_slots_sync, 1);
...@@ -2330,9 +2329,7 @@ os_aio_windows_handle( ...@@ -2330,9 +2329,7 @@ os_aio_windows_handle(
os_event_wait(os_aio_array_get_nth_slot(array, pos)->event); os_event_wait(os_aio_array_get_nth_slot(array, pos)->event);
i = pos; i = pos;
} else { } else {
ut_a(orig_seg < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(orig_seg, "wait Windows aio");
srv_io_thread_op_info[orig_seg] =
"wait Windows aio";
i = os_event_wait_multiple(n, i = os_event_wait_multiple(n,
(array->native_events) + segment * n); (array->native_events) + segment * n);
} }
...@@ -2344,9 +2341,8 @@ os_aio_windows_handle( ...@@ -2344,9 +2341,8 @@ os_aio_windows_handle(
ut_a(slot->reserved); ut_a(slot->reserved);
if (orig_seg != ULINT_UNDEFINED) { if (orig_seg != ULINT_UNDEFINED) {
ut_a(orig_seg < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(orig_seg,
srv_io_thread_op_info[orig_seg] = "get windows aio return value");
"get windows aio return value";
} }
ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE); ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE);
...@@ -2671,8 +2667,7 @@ consecutive_loop: ...@@ -2671,8 +2667,7 @@ consecutive_loop:
} }
} }
ut_a(global_segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(global_segment, "doing file i/o");
srv_io_thread_op_info[global_segment] = (char*) "doing file i/o";
if (os_aio_print_debug) { if (os_aio_print_debug) {
fprintf(stderr, fprintf(stderr,
...@@ -2722,8 +2717,7 @@ consecutive_loop: ...@@ -2722,8 +2717,7 @@ consecutive_loop:
} }
ut_a(ret); ut_a(ret);
ut_a(global_segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(global_segment, "file i/o done");
srv_io_thread_op_info[global_segment] = (char*) "file i/o done";
/* printf("aio: %lu consecutive %lu:th segment, first offs %lu blocks\n", /* printf("aio: %lu consecutive %lu:th segment, first offs %lu blocks\n",
n_consecutive, global_segment, slot->offset n_consecutive, global_segment, slot->offset
...@@ -2781,9 +2775,7 @@ wait_for_io: ...@@ -2781,9 +2775,7 @@ wait_for_io:
os_mutex_exit(array->mutex); os_mutex_exit(array->mutex);
recommended_sleep: recommended_sleep:
ut_a(global_segment < SRV_MAX_N_IO_THREADS); srv_set_io_thread_op_info(global_segment, "waiting for i/o request");
srv_io_thread_op_info[global_segment] =
(char*)"waiting for i/o request";
os_event_wait(os_aio_segment_wait_events[global_segment]); os_event_wait(os_aio_segment_wait_events[global_segment]);
......
...@@ -285,8 +285,8 @@ ulint srv_test_n_mutexes = ULINT_MAX; ...@@ -285,8 +285,8 @@ ulint srv_test_n_mutexes = ULINT_MAX;
/* Array of English strings describing the current state of an /* Array of English strings describing the current state of an
i/o handler thread */ i/o handler thread */
char* srv_io_thread_op_info[SRV_MAX_N_IO_THREADS]; const 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_function[SRV_MAX_N_IO_THREADS];
time_t srv_last_monitor_time; time_t srv_last_monitor_time;
...@@ -514,6 +514,20 @@ are indexed by the type of the thread. */ ...@@ -514,6 +514,20 @@ are indexed by the type of the thread. */
ulint srv_n_threads_active[SRV_MASTER + 1]; ulint srv_n_threads_active[SRV_MASTER + 1];
ulint srv_n_threads[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 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