/*
IMPLEMENTATION OF THE BUFFER POOL
-@@ -1930,8 +1964,16 @@
+@@ -1871,8 +1905,16 @@
mutex_t* block_mutex;
ibool must_read;
unsigned access_time;
buf_pool->stat.n_page_gets++;
for (;;) {
-@@ -1949,7 +1991,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());
-@@ -2045,6 +2087,13 @@
+@@ -1986,6 +2028,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -2059,6 +2108,12 @@
+@@ -2000,6 +2049,12 @@
break;
}
}
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2374,6 +2429,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);
-@@ -2403,6 +2463,9 @@
+@@ -2343,6 +2403,9 @@
|| ibuf_page_low(space, zip_size, offset,
FALSE, file, line, NULL));
#endif
buf_pool->stat.n_page_gets++;
fold = buf_page_address_fold(space, offset);
loop:
-@@ -2473,7 +2536,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;
-@@ -2782,6 +2845,13 @@
+@@ -2725,6 +2788,13 @@
/* Let us wait until the read operation
completes */
for (;;) {
enum buf_io_fix io_fix;
-@@ -2796,6 +2866,12 @@
+@@ -2739,6 +2809,12 @@
break;
}
}
}
fix_type = MTR_MEMO_BUF_FIX;
-@@ -2822,13 +2898,17 @@
+@@ -2765,13 +2841,17 @@
read-ahead */
buf_read_ahead_linear(space, zip_size, offset,
return(block);
}
-@@ -2852,6 +2932,7 @@
+@@ -2795,6 +2875,7 @@
unsigned access_time;
ibool success;
ulint fix_type;
ut_ad(block);
ut_ad(mtr);
-@@ -2929,6 +3010,10 @@
+@@ -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 */
-@@ -2936,7 +3021,7 @@
+@@ -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),
}
#ifdef UNIV_IBUF_COUNT_DEBUG
-@@ -2946,6 +3031,9 @@
+@@ -2889,6 +2974,9 @@
buf_pool = buf_pool_from_block(block);
buf_pool->stat.n_page_gets++;
return(TRUE);
}
-@@ -2968,6 +3056,7 @@
+@@ -2911,6 +2999,7 @@
buf_pool_t* buf_pool;
ibool success;
ulint fix_type;
ut_ad(mtr);
ut_ad(mtr->state == MTR_ACTIVE);
-@@ -3054,6 +3143,11 @@
+@@ -2997,6 +3086,11 @@
#endif
buf_pool->stat.n_page_gets++;
--- a/storage/innobase/buf/buf0rea.c
+++ b/storage/innobase/buf/buf0rea.c
-@@ -77,7 +77,8 @@
+@@ -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);
-@@ -279,7 +281,8 @@
+@@ -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 */
{
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ib_int64_t tablespace_version;
-@@ -498,7 +501,7 @@
+@@ -665,7 +669,7 @@
count += buf_read_page_low(
&err, FALSE,
ibuf_mode,
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
-@@ -591,7 +594,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:
-@@ -733,12 +736,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,
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
-@@ -4748,7 +4748,7 @@
+@@ -4765,7 +4765,7 @@
node->name, node->handle, buf,
offset_low, offset_high,
page_size * n_pages,
#endif
if (success) {
node->size += n_pages;
-@@ -5075,7 +5075,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
-@@ -5100,8 +5100,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;
-@@ -5269,7 +5270,7 @@
+@@ -5286,7 +5287,7 @@
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
-@@ -1578,6 +1578,16 @@
+@@ -1584,6 +1584,16 @@
trx->check_unique_secondary = !thd_test_options(
thd, OPTION_RELAXED_UNIQUE_CHECKS);
DBUG_VOID_RETURN;
}
-@@ -1632,6 +1642,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 */
-@@ -9312,6 +9348,25 @@
+@@ -9417,6 +9453,25 @@
statement has ended */
if (trx->n_mysql_tables_in_use == 0) {
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.
-@@ -73,7 +75,8 @@
+@@ -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 */
order to contract the insert buffer tree. Technically, this function is like
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
-@@ -611,9 +611,12 @@
+@@ -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 */
/* The following counter is incremented whenever there is some user activity
in the server */
UNIV_INTERN ulint srv_activity_count = 0;
-@@ -1232,6 +1235,10 @@
+@@ -1237,6 +1240,10 @@
ibool has_slept = FALSE;
srv_conc_slot_t* slot = NULL;
ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
-@@ -1312,6 +1319,7 @@
+@@ -1317,6 +1324,7 @@
switches. */
if (SRV_THREAD_SLEEP_DELAY > 0) {
os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
}
trx->op_info = "";
-@@ -1371,6 +1379,14 @@
+@@ -1376,6 +1384,14 @@
#ifdef UNIV_SYNC_DEBUG
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
trx->op_info = "waiting in InnoDB queue";
thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
-@@ -1379,6 +1395,12 @@
+@@ -1384,6 +1400,12 @@
trx->op_info = "";