Commit 2145103a authored by tsmith/tim@siva.hindu.god's avatar tsmith/tim@siva.hindu.god

Merge siva.hindu.god:/usr/home/tim/m/bk/50-release

into  siva.hindu.god:/usr/home/tim/m/bk/50-build
parents 534b2ca0 d60550a4
...@@ -27,6 +27,9 @@ Created 1/8/1996 Heikki Tuuri ...@@ -27,6 +27,9 @@ Created 1/8/1996 Heikki Tuuri
#include "que0que.h" #include "que0que.h"
#include "rem0cmp.h" #include "rem0cmp.h"
/* Implement isspace() in a locale-independent way. (Bug #24299) */
#define ib_isspace(c) strchr(" \v\f\t\r\n", c)
dict_sys_t* dict_sys = NULL; /* the dictionary system */ dict_sys_t* dict_sys = NULL; /* the dictionary system */
rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
...@@ -2406,7 +2409,7 @@ dict_accept( ...@@ -2406,7 +2409,7 @@ dict_accept(
*success = FALSE; *success = FALSE;
while (isspace(*ptr)) { while (ib_isspace(*ptr)) {
ptr++; ptr++;
} }
...@@ -2451,7 +2454,7 @@ dict_scan_id( ...@@ -2451,7 +2454,7 @@ dict_scan_id(
*id = NULL; *id = NULL;
while (isspace(*ptr)) { while (ib_isspace(*ptr)) {
ptr++; ptr++;
} }
...@@ -2482,7 +2485,7 @@ dict_scan_id( ...@@ -2482,7 +2485,7 @@ dict_scan_id(
len++; len++;
} }
} else { } else {
while (!isspace(*ptr) && *ptr != '(' && *ptr != ')' while (!ib_isspace(*ptr) && *ptr != '(' && *ptr != ')'
&& (accept_also_dot || *ptr != '.') && (accept_also_dot || *ptr != '.')
&& *ptr != ',' && *ptr != '\0') { && *ptr != ',' && *ptr != '\0') {
...@@ -2512,12 +2515,12 @@ dict_scan_id( ...@@ -2512,12 +2515,12 @@ dict_scan_id(
if (heap && !quote) { if (heap && !quote) {
/* EMS MySQL Manager sometimes adds characters 0xA0 (in /* EMS MySQL Manager sometimes adds characters 0xA0 (in
latin1, a 'non-breakable space') to the end of a table name. latin1, a 'non-breakable space') to the end of a table name.
But isspace(0xA0) is not true, which confuses our foreign key After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2
parser. After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2 and 0xA0 are at the end of the string, and ib_isspace()
and 0xA0 are at the end of the string. does not work for multi-byte UTF-8 characters.
TODO: we should lex the string using thd->charset_info, and In MySQL 5.1 we lex the string using thd->charset_info, and
my_isspace(). Only after that, convert id names to UTF-8. */ my_isspace(). This workaround is not needed there. */
b = (byte*)(*id); b = (byte*)(*id);
id_len = strlen((char*) b); id_len = strlen((char*) b);
...@@ -3006,11 +3009,11 @@ loop: ...@@ -3006,11 +3009,11 @@ loop:
ut_a(success); ut_a(success);
if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') { if (!ib_isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop; goto loop;
} }
while (isspace(*ptr)) { while (ib_isspace(*ptr)) {
ptr++; ptr++;
} }
...@@ -3052,7 +3055,7 @@ loop: ...@@ -3052,7 +3055,7 @@ loop:
goto loop; goto loop;
} }
if (!isspace(*ptr)) { if (!ib_isspace(*ptr)) {
goto loop; goto loop;
} }
...@@ -3140,7 +3143,7 @@ col_loop1: ...@@ -3140,7 +3143,7 @@ col_loop1:
} }
ptr = dict_accept(ptr, "REFERENCES", &success); ptr = dict_accept(ptr, "REFERENCES", &success);
if (!success || !isspace(*ptr)) { if (!success || !ib_isspace(*ptr)) {
dict_foreign_report_syntax_err(name, start_of_latest_foreign, dict_foreign_report_syntax_err(name, start_of_latest_foreign,
ptr); ptr);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
...@@ -3527,7 +3530,7 @@ loop: ...@@ -3527,7 +3530,7 @@ loop:
ptr = dict_accept(ptr, "DROP", &success); ptr = dict_accept(ptr, "DROP", &success);
if (!isspace(*ptr)) { if (!ib_isspace(*ptr)) {
goto loop; goto loop;
} }
......
...@@ -61,8 +61,12 @@ Creates, or rather, initializes an rw-lock object in a specified memory ...@@ -61,8 +61,12 @@ Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */ is necessary only if the memory block containing it is freed. */
#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__, #L) #ifdef UNIV_DEBUG
# define rw_lock_create(L) rw_lock_create_func((L), #L, __FILE__, __LINE__)
#else /* UNIV_DEBUG */
# define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__)
#endif /* UNIV_DEBUG */
/*=====================*/ /*=====================*/
/********************************************************************** /**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory Creates, or rather, initializes an rw-lock object in a specified memory
...@@ -74,9 +78,11 @@ void ...@@ -74,9 +78,11 @@ void
rw_lock_create_func( rw_lock_create_func(
/*================*/ /*================*/
rw_lock_t* lock, /* in: pointer to memory */ rw_lock_t* lock, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline); /* in: file line where created */
const char* cmutex_name); /* in: mutex name */
/********************************************************************** /**********************************************************************
Calling this function is obligatory only if the memory buffer containing Calling this function is obligatory only if the memory buffer containing
the rw-lock is freed. Removes an rw-lock object from the global list. The the rw-lock is freed. Removes an rw-lock object from the global list. The
......
...@@ -39,7 +39,11 @@ location (which must be appropriately aligned). The mutex is initialized ...@@ -39,7 +39,11 @@ location (which must be appropriately aligned). The mutex is initialized
in the reset state. Explicit freeing of the mutex with mutex_free is in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */ necessary only if the memory block containing it is freed. */
#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__, #M) #ifdef UNIV_DEBUG
# define mutex_create(M) mutex_create_func((M), #M, __FILE__, __LINE__)
#else
# define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__)
#endif
/*===================*/ /*===================*/
/********************************************************************** /**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory Creates, or rather, initializes a mutex object in a specified memory
...@@ -51,9 +55,11 @@ void ...@@ -51,9 +55,11 @@ void
mutex_create_func( mutex_create_func(
/*==============*/ /*==============*/
mutex_t* mutex, /* in: pointer to memory */ mutex_t* mutex, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline); /* in: file line where created */
const char* cmutex_name); /* in: mutex name */
/********************************************************************** /**********************************************************************
Calling this function is obligatory only if the memory buffer containing Calling this function is obligatory only if the memory buffer containing
the mutex is freed. Removes a mutex object from the mutex list. The mutex the mutex is freed. Removes a mutex object from the mutex list. The mutex
...@@ -479,15 +485,17 @@ struct mutex_struct { ...@@ -479,15 +485,17 @@ struct mutex_struct {
ulint cline; /* Line where created */ ulint cline; /* Line where created */
ulint magic_n; ulint magic_n;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
ulong count_using; /* count of times mutex used */ ulong count_os_wait; /* count of os_wait */
ulong count_spin_loop; /* count of spin loops */ # ifdef UNIV_DEBUG
ulong count_spin_rounds; /* count of spin rounds */ ulong count_using; /* count of times mutex used */
ulong count_os_wait; /* count of os_wait */ ulong count_spin_loop; /* count of spin loops */
ulong count_os_yield; /* count of os_wait */ ulong count_spin_rounds; /* count of spin rounds */
ulonglong lspent_time; /* mutex os_wait timer msec */ ulong count_os_yield; /* count of os_wait */
ulonglong lmax_spent_time; /* mutex os_wait timer msec */ ulonglong lspent_time; /* mutex os_wait timer msec */
const char* cmutex_name;/* mutex name */ ulonglong lmax_spent_time; /* mutex os_wait timer msec */
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */ const char* cmutex_name;/* mutex name */
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
}; };
......
...@@ -250,9 +250,9 @@ mutex_enter_func( ...@@ -250,9 +250,9 @@ mutex_enter_func(
/* Note that we do not peek at the value of lock_word before trying /* Note that we do not peek at the value of lock_word before trying
the atomic test_and_set; we could peek, and possibly save time. */ the atomic test_and_set; we could peek, and possibly save time. */
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_using++; mutex->count_using++;
#endif /* UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex)) if (!mutex_test_and_set(mutex))
{ {
......
...@@ -33,6 +33,7 @@ Created 9/20/1997 Heikki Tuuri ...@@ -33,6 +33,7 @@ Created 9/20/1997 Heikki Tuuri
#include "btr0cur.h" #include "btr0cur.h"
#include "dict0boot.h" #include "dict0boot.h"
#include "fil0fil.h" #include "fil0fil.h"
#include "sync0sync.h"
#ifdef UNIV_HOTBACKUP #ifdef UNIV_HOTBACKUP
/* This is set to FALSE if the backup was originally taken with the /* This is set to FALSE if the backup was originally taken with the
...@@ -2969,6 +2970,15 @@ recv_recovery_from_checkpoint_finish(void) ...@@ -2969,6 +2970,15 @@ recv_recovery_from_checkpoint_finish(void)
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
recv_sys_free(); recv_sys_free();
#endif #endif
#ifdef UNIV_SYNC_DEBUG
/* Wait for a while so that created threads have time to suspend
themselves before we switch the latching order checks on */
os_thread_sleep(1000000);
/* Switch latching order checks on in sync0sync.c */
sync_order_checks_on = TRUE;
#endif
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
/* Rollback the uncommitted transactions which have no user /* Rollback the uncommitted transactions which have no user
session */ session */
......
...@@ -1554,17 +1554,6 @@ innobase_start_or_create_for_mysql(void) ...@@ -1554,17 +1554,6 @@ innobase_start_or_create_for_mysql(void)
srv_was_started = TRUE; srv_was_started = TRUE;
srv_is_being_started = FALSE; srv_is_being_started = FALSE;
#ifdef UNIV_DEBUG
/* Wait a while so that the created threads have time to suspend
themselves before we switch sync debugging on; otherwise a thread may
execute mutex_enter() before the checks are on, and mutex_exit() after
the checks are on, which will cause an assertion failure in sync
debug. */
os_thread_sleep(3000000);
#endif
sync_order_checks_on = TRUE;
if (trx_doublewrite == NULL) { if (trx_doublewrite == NULL) {
/* Create the doublewrite buffer to a new tablespace */ /* Create the doublewrite buffer to a new tablespace */
......
...@@ -89,9 +89,11 @@ void ...@@ -89,9 +89,11 @@ void
rw_lock_create_func( rw_lock_create_func(
/*================*/ /*================*/
rw_lock_t* lock, /* in: pointer to memory */ rw_lock_t* lock, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline) /* in: file line where created */
const char* cmutex_name) /* in: mutex name */
{ {
/* If this is the very first time a synchronization /* If this is the very first time a synchronization
object is created, then the following call initializes object is created, then the following call initializes
...@@ -102,10 +104,10 @@ rw_lock_create_func( ...@@ -102,10 +104,10 @@ rw_lock_create_func(
lock->mutex.cfile_name = cfile_name; lock->mutex.cfile_name = cfile_name;
lock->mutex.cline = cline; lock->mutex.cline = cline;
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
lock->mutex.cmutex_name = cmutex_name; lock->mutex.cmutex_name = cmutex_name;
lock->mutex.mutex_type = 1; lock->mutex.mutex_type = 1;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
rw_lock_set_waiters(lock, 0); rw_lock_set_waiters(lock, 0);
rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED); rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED);
......
...@@ -202,9 +202,11 @@ void ...@@ -202,9 +202,11 @@ void
mutex_create_func( mutex_create_func(
/*==============*/ /*==============*/
mutex_t* mutex, /* in: pointer to memory */ mutex_t* mutex, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline) /* in: file line where created */
const char* cmutex_name) /* in: mutex name */
{ {
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER) #if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
mutex_reset_lock_word(mutex); mutex_reset_lock_word(mutex);
...@@ -223,6 +225,8 @@ mutex_create_func( ...@@ -223,6 +225,8 @@ mutex_create_func(
mutex->cfile_name = cfile_name; mutex->cfile_name = cfile_name;
mutex->cline = cline; mutex->cline = cline;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
mutex->count_os_wait = 0;
# ifdef UNIV_DEBUG
mutex->cmutex_name= cmutex_name; mutex->cmutex_name= cmutex_name;
mutex->count_using= 0; mutex->count_using= 0;
mutex->mutex_type= 0; mutex->mutex_type= 0;
...@@ -230,8 +234,8 @@ mutex_create_func( ...@@ -230,8 +234,8 @@ mutex_create_func(
mutex->lmax_spent_time= 0; mutex->lmax_spent_time= 0;
mutex->count_spin_loop= 0; mutex->count_spin_loop= 0;
mutex->count_spin_rounds= 0; mutex->count_spin_rounds= 0;
mutex->count_os_wait= 0;
mutex->count_os_yield= 0; mutex->count_os_yield= 0;
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/* Check that lock_word is aligned; this is important on Intel */ /* Check that lock_word is aligned; this is important on Intel */
...@@ -378,13 +382,13 @@ mutex_spin_wait( ...@@ -378,13 +382,13 @@ mutex_spin_wait(
{ {
ulint index; /* index of the reserved wait cell */ ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */ ulint i; /* spin round count */
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */ ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff; ulint ltime_diff;
ulint sec; ulint sec;
ulint ms; ulint ms;
uint timer_started = 0; uint timer_started = 0;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
ut_ad(mutex); ut_ad(mutex);
mutex_loop: mutex_loop:
...@@ -398,10 +402,10 @@ mutex_loop: ...@@ -398,10 +402,10 @@ mutex_loop:
memory word. */ memory word. */
spin_loop: spin_loop:
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex_spin_wait_count++; mutex_spin_wait_count++;
mutex->count_spin_loop++; mutex->count_spin_loop++;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS)
{ {
...@@ -415,7 +419,7 @@ spin_loop: ...@@ -415,7 +419,7 @@ spin_loop:
if (i == SYNC_SPIN_ROUNDS) if (i == SYNC_SPIN_ROUNDS)
{ {
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_os_yield++; mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0) if (timed_mutexes == 1 && timer_started==0)
{ {
...@@ -423,7 +427,7 @@ spin_loop: ...@@ -423,7 +427,7 @@ spin_loop:
lstart_time= (ib_longlong)sec * 1000000 + ms; lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1; timer_started = 1;
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
os_thread_yield(); os_thread_yield();
} }
...@@ -436,9 +440,9 @@ spin_loop: ...@@ -436,9 +440,9 @@ spin_loop:
mutex_spin_round_count += i; mutex_spin_round_count += i;
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_spin_rounds += i; mutex->count_spin_rounds += i;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (mutex_test_and_set(mutex) == 0) if (mutex_test_and_set(mutex) == 0)
{ {
...@@ -522,6 +526,7 @@ Now there is no risk of infinite wait on the event. */ ...@@ -522,6 +526,7 @@ Now there is no risk of infinite wait on the event. */
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
mutex->count_os_wait++; mutex->count_os_wait++;
# ifdef UNIV_DEBUG
/* /*
!!!!! Sometimes os_wait can be called without os_thread_yield !!!!! Sometimes os_wait can be called without os_thread_yield
*/ */
...@@ -532,13 +537,14 @@ Now there is no risk of infinite wait on the event. */ ...@@ -532,13 +537,14 @@ Now there is no risk of infinite wait on the event. */
lstart_time= (ib_longlong)sec * 1000000 + ms; lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1; timer_started = 1;
} }
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
sync_array_wait_event(sync_primary_wait_array, index); sync_array_wait_event(sync_primary_wait_array, index);
goto mutex_loop; goto mutex_loop;
finish_timing: finish_timing:
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
if (timed_mutexes == 1 && timer_started==1) if (timed_mutexes == 1 && timer_started==1)
{ {
ut_usectime(&sec, &ms); ut_usectime(&sec, &ms);
...@@ -551,7 +557,7 @@ finish_timing: ...@@ -551,7 +557,7 @@ finish_timing:
mutex->lmax_spent_time= ltime_diff; mutex->lmax_spent_time= ltime_diff;
} }
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
return; return;
} }
......
...@@ -129,9 +129,27 @@ trx_rollback_for_mysql( ...@@ -129,9 +129,27 @@ trx_rollback_for_mysql(
} }
trx->op_info = "rollback"; trx->op_info = "rollback";
/* If we are doing the XA recovery of prepared transactions, then
the transaction object does not have an InnoDB session object, and we
set a dummy session that we use for all MySQL transactions. */
err = trx_general_rollback_for_mysql(trx, FALSE, NULL); mutex_enter(&kernel_mutex);
if (trx->sess == NULL) {
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open();
}
trx->sess = trx_dummy_sess;
}
mutex_exit(&kernel_mutex);
err = trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->op_info = ""; trx->op_info = "";
return(err); return(err);
......
...@@ -1601,7 +1601,25 @@ trx_commit_for_mysql( ...@@ -1601,7 +1601,25 @@ trx_commit_for_mysql(
ut_a(trx); ut_a(trx);
trx->op_info = "committing"; trx->op_info = "committing";
/* If we are doing the XA recovery of prepared transactions, then
the transaction object does not have an InnoDB session object, and we
set the dummy session that we use for all MySQL transactions. */
mutex_enter(&kernel_mutex);
if (trx->sess == NULL) {
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open();
}
trx->sess = trx_dummy_sess;
}
mutex_exit(&kernel_mutex);
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
......
...@@ -5308,19 +5308,11 @@ ha_innobase::info( ...@@ -5308,19 +5308,11 @@ ha_innobase::info(
prebuilt->trx->op_info = (char*) prebuilt->trx->op_info = (char*)
"returning various info to MySQL"; "returning various info to MySQL";
my_snprintf(path, sizeof(path), "%s/%s%s",
if (ib_table->space != 0) {
my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name,
".ibd");
unpack_filename(path,path);
} else {
my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name, mysql_data_home, ib_table->name,
reg_ext); reg_ext);
unpack_filename(path,path); unpack_filename(path,path);
}
/* Note that we do not know the access time of the table, /* Note that we do not know the access time of the table,
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
...@@ -6377,14 +6369,17 @@ innodb_mutex_show_status( ...@@ -6377,14 +6369,17 @@ innodb_mutex_show_status(
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
List<Item> field_list; List<Item> field_list;
mutex_t* mutex; mutex_t* mutex;
#ifdef UNIV_DEBUG
ulint rw_lock_count= 0; ulint rw_lock_count= 0;
ulint rw_lock_count_spin_loop= 0; ulint rw_lock_count_spin_loop= 0;
ulint rw_lock_count_spin_rounds= 0; ulint rw_lock_count_spin_rounds= 0;
ulint rw_lock_count_os_wait= 0; ulint rw_lock_count_os_wait= 0;
ulint rw_lock_count_os_yield= 0; ulint rw_lock_count_os_yield= 0;
ulonglong rw_lock_wait_time= 0; ulonglong rw_lock_wait_time= 0;
#endif /* UNIV_DEBUG */
DBUG_ENTER("innodb_mutex_show_status"); DBUG_ENTER("innodb_mutex_show_status");
#ifdef UNIV_DEBUG
field_list.push_back(new Item_empty_string("Mutex", FN_REFLEN)); field_list.push_back(new Item_empty_string("Mutex", FN_REFLEN));
field_list.push_back(new Item_empty_string("Module", FN_REFLEN)); field_list.push_back(new Item_empty_string("Module", FN_REFLEN));
field_list.push_back(new Item_uint("Count", 21)); field_list.push_back(new Item_uint("Count", 21));
...@@ -6393,19 +6388,23 @@ innodb_mutex_show_status( ...@@ -6393,19 +6388,23 @@ innodb_mutex_show_status(
field_list.push_back(new Item_uint("OS_waits", 21)); field_list.push_back(new Item_uint("OS_waits", 21));
field_list.push_back(new Item_uint("OS_yields", 21)); field_list.push_back(new Item_uint("OS_yields", 21));
field_list.push_back(new Item_uint("OS_waits_time", 21)); field_list.push_back(new Item_uint("OS_waits_time", 21));
#else /* UNIV_DEBUG */
field_list.push_back(new Item_empty_string("File", FN_REFLEN));
field_list.push_back(new Item_uint("Line", 21));
field_list.push_back(new Item_uint("OS_waits", 21));
#endif /* UNIV_DEBUG */
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER mutex_enter_noninline(&mutex_list_mutex);
mutex_enter(&mutex_list_mutex);
#endif
mutex = UT_LIST_GET_FIRST(mutex_list); mutex = UT_LIST_GET_FIRST(mutex_list);
while ( mutex != NULL ) while ( mutex != NULL )
{ {
#ifdef UNIV_DEBUG
if (mutex->mutex_type != 1) if (mutex->mutex_type != 1)
{ {
if (mutex->count_using > 0) if (mutex->count_using > 0)
...@@ -6422,9 +6421,7 @@ innodb_mutex_show_status( ...@@ -6422,9 +6421,7 @@ innodb_mutex_show_status(
if (protocol->write()) if (protocol->write())
{ {
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER mutex_exit_noninline(&mutex_list_mutex);
mutex_exit(&mutex_list_mutex);
#endif
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
...@@ -6438,10 +6435,25 @@ innodb_mutex_show_status( ...@@ -6438,10 +6435,25 @@ innodb_mutex_show_status(
rw_lock_count_os_yield += mutex->count_os_yield; rw_lock_count_os_yield += mutex->count_os_yield;
rw_lock_wait_time += mutex->lspent_time; rw_lock_wait_time += mutex->lspent_time;
} }
#else /* UNIV_DEBUG */
protocol->prepare_for_resend();
protocol->store(mutex->cfile_name, system_charset_info);
protocol->store((ulonglong)mutex->cline);
protocol->store((ulonglong)mutex->count_os_wait);
if (protocol->write())
{
mutex_exit_noninline(&mutex_list_mutex);
DBUG_RETURN(1);
}
#endif /* UNIV_DEBUG */
mutex = UT_LIST_GET_NEXT(list, mutex); mutex = UT_LIST_GET_NEXT(list, mutex);
} }
mutex_exit_noninline(&mutex_list_mutex);
#ifdef UNIV_DEBUG
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store("rw_lock_mutexes", system_charset_info); protocol->store("rw_lock_mutexes", system_charset_info);
protocol->store("", system_charset_info); protocol->store("", system_charset_info);
...@@ -6456,10 +6468,8 @@ innodb_mutex_show_status( ...@@ -6456,10 +6468,8 @@ innodb_mutex_show_status(
{ {
DBUG_RETURN(1); DBUG_RETURN(1);
} }
#endif /* UNIV_DEBUG */
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
mutex_exit(&mutex_list_mutex);
#endif
send_eof(thd); send_eof(thd);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
......
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