summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2004-04-01 09:18:32 +0300
committerheikki@hundin.mysql.fi <>2004-04-01 09:18:32 +0300
commita169bfa6ae32648bcb97c78dd585767179eca1b7 (patch)
tree62e7e37e8481e3be563cd52348a9f2fe4e7d5d1c
parentf30da8edd5d89a9c1f2a133a6a342ce6ce226c20 (diff)
downloadmariadb-git-a169bfa6ae32648bcb97c78dd585767179eca1b7.tar.gz
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*
-rw-r--r--innobase/fil/fil0fil.c16
-rw-r--r--innobase/include/srv0srv.h13
-rw-r--r--innobase/os/os0file.c30
-rw-r--r--innobase/srv/srv0srv.c18
4 files changed, 43 insertions, 34 deletions
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index 35a028822c0..a363b3c462a 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -1331,8 +1331,7 @@ fil_aio_wait(
ut_ad(fil_validate());
if (os_aio_use_native_aio) {
- ut_a(segment < SRV_MAX_N_IO_THREADS);
- 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);
@@ -1343,8 +1342,7 @@ fil_aio_wait(
ut_error;
#endif
} else {
- ut_a(segment < SRV_MAX_N_IO_THREADS);
- 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);
@@ -1352,8 +1350,7 @@ fil_aio_wait(
ut_a(ret);
- ut_a(segment < SRV_MAX_N_IO_THREADS);
- 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));
@@ -1366,13 +1363,10 @@ fil_aio_wait(
/* Do the i/o handling */
if (buf_pool_is_block(message)) {
- ut_a(segment < SRV_MAX_N_IO_THREADS);
- 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 {
- ut_a(segment < SRV_MAX_N_IO_THREADS);
- 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 34dbf767773..acc6492fefc 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -1586,8 +1586,7 @@ os_aio_init(
os_io_init_simple();
for (i = 0; i < n_segments; i++) {
- ut_a(i < SRV_MAX_N_IO_THREADS);
- 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;
@@ -1598,24 +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++) {
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,
n_write_segs);
for (i = 2 + n_read_segs; i < n_segments; i++) {
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);
@@ -2330,9 +2329,7 @@ os_aio_windows_handle(
os_event_wait(os_aio_array_get_nth_slot(array, pos)->event);
i = pos;
} else {
- ut_a(orig_seg < SRV_MAX_N_IO_THREADS);
- 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);
}
@@ -2344,9 +2341,8 @@ os_aio_windows_handle(
ut_a(slot->reserved);
if (orig_seg != ULINT_UNDEFINED) {
- ut_a(orig_seg < SRV_MAX_N_IO_THREADS);
- srv_io_thread_op_info[orig_seg] =
- "get windows aio return value";
+ srv_set_io_thread_op_info(orig_seg,
+ "get windows aio return value");
}
ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE);
@@ -2671,8 +2667,7 @@ consecutive_loop:
}
}
- ut_a(global_segment < SRV_MAX_N_IO_THREADS);
- 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,
@@ -2722,8 +2717,7 @@ consecutive_loop:
}
ut_a(ret);
- ut_a(global_segment < SRV_MAX_N_IO_THREADS);
- 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
@@ -2781,9 +2775,7 @@ wait_for_io:
os_mutex_exit(array->mutex);
recommended_sleep:
- ut_a(global_segment < SRV_MAX_N_IO_THREADS);
- 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 0be0ab957af..ae7505dcd31 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