diff options
author | Igor Babaev <igor@askmonty.org> | 2012-03-09 19:04:59 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-03-09 19:04:59 -0800 |
commit | e6578a345c807987cc6e7fb4e9504f03b36dfa00 (patch) | |
tree | 9e0b57c6d0cea4a77c23dc87356e09a524eb268d /storage/xtradb/row/row0sel.c | |
parent | 6c1aab92d25580643595962ae61a963a3e2fbd9d (diff) | |
parent | f92cfdb8a9ff7f8287239c39ce4735789a23e3df (diff) | |
download | mariadb-git-e6578a345c807987cc6e7fb4e9504f03b36dfa00.tar.gz |
Merged 5.3 changes into the mwl #248 tree.
Diffstat (limited to 'storage/xtradb/row/row0sel.c')
-rw-r--r-- | storage/xtradb/row/row0sel.c | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c index 4ae55b47b5b..52a6263efe5 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 -row_sel_push_cache_row_for_mysql( -/*=============================*/ - byte* mysql_rec, /*!< in/out: MySQL record */ +Get the last fetch cache buffer from the queue. +@return pointer to buffer. */ +UNIV_INLINE +byte* +row_sel_fetch_last_buf( +/*===================*/ 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)) { @@ -3297,15 +3296,28 @@ row_sel_push_cache_row_for_mysql( UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached], prebuilt->mysql_row_len); - memcpy(prebuilt->fetch_cache[prebuilt->n_fetch_cached], - mysql_rec, prebuilt->mysql_row_len); + return(prebuilt->fetch_cache[prebuilt->n_fetch_cached]); +} - if (++prebuilt->n_fetch_cached < MYSQL_FETCH_CACHE_SIZE) { - return(FALSE); +/********************************************************************//** +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 */ +{ + /* For non ICP code path the row should already exist in the + next fetch cache slot. */ + + if (prebuilt->idx_cond != NULL) { + byte* dest = row_sel_fetch_last_buf(prebuilt); + + ut_memcpy(dest, mysql_rec, prebuilt->mysql_row_len); } - row_sel_pop_cached_row_for_mysql(mysql_rec, prebuilt); - return(TRUE); + ++prebuilt->n_fetch_cached; } /*********************************************************************//** @@ -3431,7 +3443,7 @@ row_search_idx_cond_check( index, if the case of the column has been updated in the past, or a record has been deleted and a record inserted in a different case. */ - result = innobase_index_cond(prebuilt->idx_cond); + result = handler_index_cond_check(prebuilt->idx_cond); switch (result) { case ICP_MATCH: /* Convert the remaining fields to MySQL format. @@ -3455,6 +3467,7 @@ row_search_idx_cond_check( } ut_error; + return(ICP_ABORTED_BY_USER); /* Keep compiler happy */ } /********************************************************************//** @@ -4668,9 +4681,16 @@ 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)) { + && !row_sel_store_mysql_rec( + row_sel_fetch_last_buf(prebuilt), + prebuilt, result_rec, + result_rec != rec, offsets)) { /* Only fresh inserts may contain incomplete externally stored columns. Pretend that such records do not exist. Such records may only be @@ -4679,8 +4699,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 |