summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc55
1 files changed, 36 insertions, 19 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 5548cb66e7f..456fd27d9d9 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -173,6 +173,7 @@ my_bool innobase_use_large_pages = FALSE;
my_bool innobase_use_native_aio = FALSE;
my_bool innobase_file_per_table = FALSE;
my_bool innobase_locks_unsafe_for_binlog = FALSE;
+my_bool innobase_rollback_on_timeout = FALSE;
my_bool innobase_create_status_file = FALSE;
static char *internal_innobase_data_file_path = NULL;
@@ -467,6 +468,10 @@ convert_error_code_to_mysql(
latest SQL statement in a lock wait timeout. Previously, we
rolled back the whole transaction. */
+ if (thd && row_rollback_on_timeout) {
+ ha_rollback(thd);
+ }
+
return(HA_ERR_LOCK_WAIT_TIMEOUT);
} else if (error == (int) DB_NO_REFERENCED_ROW) {
@@ -1380,6 +1385,8 @@ innobase_init(void)
os_use_large_pages = (ibool) innobase_use_large_pages;
os_large_page_size = (ulint) innobase_large_page_size;
+ row_rollback_on_timeout = (ibool) innobase_rollback_on_timeout;
+
srv_file_per_table = (ibool) innobase_file_per_table;
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
@@ -5308,19 +5315,11 @@ ha_innobase::info(
prebuilt->trx->op_info = (char*)
"returning various info to MySQL";
-
- 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",
+ my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name,
reg_ext);
- unpack_filename(path,path);
- }
+ unpack_filename(path,path);
/* Note that we do not know the access time of the table,
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
@@ -6377,14 +6376,17 @@ innodb_mutex_show_status(
Protocol *protocol= thd->protocol;
List<Item> field_list;
mutex_t* mutex;
+#ifdef UNIV_DEBUG
ulint rw_lock_count= 0;
ulint rw_lock_count_spin_loop= 0;
ulint rw_lock_count_spin_rounds= 0;
ulint rw_lock_count_os_wait= 0;
ulint rw_lock_count_os_yield= 0;
ulonglong rw_lock_wait_time= 0;
+#endif /* UNIV_DEBUG */
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("Module", FN_REFLEN));
field_list.push_back(new Item_uint("Count", 21));
@@ -6393,19 +6395,23 @@ innodb_mutex_show_status(
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_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,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
-#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
- mutex_enter(&mutex_list_mutex);
-#endif
+ mutex_enter_noninline(&mutex_list_mutex);
mutex = UT_LIST_GET_FIRST(mutex_list);
while ( mutex != NULL )
{
+#ifdef UNIV_DEBUG
if (mutex->mutex_type != 1)
{
if (mutex->count_using > 0)
@@ -6422,9 +6428,7 @@ innodb_mutex_show_status(
if (protocol->write())
{
-#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
- mutex_exit(&mutex_list_mutex);
-#endif
+ mutex_exit_noninline(&mutex_list_mutex);
DBUG_RETURN(1);
}
}
@@ -6438,10 +6442,25 @@ innodb_mutex_show_status(
rw_lock_count_os_yield += mutex->count_os_yield;
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_exit_noninline(&mutex_list_mutex);
+
+#ifdef UNIV_DEBUG
protocol->prepare_for_resend();
protocol->store("rw_lock_mutexes", system_charset_info);
protocol->store("", system_charset_info);
@@ -6456,10 +6475,8 @@ innodb_mutex_show_status(
{
DBUG_RETURN(1);
}
+#endif /* UNIV_DEBUG */
-#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
- mutex_exit(&mutex_list_mutex);
-#endif
send_eof(thd);
DBUG_RETURN(FALSE);
}