diff options
author | unknown <heikki@donna.mysql.fi> | 2001-11-05 18:50:12 +0200 |
---|---|---|
committer | unknown <heikki@donna.mysql.fi> | 2001-11-05 18:50:12 +0200 |
commit | 7999a08c8af3b88900faa5723958305a9d70bebd (patch) | |
tree | 7b2d5da1cb03b0cdc431ed72d65424ecc17a3c8e /innobase/srv | |
parent | 0176dacd54b7eb62ebc4a81909b189517aee2cb4 (diff) | |
download | mariadb-git-7999a08c8af3b88900faa5723958305a9d70bebd.tar.gz |
updated
Diffstat (limited to 'innobase/srv')
-rw-r--r-- | innobase/srv/srv0srv.c | 47 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 7 |
2 files changed, 38 insertions, 16 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index cff2479e2b5..bebb0b1f8ea 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -121,12 +121,17 @@ semaphore contention and convoy problems can occur withput this restriction. Value 10 should be good if there are less than 4 processors + 4 disks in the computer. Bigger computers need bigger values. */ -ulint srv_thread_concurrency = 4; +ulint srv_thread_concurrency = 8; os_fast_mutex_t srv_conc_mutex; /* this mutex protects srv_conc data structures */ -ulint srv_conc_n_threads = 0; /* number of OS threads currently - inside InnoDB */ +lint srv_conc_n_threads = 0; /* number of OS threads currently + inside InnoDB; it is not an error + if this drops temporarily below zero + because we do not demand that every + thread increments this, but a thread + waiting for a lock decrements this + temporarily */ typedef struct srv_conc_slot_struct srv_conc_slot_t; struct srv_conc_slot_struct{ @@ -1637,7 +1642,7 @@ srv_conc_enter_innodb( os_fast_mutex_lock(&srv_conc_mutex); - if (srv_conc_n_threads < srv_thread_concurrency) { + if (srv_conc_n_threads < (lint)srv_thread_concurrency) { srv_conc_n_threads++; os_fast_mutex_unlock(&srv_conc_mutex); @@ -1645,7 +1650,7 @@ srv_conc_enter_innodb( return; } - /* Too many threads inside: put to the current thread to a queue */ + /* Too many threads inside: put the current thread to a queue */ for (i = 0; i < OS_THREAD_MAX_N; i++) { slot = srv_conc_slots + i; @@ -1725,11 +1730,9 @@ srv_conc_exit_innodb(void) os_fast_mutex_lock(&srv_conc_mutex); - ut_a(srv_conc_n_threads > 0); - srv_conc_n_threads--; - if (srv_conc_n_threads < srv_thread_concurrency) { + if (srv_conc_n_threads < (lint)srv_thread_concurrency) { /* Look for a slot where a thread is waiting and no other thread has yet released the thread */ @@ -1976,16 +1979,18 @@ srv_lock_timeout_and_monitor_thread( void* arg) /* in: a dummy parameter required by os_thread_create */ { + srv_slot_t* slot; double time_elapsed; time_t current_time; time_t last_monitor_time; + time_t last_table_monitor_time; ibool some_waits; - srv_slot_t* slot; double wait_time; ulint i; UT_NOT_USED(arg); last_monitor_time = time(NULL); + last_table_monitor_time = time(NULL); loop: srv_lock_timeout_and_monitor_active = TRUE; @@ -2047,7 +2052,7 @@ loop: "ROW OPERATIONS\n" "--------------\n"); printf( - "%lu queries inside InnoDB; main thread: %s\n", + "%ld queries inside InnoDB; main thread: %s\n", srv_conc_n_threads, srv_main_thread_op_info); printf( "Number of rows inserted %lu, updated %lu, deleted %lu, read %lu\n", @@ -2074,12 +2079,13 @@ loop: printf("----------------------------\n" "END OF INNODB MONITOR OUTPUT\n" "============================\n"); - - } - if (srv_print_innodb_tablespace_monitor) { - + if (srv_print_innodb_tablespace_monitor + && difftime(current_time, last_table_monitor_time) > 60) { + + last_table_monitor_time = time(NULL); + printf("================================================\n"); ut_print_timestamp(stdout); @@ -2096,7 +2102,10 @@ loop: "=======================================\n"); } - if (srv_print_innodb_table_monitor) { + if (srv_print_innodb_table_monitor + && difftime(current_time, last_table_monitor_time) > 60) { + + last_table_monitor_time = time(NULL); printf("===========================================\n"); @@ -2199,7 +2208,13 @@ loop: os_thread_sleep(10000000); sync_array_print_long_waits(); - + + /* Flush stdout and stderr so that a database user gets their output + to possible MySQL error file */ + + fflush(stderr); + fflush(stdout); + if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) { goto loop; diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index c42c4ecf8fe..b469eca9e7e 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -996,6 +996,13 @@ innobase_shutdown_for_mysql(void) logs_empty_and_mark_files_at_shutdown(); + if (srv_conc_n_threads != 0) { + fprintf(stderr, + "InnoDB: Warning: query counter shows %ld queries still\n" + "InnoDB: inside InnoDB at shutdown\n", + srv_conc_n_threads); + } + ut_free_all_mem(); return((int) DB_SUCCESS); |