Commit 94c31606 authored by Igor Babaev's avatar Igor Babaev

Applied the patch from mysql-5.6 code line that fixed

a significant performance drop for high concurrency bechmarks
(bug #11765850 - 58854).

Here's the comment of the patch commit:

The bug is that the InnoDB pre-fetch cache was not being used in
row_search_for_mysql().  Secondly the changeset that planted the
bug also introduced some inefficient code. It would read an extra
row, convert it to MySQL row format (for ICP==off), copy the row
to the pre-fetch cache row buffer, then check for cache overflow
and dequeue the row that was pushed if there was a possibility of
a cache overflow.
parent 51e4bf73
...@@ -3259,16 +3259,15 @@ row_sel_pop_cached_row_for_mysql( ...@@ -3259,16 +3259,15 @@ row_sel_pop_cached_row_for_mysql(
} }
/********************************************************************//** /********************************************************************//**
Pushes a row for MySQL to the fetch cache. Pushes a row for MySQL to the fetch cache. */
@return TRUE on success, FALSE if the record contains incomplete BLOBs */ UNIV_INLINE
UNIV_INLINE __attribute__((warn_unused_result)) void
ibool
row_sel_push_cache_row_for_mysql( row_sel_push_cache_row_for_mysql(
/*=============================*/ /*=============================*/
byte* mysql_rec, /*!< in/out: MySQL record */ byte* mysql_rec, /*!< in/out: MySQL record */
row_prebuilt_t* prebuilt) /*!< in/out: prebuilt struct */ row_prebuilt_t* prebuilt) /*!< in/out: prebuilt struct */
{ {
ut_ad(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE); ut_a(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
ut_a(!prebuilt->templ_contains_blob); ut_a(!prebuilt->templ_contains_blob);
if (UNIV_UNLIKELY(prebuilt->fetch_cache[0] == NULL)) { if (UNIV_UNLIKELY(prebuilt->fetch_cache[0] == NULL)) {
...@@ -3300,12 +3299,7 @@ row_sel_push_cache_row_for_mysql( ...@@ -3300,12 +3299,7 @@ row_sel_push_cache_row_for_mysql(
memcpy(prebuilt->fetch_cache[prebuilt->n_fetch_cached], memcpy(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
mysql_rec, prebuilt->mysql_row_len); mysql_rec, prebuilt->mysql_row_len);
if (++prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE) { ++prebuilt->n_fetch_cached;
return(FALSE);
}
row_sel_pop_cached_row_for_mysql(mysql_rec, prebuilt);
return(TRUE);
} }
/*********************************************************************//** /*********************************************************************//**
...@@ -4669,6 +4663,11 @@ requires_clust_rec: ...@@ -4669,6 +4663,11 @@ requires_clust_rec:
not cache rows because there the cursor is a scrollable not cache rows because there the cursor is a scrollable
cursor. */ cursor. */
ut_a(prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE);
/* We only convert from InnoDB row format to MySQL row
format when ICP is disabled. */
if (!prebuilt->idx_cond if (!prebuilt->idx_cond
&& !row_sel_store_mysql_rec(buf, prebuilt, result_rec, && !row_sel_store_mysql_rec(buf, prebuilt, result_rec,
result_rec != rec, offsets)) { result_rec != rec, offsets)) {
...@@ -4680,8 +4679,12 @@ requires_clust_rec: ...@@ -4680,8 +4679,12 @@ requires_clust_rec:
transaction. Rollback happens at a lower transaction. Rollback happens at a lower
level, not here. */ level, not here. */
goto next_rec; goto next_rec;
} else if (row_sel_push_cache_row_for_mysql(buf, prebuilt)) { }
goto next_rec;
row_sel_push_cache_row_for_mysql(buf, prebuilt);
if (prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE) {
goto next_rec;
} }
} else { } else {
if (UNIV_UNLIKELY if (UNIV_UNLIKELY
......
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