summaryrefslogtreecommitdiff
path: root/storage/innobase/row/row0vers.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-07-06 18:17:24 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-07-06 22:18:35 +0300
commit934d5f95d33ee6980ede7e1990b519fd13bee327 (patch)
tree632336a7d0b3d58a91d00c611cb79fb020e5f092 /storage/innobase/row/row0vers.cc
parentb4c377f21510849a67bcb0c72e8715903883ce4d (diff)
parent8b0d4cff0760b0a35285c315d82c49631c108baf (diff)
downloadmariadb-git-934d5f95d33ee6980ede7e1990b519fd13bee327.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/row/row0vers.cc')
-rw-r--r--storage/innobase/row/row0vers.cc143
1 files changed, 95 insertions, 48 deletions
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index 81f9c795a7c..5bebdd82f81 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -432,14 +432,16 @@ row_vers_impl_x_locked(
@param[in,out] row the cluster index row in dtuple form
@param[in] clust_index clustered index
@param[in] index the secondary index
-@param[in] heap heap used to build virtual dtuple */
+@param[in] heap heap used to build virtual dtuple
+@param[in,out] vcol_info virtual column information. */
static
void
row_vers_build_clust_v_col(
- dtuple_t* row,
- dict_index_t* clust_index,
- dict_index_t* index,
- mem_heap_t* heap)
+ dtuple_t* row,
+ dict_index_t* clust_index,
+ dict_index_t* index,
+ mem_heap_t* heap,
+ purge_vcol_info_t* vcol_info)
{
mem_heap_t* local_heap = NULL;
VCOL_STORAGE *vcol_storage= NULL;
@@ -449,12 +451,23 @@ row_vers_build_clust_v_col(
ut_ad(dict_index_has_virtual(index));
+ if (vcol_info != NULL) {
+ vcol_info->set_used();
+ maria_table = vcol_info->mariadb_table;
+ }
+
innobase_allocate_row_for_vcol(thd, index,
&local_heap,
&maria_table,
&record,
&vcol_storage);
+ if (vcol_info && !vcol_info->mariadb_table) {
+ vcol_info->mariadb_table = maria_table;
+ ut_ad(!maria_table || vcol_info->is_first_fetch());
+ goto func_exit;
+ }
+
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
const dict_field_t* ind_field = dict_index_get_nth_field(
index, i);
@@ -472,6 +485,7 @@ row_vers_build_clust_v_col(
}
}
+func_exit:
if (local_heap) {
if (vcol_storage)
innobase_free_row_for_vcol(vcol_storage);
@@ -493,16 +507,16 @@ row_vers_build_clust_v_col(
static
void
row_vers_build_cur_vrow_low(
- bool in_purge,
- const rec_t* rec,
- dict_index_t* clust_index,
- ulint* clust_offsets,
- dict_index_t* index,
- roll_ptr_t roll_ptr,
- trx_id_t trx_id,
- mem_heap_t* v_heap,
- const dtuple_t**vrow,
- mtr_t* mtr)
+ bool in_purge,
+ const rec_t* rec,
+ dict_index_t* clust_index,
+ ulint* clust_offsets,
+ dict_index_t* index,
+ roll_ptr_t roll_ptr,
+ trx_id_t trx_id,
+ mem_heap_t* v_heap,
+ const dtuple_t** vrow,
+ mtr_t* mtr)
{
const rec_t* version;
rec_t* prev_version;
@@ -779,20 +793,22 @@ func_exit:
@param[in,out] heap heap memory
@param[in,out] v_heap heap memory to keep virtual colum dtuple
@param[in] mtr mtr holding the latch on rec
+@param[in,out] vcol_info virtual column information for purge thread
@return dtuple contains virtual column data */
static
const dtuple_t*
row_vers_build_cur_vrow(
- bool in_purge,
- const rec_t* rec,
- dict_index_t* clust_index,
- ulint** clust_offsets,
- dict_index_t* index,
- roll_ptr_t roll_ptr,
- trx_id_t trx_id,
- mem_heap_t* heap,
- mem_heap_t* v_heap,
- mtr_t* mtr)
+ bool in_purge,
+ const rec_t* rec,
+ dict_index_t* clust_index,
+ ulint** clust_offsets,
+ dict_index_t* index,
+ roll_ptr_t roll_ptr,
+ trx_id_t trx_id,
+ mem_heap_t* heap,
+ mem_heap_t* v_heap,
+ mtr_t* mtr,
+ purge_vcol_info_t* vcol_info)
{
const dtuple_t* cur_vrow = NULL;
@@ -812,8 +828,17 @@ row_vers_build_cur_vrow(
rec, *clust_offsets,
NULL, NULL, NULL, NULL, heap);
+ if (vcol_info && !vcol_info->used) {
+ mtr->commit();
+ }
+
row_vers_build_clust_v_col(
- row, clust_index, index, heap);
+ row, clust_index, index, heap, vcol_info);
+
+ if (vcol_info != NULL && vcol_info->is_first_fetch()) {
+ return NULL;
+ }
+
cur_vrow = dtuple_copy(row, v_heap);
dtuple_dup_v_fld(cur_vrow, v_heap);
} else {
@@ -828,27 +853,34 @@ row_vers_build_cur_vrow(
return(cur_vrow);
}
-/*****************************************************************//**
-Finds out if a version of the record, where the version >= the current
+/** Finds out if a version of the record, where the version >= the current
purge view, should have ientry as its secondary index entry. We check
if there is any not delete marked version of the record where the trx
-id >= purge view, and the secondary index entry and ientry are identified in
-the alphabetical ordering; exactly in this case we return TRUE.
+id >= purge view, and the secondary index entry == ientry; exactly in
+this case we return TRUE.
+@param[in] also_curr TRUE if also rec is included in the versions
+ to search; otherwise only versions prior
+ to it are searched
+@param[in] rec record in the clustered index; the caller
+ must have a latch on the page
+@param[in] mtr mtr holding the latch on rec; it will
+ also hold the latch on purge_view
+@param[in] index secondary index
+@param[in] ientry secondary index entry
+@param[in] roll_ptr roll_ptr for the purge record
+@param[in] trx_id transaction ID on the purging record
+@param[in,out] vcol_info virtual column information for purge thread.
@return TRUE if earlier version should have */
-ibool
+bool
row_vers_old_has_index_entry(
-/*=========================*/
- ibool also_curr,/*!< in: TRUE if also rec is included in the
- versions to search; otherwise only versions
- prior to it are searched */
- const rec_t* rec, /*!< in: record in the clustered index; the
- caller must have a latch on the page */
- mtr_t* mtr, /*!< in: mtr holding the latch on rec; it will
- also hold the latch on purge_view */
- dict_index_t* index, /*!< in: the secondary index */
- const dtuple_t* ientry, /*!< in: the secondary index entry */
- roll_ptr_t roll_ptr,/*!< in: roll_ptr for the purge record */
- trx_id_t trx_id) /*!< in: transaction ID on the purging record */
+ bool also_curr,
+ const rec_t* rec,
+ mtr_t* mtr,
+ dict_index_t* index,
+ const dtuple_t* ientry,
+ roll_ptr_t roll_ptr,
+ trx_id_t trx_id,
+ purge_vcol_info_t* vcol_info)
{
const rec_t* version;
rec_t* prev_version;
@@ -916,8 +948,18 @@ row_vers_old_has_index_entry(
columns need to be computed */
if (trx_undo_roll_ptr_is_insert(t_roll_ptr)
|| dbug_v_purge) {
+
+ if (vcol_info && !vcol_info->used) {
+ mtr->commit();
+ }
+
row_vers_build_clust_v_col(
- row, clust_index, index, heap);
+ row, clust_index, index, heap,
+ vcol_info);
+
+ if (vcol_info && vcol_info->is_first_fetch()) {
+ goto unsafe_to_purge;
+ }
entry = row_build_index_entry(
row, ext, index, heap);
@@ -982,7 +1024,7 @@ safe_to_purge:
if (v_heap) {
mem_heap_free(v_heap);
}
- return(TRUE);
+ return true;
}
}
} else if (dict_index_has_virtual(index)) {
@@ -990,9 +1032,14 @@ safe_to_purge:
deleted, but the previous version of it might not. We will
need to get the virtual column data from undo record
associated with current cluster index */
+
cur_vrow = row_vers_build_cur_vrow(
also_curr, rec, clust_index, &clust_offsets,
- index, roll_ptr, trx_id, heap, v_heap, mtr);
+ index, roll_ptr, trx_id, heap, v_heap, mtr, vcol_info);
+
+ if (vcol_info && vcol_info->is_first_fetch()) {
+ goto unsafe_to_purge;
+ }
}
version = rec;
@@ -1011,14 +1058,14 @@ safe_to_purge:
if (!prev_version) {
/* Versions end here */
-
+unsafe_to_purge:
mem_heap_free(heap);
if (v_heap) {
mem_heap_free(v_heap);
}
- return(FALSE);
+ return false;
}
clust_offsets = rec_get_offsets(prev_version, clust_index,