#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
-diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
---- a/storage/innobase/buf/buf0buf.c 2010-12-03 15:49:59.175955882 +0900
-+++ b/storage/innobase/buf/buf0buf.c 2010-12-03 17:42:42.074307123 +0900
+--- a/storage/innobase/buf/buf0buf.c
++++ b/storage/innobase/buf/buf0buf.c
@@ -51,6 +51,40 @@
#include "dict0dict.h"
#include "log0recv.h"
/*
IMPLEMENTATION OF THE BUFFER POOL
-@@ -2399,11 +2433,19 @@
+@@ -1871,8 +1905,16 @@
mutex_t* block_mutex;
ibool must_read;
unsigned access_time;
+ ib_uint64_t finish_time;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
- #ifndef UNIV_LOG_DEBUG
- ut_ad(!ibuf_inside());
- #endif
+ if (innobase_get_slow_log()) {
+ trx = innobase_get_trx();
+ }
buf_pool->stat.n_page_gets++;
for (;;) {
-@@ -2421,7 +2463,7 @@
+@@ -1890,7 +1932,7 @@
//buf_pool_mutex_exit(buf_pool);
rw_lock_s_unlock(&buf_pool->page_hash_latch);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate());
-@@ -2498,6 +2540,13 @@
+@@ -1986,6 +2028,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -2512,6 +2561,12 @@
+@@ -2000,6 +2049,12 @@
break;
}
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2824,6 +2879,11 @@
+@@ -2314,6 +2369,11 @@
ibool must_read;
ulint retries = 0;
mutex_t* block_mutex = NULL;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
-@@ -2842,6 +2902,9 @@
- ut_ad(!ibuf_inside() || ibuf_page_low(space, zip_size, offset,
- FALSE, file, line, NULL));
+@@ -2343,6 +2403,9 @@
+ || ibuf_page_low(space, zip_size, offset,
+ FALSE, file, line, NULL));
#endif
+ if (innobase_get_slow_log()) {
+ trx = innobase_get_trx();
buf_pool->stat.n_page_gets++;
fold = buf_page_address_fold(space, offset);
loop:
-@@ -2915,7 +2978,7 @@
+@@ -2413,9 +2476,9 @@
return(NULL);
}
- if (buf_read_page(space, zip_size, offset)) {
+ if (buf_read_page(space, zip_size, offset, trx)) {
+ buf_read_ahead_random(space, zip_size, offset,
+- ibuf_inside(mtr));
++ ibuf_inside(mtr), trx);
+
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
- ++retries;
-@@ -3217,6 +3280,13 @@
+@@ -2725,6 +2788,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -3231,6 +3301,12 @@
+@@ -2739,6 +2809,12 @@
break;
}
}
}
fix_type = MTR_MEMO_BUF_FIX;
-@@ -3256,13 +3332,17 @@
- /* In the case of a first access, try to apply linear
+@@ -2765,13 +2841,17 @@
read-ahead */
-- buf_read_ahead_linear(space, zip_size, offset);
-+ buf_read_ahead_linear(space, zip_size, offset, trx);
+ buf_read_ahead_linear(space, zip_size, offset,
+- ibuf_inside(mtr));
++ ibuf_inside(mtr), trx);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
return(block);
}
-@@ -3286,6 +3366,7 @@
+@@ -2795,6 +2875,7 @@
unsigned access_time;
ibool success;
ulint fix_type;
ut_ad(block);
ut_ad(mtr);
-@@ -3363,13 +3444,17 @@
+@@ -2872,6 +2953,10 @@
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
#endif
if (UNIV_UNLIKELY(!access_time)) {
/* In the case of a first access, try to apply linear
read-ahead */
-
+@@ -2879,7 +2964,7 @@
buf_read_ahead_linear(buf_block_get_space(block),
buf_block_get_zip_size(block),
-- buf_block_get_page_no(block));
-+ buf_block_get_page_no(block), trx);
+ buf_block_get_page_no(block),
+- ibuf_inside(mtr));
++ ibuf_inside(mtr), trx);
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -3379,6 +3464,9 @@
+@@ -2889,6 +2974,9 @@
buf_pool = buf_pool_from_block(block);
buf_pool->stat.n_page_gets++;
return(TRUE);
}
-@@ -3401,6 +3489,7 @@
+@@ -2911,6 +2999,7 @@
buf_pool_t* buf_pool;
ibool success;
ulint fix_type;
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
-@@ -3487,6 +3576,11 @@
+@@ -2997,6 +3086,11 @@
#endif
buf_pool->stat.n_page_gets++;
return(TRUE);
}
-diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
---- a/storage/innobase/buf/buf0rea.c 2010-12-03 17:32:15.617037263 +0900
-+++ b/storage/innobase/buf/buf0rea.c 2010-12-03 17:42:42.075297193 +0900
-@@ -77,7 +77,8 @@
+--- a/storage/innobase/buf/buf0rea.c
++++ b/storage/innobase/buf/buf0rea.c
+@@ -79,7 +79,8 @@
treat the tablespace as dropped; this is a timestamp we
use to stop dangling page reads from a tablespace
which we have DISCARDed + IMPORTed back */
{
buf_page_t* bpage;
ulint wake_later;
-@@ -179,15 +180,15 @@
+@@ -181,15 +182,15 @@
thd_wait_begin(NULL, THD_WAIT_DISKIO);
if (zip_size) {
}
thd_wait_end(NULL);
ut_a(*err == DB_SUCCESS);
-@@ -213,7 +214,8 @@
+@@ -226,8 +227,9 @@
+ or 0 */
+ ulint offset, /*!< in: page number of a page which
+ the current thread wants to access */
+- ibool inside_ibuf) /*!< in: TRUE if we are inside ibuf
++ ibool inside_ibuf, /*!< in: TRUE if we are inside ibuf
+ routine */
++ trx_t* trx)
+ {
+ buf_pool_t* buf_pool = buf_pool_get(space, offset);
+ ib_int64_t tablespace_version;
+@@ -330,7 +332,7 @@
+ &err, FALSE,
+ ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+ space, zip_size, FALSE,
+- tablespace_version, i);
++ tablespace_version, i, trx);
+ if (err == DB_TABLESPACE_DELETED) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+@@ -380,7 +382,8 @@
/*==========*/
ulint space, /*!< in: space id */
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
{
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ib_int64_t tablespace_version;
-@@ -227,7 +229,7 @@
+@@ -394,7 +397,7 @@
count = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
zip_size, FALSE,
srv_buf_pool_reads += count;
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
-@@ -278,8 +280,9 @@
- /*==================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
-- ulint offset) /*!< in: page number of a page; NOTE: the current thread
-+ ulint offset, /*!< in: page number of a page; NOTE: the current thread
- must want access to this page (see NOTE 3 above) */
+@@ -446,7 +449,8 @@
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes, or 0 */
+ ulint offset, /*!< in: page number; see NOTE 3 above */
+- ibool inside_ibuf) /*!< in: TRUE if we are inside ibuf routine */
++ ibool inside_ibuf, /*!< in: TRUE if we are inside ibuf routine */
+ trx_t* trx)
{
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ib_int64_t tablespace_version;
-@@ -500,7 +503,7 @@
+@@ -665,7 +669,7 @@
count += buf_read_page_low(
&err, FALSE,
- ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+ ibuf_mode,
- space, zip_size, FALSE, tablespace_version, i);
+ space, zip_size, FALSE, tablespace_version, i, trx);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
-@@ -594,7 +597,7 @@
+@@ -758,7 +762,7 @@
buf_read_page_low(&err, sync && (i + 1 == n_stored),
BUF_READ_ANY_PAGE, space_ids[i],
zip_size, TRUE, space_versions[i],
if (UNIV_UNLIKELY(err == DB_TABLESPACE_DELETED)) {
tablespace_deleted:
-@@ -736,12 +739,12 @@
+@@ -900,12 +904,12 @@
if ((i + 1 == n_stored) && sync) {
buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
zip_size, TRUE, tablespace_version,
}
}
-diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
---- a/storage/innobase/fil/fil0fil.c 2010-12-03 15:53:54.610037199 +0900
-+++ b/storage/innobase/fil/fil0fil.c 2010-12-03 17:42:42.079064198 +0900
-@@ -4423,7 +4423,7 @@
+--- a/storage/innobase/fil/fil0fil.c
++++ b/storage/innobase/fil/fil0fil.c
+@@ -4765,7 +4765,7 @@
node->name, node->handle, buf,
offset_low, offset_high,
page_size * n_pages,
#endif
if (success) {
node->size += n_pages;
-@@ -4750,7 +4750,7 @@
+@@ -5092,7 +5092,7 @@
i/o on a tablespace which does not exist */
UNIV_INTERN
ulint
/*===*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,
ORed to OS_FILE_LOG, if a log i/o
-@@ -4775,8 +4775,9 @@
+@@ -5117,8 +5117,9 @@
void* buf, /*!< in/out: buffer where to store read data
or from where to write; in aio this must be
appropriately aligned */
{
ulint mode;
fil_space_t* space;
-@@ -4946,7 +4947,7 @@
+@@ -5286,7 +5287,7 @@
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
#endif
ut_a(ret);
-diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
---- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:36:44.293955189 +0900
-+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 17:42:42.090024586 +0900
-@@ -1546,6 +1546,16 @@
+--- a/storage/innobase/handler/ha_innodb.cc
++++ b/storage/innobase/handler/ha_innodb.cc
+@@ -1584,6 +1584,16 @@
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
DBUG_VOID_RETURN;
}
-@@ -1600,6 +1610,32 @@
+@@ -1638,6 +1648,32 @@
return(trx);
}
/*********************************************************************//**
Note that a transaction has been registered with MySQL.
@return true if transaction is registered with MySQL 2PC coordinator */
-@@ -9280,6 +9316,25 @@
+@@ -9417,6 +9453,25 @@
statement has ended */
if (trx->n_mysql_tables_in_use == 0) {
trx->mysql_n_tables_locked = 0;
prebuilt->used_in_HANDLER = FALSE;
-diff -ruN a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
---- a/storage/innobase/include/buf0rea.h 2010-12-03 15:18:48.891024406 +0900
-+++ b/storage/innobase/include/buf0rea.h 2010-12-03 17:42:42.096026873 +0900
+--- a/storage/innobase/include/buf0rea.h
++++ b/storage/innobase/include/buf0rea.h
@@ -27,6 +27,7 @@
#define buf0rea_h
ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
- ulint offset);/*!< in: page number */
+ ulint offset, /*!< in: page number */
++ trx_t* trx);
+ /********************************************************************//**
+ Applies a random read-ahead in buf_pool if there are at least a threshold
+ value of accessed pages from the random read-ahead area. Does not read any
+@@ -65,8 +67,9 @@
+ or 0 */
+ ulint offset, /*!< in: page number of a page which
+ the current thread wants to access */
+- ibool inside_ibuf); /*!< in: TRUE if we are inside ibuf
++ ibool inside_ibuf, /*!< in: TRUE if we are inside ibuf
+ routine */
+ trx_t* trx);
/********************************************************************//**
Applies linear read-ahead if in the buf_pool the page is a border page of
a linear read-ahead area and all the pages in the area have been accessed.
-@@ -72,8 +74,9 @@
- /*==================*/
- ulint space, /*!< in: space id */
- ulint zip_size,/*!< in: compressed page size in bytes, or 0 */
-- ulint offset);/*!< in: page number of a page; NOTE: the current thread
-+ ulint offset, /*!< in: page number of a page; NOTE: the current thread
- must want access to this page (see NOTE 3 above) */
+@@ -98,7 +101,8 @@
+ ulint space, /*!< in: space id */
+ ulint zip_size, /*!< in: compressed page size in bytes, or 0 */
+ ulint offset, /*!< in: page number; see NOTE 3 above */
+- ibool inside_ibuf); /*!< in: TRUE if we are inside ibuf routine */
++ ibool inside_ibuf, /*!< in: TRUE if we are inside ibuf routine */
+ trx_t* trx);
/********************************************************************//**
Issues read requests for pages which the ibuf module wants to read in, in
order to contract the insert buffer tree. Technically, this function is like
-diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
---- a/storage/innobase/include/fil0fil.h 2010-12-03 15:09:51.290958543 +0900
-+++ b/storage/innobase/include/fil0fil.h 2010-12-03 17:42:42.097027548 +0900
-@@ -611,9 +611,12 @@
+--- a/storage/innobase/include/fil0fil.h
++++ b/storage/innobase/include/fil0fil.h
+@@ -620,9 +620,12 @@
Reads or writes data. This operation is asynchronous (aio).
@return DB_SUCCESS, or DB_TABLESPACE_DELETED if we are trying to do
i/o on a tablespace which does not exist */
/*===*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE,
ORed to OS_FILE_LOG, if a log i/o
-@@ -638,8 +641,9 @@
+@@ -647,8 +650,9 @@
void* buf, /*!< in/out: buffer where to store read data
or from where to write; in aio this must be
appropriately aligned */
/**********************************************************************//**
Waits for an aio operation to complete. This function is used to write the
handler for completed requests. The aio array of pending requests is divided
-diff -ruN a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
---- a/storage/innobase/include/os0file.h 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/os0file.h 2010-12-03 17:42:42.100023783 +0900
+--- a/storage/innobase/include/os0file.h
++++ b/storage/innobase/include/os0file.h
@@ -36,6 +36,7 @@
#define os0file_h
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
/*******************************************************************//**
-@@ -887,7 +897,8 @@
+@@ -889,7 +899,8 @@
offset where to read */
ulint offset_high,/*!< in: most significant 32 bits of
offset */
/*******************************************************************//**
Rewind file to its start, read at most size - 1 bytes from it to str, and
NUL-terminate str. All errors are silently ignored. This function is
-@@ -1046,10 +1057,11 @@
+@@ -1048,10 +1059,11 @@
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
/************************************************************************//**
Wakes up all async i/o threads so that they know to exit themselves in
shutdown. */
-diff -ruN a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
---- a/storage/innobase/include/os0file.ic 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/os0file.ic 2010-12-03 17:42:42.102024458 +0900
+--- a/storage/innobase/include/os0file.ic
++++ b/storage/innobase/include/os0file.ic
@@ -229,6 +229,7 @@
(can be used to identify a completed
aio operation); ignored if mode is
register_pfs_file_io_end(locker, n);
-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
---- a/storage/innobase/include/srv0srv.h 2010-12-03 17:32:15.634987408 +0900
-+++ b/storage/innobase/include/srv0srv.h 2010-12-03 17:42:42.104028644 +0900
+--- a/storage/innobase/include/srv0srv.h
++++ b/storage/innobase/include/srv0srv.h
@@ -71,6 +71,9 @@
#define SRV_AUTO_EXTEND_INCREMENT \
(srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
+/* prototypes for new functions added to ha_innodb.cc */
+ibool innobase_get_slow_log();
+
- /* This is set to the MySQL server value for this variable. */
- extern uint srv_lower_case_table_names;
-
-diff -ruN a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
---- a/storage/innobase/include/trx0trx.h 2010-12-03 15:41:52.049372966 +0900
-+++ b/storage/innobase/include/trx0trx.h 2010-12-03 17:42:42.107024532 +0900
-@@ -738,6 +738,17 @@
+ /* Mutex for locking srv_monitor_file */
+ extern mutex_t srv_monitor_file_mutex;
+ /* Temporary file for innodb monitor output */
+--- a/storage/innobase/include/trx0trx.h
++++ b/storage/innobase/include/trx0trx.h
+@@ -743,6 +743,17 @@
/*------------------------------*/
char detailed_error[256]; /*!< detailed error message for last
error, or empty. */
};
#define TRX_MAX_N_THREADS 32 /* maximum number of
-diff -ruN a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
---- a/storage/innobase/lock/lock0lock.c 2010-12-03 15:09:51.297986437 +0900
-+++ b/storage/innobase/lock/lock0lock.c 2010-12-03 17:42:42.111024587 +0900
-@@ -1755,6 +1755,8 @@
+--- a/storage/innobase/lock/lock0lock.c
++++ b/storage/innobase/lock/lock0lock.c
+@@ -1765,6 +1765,8 @@
{
lock_t* lock;
trx_t* trx;
ut_ad(mutex_own(&kernel_mutex));
-@@ -1813,6 +1815,10 @@
+@@ -1823,6 +1825,10 @@
trx->que_state = TRX_QUE_LOCK_WAIT;
trx->was_chosen_as_deadlock_victim = FALSE;
trx->wait_started = time(NULL);
ut_a(que_thr_stop(thr));
-@@ -3764,6 +3770,8 @@
+@@ -3766,6 +3772,8 @@
{
lock_t* lock;
trx_t* trx;
ut_ad(mutex_own(&kernel_mutex));
-@@ -3819,6 +3827,10 @@
+@@ -3821,6 +3829,10 @@
return(DB_SUCCESS);
}
trx->que_state = TRX_QUE_LOCK_WAIT;
trx->was_chosen_as_deadlock_victim = FALSE;
trx->wait_started = time(NULL);
-diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
---- a/storage/innobase/os/os0file.c 2010-12-03 17:32:15.644024974 +0900
-+++ b/storage/innobase/os/os0file.c 2010-12-03 17:42:42.117023467 +0900
+--- a/storage/innobase/os/os0file.c
++++ b/storage/innobase/os/os0file.c
@@ -43,6 +43,8 @@
#include "srv0start.h"
#include "fil0fil.h"
#include "log0recv.h"
#ifndef UNIV_HOTBACKUP
# include "os0sync.h"
-@@ -2202,13 +2204,18 @@
+@@ -2213,13 +2215,18 @@
ulint n, /*!< in: number of bytes to read */
ulint offset, /*!< in: least significant 32 bits of file
offset from where to read */
ut_a((offset & 0xFFFFFFFFUL) == offset);
-@@ -2229,6 +2236,15 @@
+@@ -2240,6 +2247,15 @@
os_n_file_reads++;
#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
os_mutex_enter(os_file_count_mutex);
os_file_n_pending_preads++;
-@@ -2242,6 +2258,13 @@
+@@ -2253,6 +2269,13 @@
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
return(n_bytes);
#else
{
-@@ -2278,6 +2301,13 @@
+@@ -2289,6 +2312,13 @@
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
return(ret);
}
#endif
-@@ -2418,7 +2448,8 @@
+@@ -2429,7 +2459,8 @@
offset where to read */
ulint offset_high, /*!< in: most significant 32 bits of
offset */
{
#ifdef __WIN__
BOOL ret;
-@@ -2493,7 +2524,7 @@
+@@ -2504,7 +2535,7 @@
os_bytes_read_since_printout += n;
try_again:
if ((ulint)ret == n) {
-@@ -2622,7 +2653,7 @@
+@@ -2633,7 +2664,7 @@
os_bytes_read_since_printout += n;
try_again:
if ((ulint)ret == n) {
-@@ -4016,10 +4047,11 @@
+@@ -4027,10 +4058,11 @@
(can be used to identify a completed
aio operation); ignored if mode is
OS_AIO_SYNC */
{
os_aio_array_t* array;
os_aio_slot_t* slot;
-@@ -4060,8 +4092,8 @@
- wait in the Windows case. */
+@@ -4078,7 +4110,7 @@
if (type == OS_FILE_READ) {
-- return(os_file_read(file, buf, offset,
+ return(os_file_read_func(file, buf, offset,
- offset_high, n));
-+ return(os_file_read_trx(file, buf, offset,
+ offset_high, n, trx));
}
ut_a(type == OS_FILE_WRITE);
-@@ -4099,6 +4131,11 @@
- ut_error;
+@@ -4119,6 +4151,11 @@
+ array = NULL; /* Eliminate compiler warning */
}
+ if (trx && type == OS_FILE_READ)
slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
name, buf, offset, offset_high, n);
if (type == OS_FILE_READ) {
-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
---- a/storage/innobase/srv/srv0srv.c 2010-12-03 17:32:15.648024399 +0900
-+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 17:45:05.067023254 +0900
-@@ -88,6 +88,9 @@
+--- a/storage/innobase/srv/srv0srv.c
++++ b/storage/innobase/srv/srv0srv.c
+@@ -87,6 +87,9 @@
#include "mysql/plugin.h"
#include "mysql/service_thd_wait.h"
+/* prototypes for new functions added to ha_innodb.cc */
+ibool innobase_get_slow_log();
+
- /* This is set to the MySQL server value for this variable. It is only
- needed for FOREIGN KEY definition parsing since FOREIGN KEY names are not
- stored in the server metadata. The server stores and enforces it for
-@@ -1257,6 +1260,10 @@
+ /* The following counter is incremented whenever there is some user activity
+ in the server */
+ UNIV_INTERN ulint srv_activity_count = 0;
+@@ -1237,6 +1240,10 @@
ibool has_slept = FALSE;
srv_conc_slot_t* slot = NULL;
ulint i;
+ ulint sec;
+ ulint ms;
- if (trx->mysql_thd != NULL
- && thd_is_replication_slave_thread(trx->mysql_thd)) {
-@@ -1333,6 +1340,7 @@
+ #ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+@@ -1317,6 +1324,7 @@
switches. */
if (SRV_THREAD_SLEEP_DELAY > 0) {
os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
}
trx->op_info = "";
-@@ -1388,6 +1396,13 @@
- /* Go to wait for the event; when a thread leaves InnoDB it will
- release this thread */
-
+@@ -1376,6 +1384,14 @@
+ #ifdef UNIV_SYNC_DEBUG
+ ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
+ #endif /* UNIV_SYNC_DEBUG */
++
+ if (innobase_get_slow_log() && trx->take_stats) {
+ ut_usectime(&sec, &ms);
+ start_time = (ib_uint64_t)sec * 1000000 + ms;
+
trx->op_info = "waiting in InnoDB queue";
- thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
-@@ -1396,6 +1411,12 @@
+ thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
+@@ -1384,6 +1400,12 @@
trx->op_info = "";
os_fast_mutex_lock(&srv_conc_mutex);
srv_conc_n_waiting_threads--;
-diff -ruN a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
---- a/storage/innobase/trx/trx0trx.c 2010-12-03 15:41:52.053955669 +0900
-+++ b/storage/innobase/trx/trx0trx.c 2010-12-03 17:42:42.127023410 +0900
-@@ -185,6 +185,15 @@
+--- a/storage/innobase/trx/trx0trx.c
++++ b/storage/innobase/trx/trx0trx.c
+@@ -188,6 +188,15 @@
trx->global_read_view = NULL;
trx->read_view = NULL;
/* Set X/Open XA transaction identification to NULL */
memset(&trx->xid, 0, sizeof(trx->xid));
trx->xid.formatID = -1;
-@@ -222,6 +231,11 @@
+@@ -221,6 +230,11 @@
- trx->mysql_process_no = os_proc_get_number();
+ mutex_exit(&kernel_mutex);
+ if (innobase_get_slow_log() && trx->take_stats) {
+ trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);
return(trx);
}
-@@ -353,6 +367,12 @@
+@@ -406,6 +420,12 @@
/*===============*/
trx_t* trx) /*!< in, own: trx object */
{
mutex_enter(&kernel_mutex);
UT_LIST_REMOVE(mysql_trx_list, trx_sys->mysql_trx_list, trx);
-@@ -374,6 +394,12 @@
+@@ -427,6 +447,12 @@
/*====================*/
trx_t* trx) /*!< in, own: trx object */
{
mutex_enter(&kernel_mutex);
trx_free(trx);
-@@ -1091,6 +1117,9 @@
+@@ -1212,6 +1238,9 @@
trx_t* trx) /*!< in: transaction */
{
que_thr_t* thr;
ut_ad(mutex_own(&kernel_mutex));
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
-@@ -1105,6 +1134,11 @@
+@@ -1226,6 +1255,11 @@
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
}
trx->que_state = TRX_QUE_RUNNING;
}
-@@ -1118,6 +1152,9 @@
+@@ -1239,6 +1273,9 @@
trx_t* trx) /*!< in: transaction in the TRX_QUE_LOCK_WAIT state */
{
que_thr_t* thr;
ut_ad(mutex_own(&kernel_mutex));
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
-@@ -1132,6 +1169,11 @@
+@@ -1253,6 +1290,11 @@
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
}