Commit e84ef2b7 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi

updated

parent 65d4c846
......@@ -163,7 +163,7 @@ os_fast_mutex_trylock(
#endif
/**************************************************************
Releases ownership of a fast mutex. */
UNIV_INLINE
void
os_fast_mutex_unlock(
/*=================*/
......
......@@ -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
}
......@@ -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;
......
......@@ -454,6 +454,21 @@ os_fast_mutex_lock(
#endif
}
/**************************************************************
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. */
......
......@@ -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 @@ row_drop_table_for_mysql(
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 @@ row_rename_table_for_mysql(
que_graph_free(graph);
trx_commit_for_mysql(trx);
trx->op_info = "";
return((int) err);
......
......@@ -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 @@ srv_lock_timeout_and_monitor_thread(
"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 @@ srv_lock_timeout_and_monitor_thread(
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 @@ srv_lock_timeout_and_monitor_thread(
"=======================================\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 @@ srv_error_monitor_thread(
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;
......
......@@ -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);
......
......@@ -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);
......
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