Commit d36bd697 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

5.6.37

parent 0af98182
/***************************************************************************** /*****************************************************************************
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -1976,11 +1976,14 @@ ib_cursor_read_row( ...@@ -1976,11 +1976,14 @@ ib_cursor_read_row(
page_format = static_cast<ib_bool_t>( page_format = static_cast<ib_bool_t>(
dict_table_is_comp(tuple->index->table)); dict_table_is_comp(tuple->index->table));
rec = btr_pcur_get_rec(pcur); rec = btr_pcur_get_rec(pcur);
if (prebuilt->innodb_api_rec && if (!rec_get_deleted_flag(rec, page_format)) {
prebuilt->innodb_api_rec != rec) { if (prebuilt->innodb_api &&
rec = prebuilt->innodb_api_rec; prebuilt->innodb_api_rec != NULL) {
rec =prebuilt->innodb_api_rec;
}
} }
if (!rec_get_deleted_flag(rec, page_format)) { if (!rec_get_deleted_flag(rec, page_format)) {
...@@ -2017,6 +2020,10 @@ ib_cursor_position( ...@@ -2017,6 +2020,10 @@ ib_cursor_position(
buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE)); buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE));
if (prebuilt->innodb_api) {
prebuilt->cursor_heap = cursor->heap;
}
/* We want to position at one of the ends, row_search_for_mysql() /* We want to position at one of the ends, row_search_for_mysql()
uses the search_tuple fields to work out what to do. */ uses the search_tuple fields to work out what to do. */
dtuple_set_n_fields(prebuilt->search_tuple, 0); dtuple_set_n_fields(prebuilt->search_tuple, 0);
...@@ -2071,6 +2078,9 @@ ib_cursor_next( ...@@ -2071,6 +2078,9 @@ ib_cursor_next(
row_prebuilt_t* prebuilt = cursor->prebuilt; row_prebuilt_t* prebuilt = cursor->prebuilt;
byte buf[UNIV_PAGE_SIZE_MAX]; byte buf[UNIV_PAGE_SIZE_MAX];
if (prebuilt->innodb_api) {
prebuilt->cursor_heap = cursor->heap;
}
/* We want to move to the next record */ /* We want to move to the next record */
dtuple_set_n_fields(prebuilt->search_tuple, 0); dtuple_set_n_fields(prebuilt->search_tuple, 0);
...@@ -2123,6 +2133,9 @@ ib_cursor_moveto( ...@@ -2123,6 +2133,9 @@ ib_cursor_moveto(
buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE)); buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE));
if (prebuilt->innodb_api) {
prebuilt->cursor_heap = cursor->heap;
}
err = static_cast<ib_err_t>(row_search_for_mysql( err = static_cast<ib_err_t>(row_search_for_mysql(
buf, ib_srch_mode, prebuilt, cursor->match_mode, 0)); buf, ib_srch_mode, prebuilt, cursor->match_mode, 0));
......
...@@ -8321,6 +8321,27 @@ ha_innobase::ft_init_ext( ...@@ -8321,6 +8321,27 @@ ha_innobase::ft_init_ext(
return((FT_INFO*) fts_hdl); return((FT_INFO*) fts_hdl);
} }
/*****************************************************************//**
Copy a cached MySQL row.
If requested, also avoids overwriting non-read columns.
@param[out] buf Row in MySQL format.
@param[in] cached_row Which row to copy.
@param[in] rec_len Record length. */
void
ha_innobase::copy_cached_row(
uchar* buf,
const uchar* cached_row,
uint rec_len)
{
if (prebuilt->keep_other_fields_on_keyread) {
row_sel_copy_cached_fields_for_mysql(buf, cached_row,
prebuilt);
} else {
memcpy(buf, cached_row, rec_len);
}
}
/*****************************************************************//** /*****************************************************************//**
Set up search tuple for a query through FTS_DOC_ID_INDEX on Set up search tuple for a query through FTS_DOC_ID_INDEX on
supplied Doc ID. This is used by MySQL to retrieve the documents supplied Doc ID. This is used by MySQL to retrieve the documents
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -142,6 +142,10 @@ class ha_innobase: public handler ...@@ -142,6 +142,10 @@ class ha_innobase: public handler
int index_first(uchar * buf); int index_first(uchar * buf);
int index_last(uchar * buf); int index_last(uchar * buf);
/* Copy a cached MySQL row. If requested, also avoids
overwriting non-read columns. */
void copy_cached_row(uchar *to_rec, const uchar *from_rec,
uint rec_length);
int rnd_init(bool scan); int rnd_init(bool scan);
int rnd_end(); int rnd_end();
int rnd_next(uchar *buf); int rnd_next(uchar *buf);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -723,6 +723,8 @@ struct row_prebuilt_t { ...@@ -723,6 +723,8 @@ struct row_prebuilt_t {
mem_heap_t* heap; /*!< memory heap from which mem_heap_t* heap; /*!< memory heap from which
these auxiliary structures are these auxiliary structures are
allocated when needed */ allocated when needed */
mem_heap_t* cursor_heap; /*!< memory heap from which
innodb_api_buf is allocated per session*/
ins_node_t* ins_node; /*!< Innobase SQL insert node ins_node_t* ins_node; /*!< Innobase SQL insert node
used to perform inserts used to perform inserts
to the table */ to the table */
...@@ -873,6 +875,9 @@ struct row_prebuilt_t { ...@@ -873,6 +875,9 @@ struct row_prebuilt_t {
unsigned innodb_api:1; /*!< whether this is a InnoDB API unsigned innodb_api:1; /*!< whether this is a InnoDB API
query */ query */
const rec_t* innodb_api_rec; /*!< InnoDB API search result */ const rec_t* innodb_api_rec; /*!< InnoDB API search result */
void* innodb_api_buf; /*!< Buffer holding copy of the physical
Innodb API search record */
ulint innodb_api_rec_size; /*!< Size of the Innodb API record */
byte* srch_key_val1; /*!< buffer used in converting byte* srch_key_val1; /*!< buffer used in converting
search key values from MySQL format search key values from MySQL format
to InnoDB format.*/ to InnoDB format.*/
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -205,6 +205,18 @@ struct sel_buf_t{ ...@@ -205,6 +205,18 @@ struct sel_buf_t{
when data != NULL */ when data != NULL */
}; };
/** Copy used fields from cached row.
Copy cache record field by field, don't touch fields that
are not covered by current key.
@param[out] buf Where to copy the MySQL row.
@param[in] cached_rec What to copy (in MySQL row format).
@param[in] prebuilt prebuilt struct. */
void
row_sel_copy_cached_fields_for_mysql(
byte* buf,
const byte* cached_rec,
row_prebuilt_t* prebuilt);
/** Query plan */ /** Query plan */
struct plan_t{ struct plan_t{
dict_table_t* table; /*!< table struct in the dictionary dict_table_t* table; /*!< table struct in the dictionary
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -1462,6 +1462,8 @@ row_merge_read_clustered_index( ...@@ -1462,6 +1462,8 @@ row_merge_read_clustered_index(
row_ext_t* ext; row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur); page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
mem_heap_empty(row_heap);
page_cur_move_to_next(cur); page_cur_move_to_next(cur);
if (page_cur_is_after_last(cur)) { if (page_cur_is_after_last(cur)) {
...@@ -1885,8 +1887,6 @@ row_merge_read_clustered_index( ...@@ -1885,8 +1887,6 @@ row_merge_read_clustered_index(
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
goto func_exit; goto func_exit;
} }
mem_heap_empty(row_heap);
} }
func_exit: func_exit:
......
This diff is collapsed.
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