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 | |
parent | 0176dacd54b7eb62ebc4a81909b189517aee2cb4 (diff) | |
download | mariadb-git-7999a08c8af3b88900faa5723958305a9d70bebd.tar.gz |
updated
-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 | ||||
-rw-r--r-- | sql/ha_innobase.cc | 8 |
8 files changed, 99 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 afa40980264..1a37460569b 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 19d2fb744c9..6baa8f5825d 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 = "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); @@ -1423,6 +1439,8 @@ funct_exit: que_graph_free(graph); + trx_commit_for_mysql(trx); + trx->op_info = ""; return((int) err); @@ -1508,6 +1526,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); } @@ -1591,6 +1623,8 @@ funct_exit: que_graph_free(graph); + trx_commit_for_mysql(trx); + trx->op_info = ""; return((int) err); 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); diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 25c7757259a..de796dfa01e 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1466,7 +1466,9 @@ ha_innobase::write_row( The lock is released at each SQL statement's end. */ + srv_conc_enter_innodb(prebuilt->trx); error = row_lock_table_autoinc_for_mysql(prebuilt); + srv_conc_exit_innodb(); if (error != DB_SUCCESS) { @@ -1517,7 +1519,9 @@ ha_innobase::write_row( auto_inc = table->next_number_field->val_int(); + srv_conc_enter_innodb(prebuilt->trx); error = row_lock_table_autoinc_for_mysql(prebuilt); + srv_conc_exit_innodb(); if (error != DB_SUCCESS) { @@ -2799,6 +2803,8 @@ ha_innobase::delete_table( srv_active_wake_master_thread(); + trx_commit_for_mysql(trx); + trx_free_for_mysql(trx); error = convert_error_code_to_mysql(error); @@ -2852,6 +2858,7 @@ innobase_drop_database( srv_active_wake_master_thread(); + trx_commit_for_mysql(trx); trx_free_for_mysql(trx); error = convert_error_code_to_mysql(error); @@ -2904,6 +2911,7 @@ ha_innobase::rename_table( srv_active_wake_master_thread(); + trx_commit_for_mysql(trx); trx_free_for_mysql(trx); error = convert_error_code_to_mysql(error); |