diff options
author | unknown <monty@hundin.mysql.fi> | 2001-11-07 00:19:36 +0200 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-11-07 00:19:36 +0200 |
commit | d207a0c2f022d0a65e95cddf8a1dc957f0e0a34e (patch) | |
tree | f1c7979e7d8282f034f3cabdfe558293a7f7c2f4 /innobase | |
parent | 228408a8c54e34922832082c0e36c1e87f224873 (diff) | |
parent | 3c0487c4c31c516c745a020f2c1b2e836cb28d86 (diff) | |
download | mariadb-git-d207a0c2f022d0a65e95cddf8a1dc957f0e0a34e.tar.gz |
merge
innobase/include/srv0srv.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
innobase/srv/srv0srv.c:
Auto merged
innobase/srv/srv0start.c:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
sql/ha_innobase.cc:
Auto merged
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/include/os0sync.h | 2 | ||||
-rw-r--r-- | innobase/include/os0sync.ic | 14 | ||||
-rw-r--r-- | innobase/include/srv0srv.h | 3 | ||||
-rw-r--r-- | innobase/os/os0sync.c | 15 | ||||
-rw-r--r-- | innobase/row/row0mysql.c | 34 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 47 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 7 |
7 files changed, 91 insertions, 31 deletions
diff --git a/innobase/include/os0sync.h b/innobase/include/os0sync.h index 26f7dff5d8b..617f6b036fe 100644 --- a/innobase/include/os0sync.h +++ b/innobase/include/os0sync.h @@ -163,7 +163,7 @@ os_fast_mutex_trylock( #endif /************************************************************** Releases ownership of a fast mutex. */ -UNIV_INLINE + void os_fast_mutex_unlock( /*=================*/ diff --git a/innobase/include/os0sync.ic b/innobase/include/os0sync.ic index 057ad424dee..aa00300dec5 100644 --- a/innobase/include/os0sync.ic +++ b/innobase/include/os0sync.ic @@ -40,17 +40,3 @@ os_fast_mutex_trylock( } #endif -/************************************************************** -Releases ownership of a fast mutex. */ -UNIV_INLINE -void -os_fast_mutex_unlock( -/*=================*/ - os_fast_mutex_t* fast_mutex) /* in: mutex to release */ -{ -#ifdef __WIN__ - LeaveCriticalSection(fast_mutex); -#else - pthread_mutex_unlock(fast_mutex); -#endif -} diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index df8e85d05f7..bae0aa89da9 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -66,6 +66,9 @@ extern char* srv_unix_file_flush_method_str; extern ulint srv_unix_file_flush_method; extern ulint srv_force_recovery; extern ulint srv_thread_concurrency; + +extern lint srv_conc_n_threads; + extern ibool srv_fast_shutdown; extern ibool srv_use_doublewrite_buf; diff --git a/innobase/os/os0sync.c b/innobase/os/os0sync.c index 8da142cd4a6..2cf5160d055 100644 --- a/innobase/os/os0sync.c +++ b/innobase/os/os0sync.c @@ -455,6 +455,21 @@ os_fast_mutex_lock( } /************************************************************** +Releases ownership of a fast mutex. */ + +void +os_fast_mutex_unlock( +/*=================*/ + os_fast_mutex_t* fast_mutex) /* in: mutex to release */ +{ +#ifdef __WIN__ + LeaveCriticalSection(fast_mutex); +#else + pthread_mutex_unlock(fast_mutex); +#endif +} + +/************************************************************** Frees a mutex object. */ void diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 45de25437e1..3b7275da8d7 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -946,11 +946,27 @@ row_create_table_for_mysql( "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n" "InnoDB: with raw, and innodb_force_... is removed.\n"); + trx_commit_for_mysql(trx); + return(DB_ERROR); } trx->op_info = (char *) "creating table"; + if (0 == ut_strcmp(table->name, "mysql/host") + || 0 == ut_strcmp(table->name, "mysql/user") + || 0 == ut_strcmp(table->name, "mysql/db")) { + + fprintf(stderr, + "InnoDB: Error: trying to create a MySQL system table %s of type InnoDB.\n" + "InnoDB: MySQL system tables must be of the MyISAM type!\n", + table->name); + + trx_commit_for_mysql(trx); + + return(DB_ERROR); + } + trx_start_if_not_started(trx); namelen = ut_strlen(table->name); @@ -1428,6 +1444,8 @@ funct_exit: que_graph_free(graph); + trx_commit_for_mysql(trx); + trx->op_info = (char *) ""; return((int) err); @@ -1513,6 +1531,20 @@ row_rename_table_for_mysql( "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n" "InnoDB: with raw, and innodb_force_... is removed.\n"); + trx_commit_for_mysql(trx); + return(DB_ERROR); + } + + if (0 == ut_strcmp(new_name, "mysql/host") + || 0 == ut_strcmp(new_name, "mysql/user") + || 0 == ut_strcmp(new_name, "mysql/db")) { + + fprintf(stderr, + "InnoDB: Error: trying to create a MySQL system table %s of type InnoDB.\n" + "InnoDB: MySQL system tables must be of the MyISAM type!\n", + new_name); + + trx_commit_for_mysql(trx); return(DB_ERROR); } @@ -1596,6 +1628,8 @@ funct_exit: que_graph_free(graph); + trx_commit_for_mysql(trx); + trx->op_info = (char *) ""; return((int) err); diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index a9de3418eb7..7f90c295b41 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{ @@ -1646,7 +1651,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); @@ -1654,7 +1659,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; @@ -1734,11 +1739,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 */ @@ -1985,16 +1988,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; @@ -2056,7 +2061,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", @@ -2083,12 +2088,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); @@ -2105,7 +2111,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"); @@ -2208,7 +2217,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 a6e11364d67..702386a1a99 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1004,6 +1004,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); |