diff options
author | Igor Babaev <igor@askmonty.org> | 2012-02-02 22:22:27 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-02-02 22:22:27 -0800 |
commit | 94c316069e7d1be80d81d55c3218d3f29d38f230 (patch) | |
tree | 757805ec6a0c1926a32a3ef68826e990224b798c | |
parent | 51e4bf7356f6c579c3aa8fcfd0cadc6a417fa526 (diff) | |
download | mariadb-git-94c316069e7d1be80d81d55c3218d3f29d38f230.tar.gz |
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.
-rw-r--r-- | storage/xtradb/row/row0sel.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c index 226b19359bb..f52e782599f 100644 --- a/storage/xtradb/row/row0sel.c +++ b/storage/xtradb/row/row0sel.c @@ -3259,16 +3259,15 @@ row_sel_pop_cached_row_for_mysql( } /********************************************************************//** -Pushes a row for MySQL to the fetch cache. -@return TRUE on success, FALSE if the record contains incomplete BLOBs */ -UNIV_INLINE __attribute__((warn_unused_result)) -ibool +Pushes a row for MySQL to the fetch cache. */ +UNIV_INLINE +void row_sel_push_cache_row_for_mysql( /*=============================*/ byte* mysql_rec, /*!< in/out: MySQL record */ 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); if (UNIV_UNLIKELY(prebuilt->fetch_cache[0] == NULL)) { @@ -3300,12 +3299,7 @@ row_sel_push_cache_row_for_mysql( memcpy(prebuilt->fetch_cache[prebuilt->n_fetch_cached], mysql_rec, prebuilt->mysql_row_len); - if (++prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE) { - return(FALSE); - } - - row_sel_pop_cached_row_for_mysql(mysql_rec, prebuilt); - return(TRUE); + ++prebuilt->n_fetch_cached; } /*********************************************************************//** @@ -4669,6 +4663,11 @@ requires_clust_rec: not cache rows because there the cursor is a scrollable 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 && !row_sel_store_mysql_rec(buf, prebuilt, result_rec, result_rec != rec, offsets)) { @@ -4680,8 +4679,12 @@ requires_clust_rec: transaction. Rollback happens at a lower level, not here. */ 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 { if (UNIV_UNLIKELY |