Browse Source

MDEV-6928: Add trx pointer to struct mtr_t

Merge Facebook commit 25295d003c
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6

This adds a pointer to the trx to each mtr.
This allows the trx to be accessed in parts of the code
where it was otherwise not available. This is needed later.
pull/22/head
Jan Lindström 11 years ago
parent
commit
3486135bb5
  1. 2
      storage/innobase/api/api0api.cc
  2. 34
      storage/innobase/btr/btr0cur.cc
  3. 2
      storage/innobase/btr/btr0pcur.cc
  4. 6
      storage/innobase/fts/fts0fts.cc
  5. 3
      storage/innobase/fts/fts0que.cc
  6. 2
      storage/innobase/handler/ha_innodb.cc
  7. 12
      storage/innobase/include/btr0cur.h
  8. 16
      storage/innobase/include/mtr0mtr.h
  9. 6
      storage/innobase/include/mtr0mtr.ic
  10. 13
      storage/innobase/include/trx0undo.h
  11. 3
      storage/innobase/row/row0ext.cc
  12. 3
      storage/innobase/row/row0ftsort.cc
  13. 24
      storage/innobase/row/row0ins.cc
  14. 4
      storage/innobase/row/row0log.cc
  15. 2
      storage/innobase/row/row0merge.cc
  16. 8
      storage/innobase/row/row0mysql.cc
  17. 19
      storage/innobase/row/row0sel.cc
  18. 14
      storage/innobase/row/row0umod.cc
  19. 12
      storage/innobase/row/row0upd.cc
  20. 8
      storage/innobase/trx/trx0rec.cc
  21. 10
      storage/innobase/trx/trx0undo.cc
  22. 2
      storage/xtradb/api/api0api.cc
  23. 34
      storage/xtradb/btr/btr0cur.cc
  24. 2
      storage/xtradb/btr/btr0pcur.cc
  25. 6
      storage/xtradb/fts/fts0fts.cc
  26. 3
      storage/xtradb/fts/fts0que.cc
  27. 2
      storage/xtradb/handler/ha_innodb.cc
  28. 12
      storage/xtradb/include/btr0cur.h
  29. 16
      storage/xtradb/include/mtr0mtr.h
  30. 6
      storage/xtradb/include/mtr0mtr.ic
  31. 13
      storage/xtradb/include/trx0undo.h
  32. 3
      storage/xtradb/row/row0ext.cc
  33. 3
      storage/xtradb/row/row0ftsort.cc
  34. 24
      storage/xtradb/row/row0ins.cc
  35. 4
      storage/xtradb/row/row0log.cc
  36. 2
      storage/xtradb/row/row0merge.cc
  37. 8
      storage/xtradb/row/row0mysql.cc
  38. 17
      storage/xtradb/row/row0sel.cc
  39. 14
      storage/xtradb/row/row0umod.cc
  40. 12
      storage/xtradb/row/row0upd.cc
  41. 8
      storage/xtradb/trx/trx0rec.cc
  42. 10
      storage/xtradb/trx/trx0undo.cc

2
storage/innobase/api/api0api.cc

@ -427,7 +427,7 @@ ib_read_tuple(
data = btr_rec_copy_externally_stored_field(
copy, offsets, zip_size, i, &len,
tuple->heap);
tuple->heap, NULL);
ut_a(len != UNIV_SQL_NULL);
}

34
storage/innobase/btr/btr0cur.cc

@ -3610,7 +3610,8 @@ btr_estimate_n_rows_in_range(
const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */
ulint mode1, /*!< in: search mode for range start */
const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */
ulint mode2) /*!< in: search mode for range end */
ulint mode2, /*!< in: search mode for range end */
trx_t* trx) /*!< in: trx */
{
btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS];
btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS];
@ -3628,7 +3629,7 @@ btr_estimate_n_rows_in_range(
table_n_rows = dict_table_get_n_rows(index->table);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
cursor.path_arr = path1;
@ -3646,7 +3647,7 @@ btr_estimate_n_rows_in_range(
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
cursor.path_arr = path2;
@ -5228,7 +5229,8 @@ btr_copy_blob_prefix(
ulint len, /*!< in: length of buf, in bytes */
ulint space_id,/*!< in: space id of the BLOB pages */
ulint page_no,/*!< in: page number of the first BLOB page */
ulint offset) /*!< in: offset on the first BLOB page */
ulint offset, /*!< in: offset on the first BLOB page */
trx_t* trx) /*!< in: transaction handle */
{
ulint copied_len = 0;
@ -5240,7 +5242,7 @@ btr_copy_blob_prefix(
ulint part_len;
ulint copy_len;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr);
buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
@ -5443,7 +5445,8 @@ btr_copy_externally_stored_field_prefix_low(
zero for uncompressed BLOBs */
ulint space_id,/*!< in: space id of the first BLOB page */
ulint page_no,/*!< in: page number of the first BLOB page */
ulint offset) /*!< in: offset on the first BLOB page */
ulint offset, /*!< in: offset on the first BLOB page */
trx_t* trx) /*!< in: transaction handle */
{
if (UNIV_UNLIKELY(len == 0)) {
return(0);
@ -5454,7 +5457,7 @@ btr_copy_externally_stored_field_prefix_low(
space_id, page_no, offset));
} else {
return(btr_copy_blob_prefix(buf, len, space_id,
page_no, offset));
page_no, offset, trx));
}
}
@ -5475,7 +5478,8 @@ btr_copy_externally_stored_field_prefix(
field containing also the reference to
the external part; must be protected by
a lock or a page latch */
ulint local_len)/*!< in: length of data, in bytes */
ulint local_len,/*!< in: length of data, in bytes */
trx_t* trx) /*!< in: transaction handle */
{
ulint space_id;
ulint page_no;
@ -5514,7 +5518,7 @@ btr_copy_externally_stored_field_prefix(
len - local_len,
zip_size,
space_id, page_no,
offset));
offset, trx));
}
/*******************************************************************//**
@ -5533,7 +5537,8 @@ btr_copy_externally_stored_field(
ulint zip_size,/*!< in: nonzero=compressed BLOB page size,
zero for uncompressed BLOBs */
ulint local_len,/*!< in: length of data */
mem_heap_t* heap) /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx) /*!< in: transaction handle */
{
ulint space_id;
ulint page_no;
@ -5564,7 +5569,8 @@ btr_copy_externally_stored_field(
extern_len,
zip_size,
space_id,
page_no, offset);
page_no, offset,
trx);
return(buf);
}
@ -5583,7 +5589,8 @@ btr_rec_copy_externally_stored_field(
zero for uncompressed BLOBs */
ulint no, /*!< in: field number */
ulint* len, /*!< out: length of the field */
mem_heap_t* heap) /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx) /*!< in: transaction handle */
{
ulint local_len;
const byte* data;
@ -5614,6 +5621,7 @@ btr_rec_copy_externally_stored_field(
}
return(btr_copy_externally_stored_field(len, data,
zip_size, local_len, heap));
zip_size, local_len, heap,
trx));
}
#endif /* !UNIV_HOTBACKUP */

2
storage/innobase/btr/btr0pcur.cc

@ -486,7 +486,7 @@ btr_pcur_move_backward_from_page(
mtr_commit(mtr);
mtr_start(mtr);
mtr_start_trx(mtr, mtr->trx);
btr_pcur_restore_position(latch_mode2, cursor, mtr);

6
storage/innobase/fts/fts0fts.cc

@ -3393,7 +3393,8 @@ fts_fetch_doc_from_rec(
dict_table_zip_size(table),
clust_pos, &doc->text.f_len,
static_cast<mem_heap_t*>(
doc->self_heap->arg));
doc->self_heap->arg),
NULL);
} else {
doc->text.f_str = (byte*) rec_get_nth_field(
clust_rec, offsets, clust_pos,
@ -7077,7 +7078,8 @@ fts_init_recover_doc(
&doc.text.f_len,
static_cast<byte*>(dfield_get_data(dfield)),
zip_size, len,
static_cast<mem_heap_t*>(doc.self_heap->arg));
static_cast<mem_heap_t*>(doc.self_heap->arg),
NULL);
} else {
doc.text.f_str = static_cast<byte*>(
dfield_get_data(dfield));

3
storage/innobase/fts/fts0que.cc

@ -1918,7 +1918,8 @@ fts_query_fetch_document(
if (dfield_is_ext(dfield)) {
data = btr_copy_externally_stored_field(
&cur_len, data, phrase->zip_size,
dfield_get_len(dfield), phrase->heap);
dfield_get_len(dfield), phrase->heap,
NULL);
} else {
cur_len = dfield_get_len(dfield);
}

2
storage/innobase/handler/ha_innodb.cc

@ -10842,7 +10842,7 @@ ha_innobase::records_in_range(
n_rows = btr_estimate_n_rows_in_range(index, range_start,
mode1, range_end,
mode2);
mode2, prebuilt->trx);
} else {
n_rows = HA_POS_ERROR;

12
storage/innobase/include/btr0cur.h

@ -561,7 +561,8 @@ btr_estimate_n_rows_in_range(
const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */
ulint mode1, /*!< in: search mode for range start */
const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */
ulint mode2); /*!< in: search mode for range end */
ulint mode2, /*!< in: search mode for range end */
trx_t* trx); /*!< in: trx */
/*******************************************************************//**
Estimates the number of different key values in a given index, for
each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index).
@ -697,7 +698,8 @@ btr_copy_externally_stored_field_prefix(
field containing also the reference to
the external part; must be protected by
a lock or a page latch */
ulint local_len);/*!< in: length of data, in bytes */
ulint local_len,/*!< in: length of data, in bytes */
trx_t* trx); /*!< in: transaction handle */
/*******************************************************************//**
Copies an externally stored field of a record to mem heap. The
clustered index record must be protected by a lock or a page latch.
@ -714,7 +716,8 @@ btr_copy_externally_stored_field(
ulint zip_size,/*!< in: nonzero=compressed BLOB page size,
zero for uncompressed BLOBs */
ulint local_len,/*!< in: length of data */
mem_heap_t* heap); /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx); /*!< in: transaction handle */
/*******************************************************************//**
Copies an externally stored field of a record to mem heap.
@return the field copied to heap, or NULL if the field is incomplete */
@ -729,7 +732,8 @@ btr_rec_copy_externally_stored_field(
zero for uncompressed BLOBs */
ulint no, /*!< in: field number */
ulint* len, /*!< out: length of the field */
mem_heap_t* heap); /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx); /*!< in: transaction handle */
/*******************************************************************//**
Flags the data tuple fields that are marked as extern storage in the
update vector. We use this function to remember which fields we must

16
storage/innobase/include/mtr0mtr.h

@ -35,6 +35,7 @@ Created 11/26/1995 Heikki Tuuri
#include "ut0byte.h"
#include "mtr0types.h"
#include "page0types.h"
#include "trx0types.h"
/* Logging modes for a mini-transaction */
#define MTR_LOG_ALL 21 /* default mode: log all operations
@ -200,6 +201,15 @@ functions). The page number parameter was originally written as 0. @{ */
/* included here because it needs MLOG_LSN defined */
#include "log0log.h"
/***************************************************************//**
Starts a mini-transaction. */
UNIV_INLINE
void
mtr_start_trx(
/*======*/
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx) /*!< in: transaction */
__attribute__((nonnull (1)));
/***************************************************************//**
Starts a mini-transaction. */
UNIV_INLINE
@ -207,7 +217,10 @@ void
mtr_start(
/*======*/
mtr_t* mtr) /*!< out: mini-transaction */
__attribute__((nonnull));
{
mtr_start_trx(mtr, NULL);
}
__attribute__((nonnull))
/***************************************************************//**
Commits a mini-transaction. */
UNIV_INTERN
@ -403,6 +416,7 @@ struct mtr_t{
#ifdef UNIV_DEBUG
ulint magic_n;
#endif /* UNIV_DEBUG */
trx_t* trx; /*!< transaction */
};
#ifdef UNIV_DEBUG

6
storage/innobase/include/mtr0mtr.ic

@ -43,9 +43,10 @@ mtr_block_dirtied(
Starts a mini-transaction. */
UNIV_INLINE
void
mtr_start(
mtr_start_trx(
/*======*/
mtr_t* mtr) /*!< out: mini-transaction */
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx) /*!< in: transaction */
{
UNIV_MEM_INVALID(mtr, sizeof *mtr);
@ -58,6 +59,7 @@ mtr_start(
mtr->made_dirty = FALSE;
mtr->n_log_recs = 0;
mtr->n_freed_pages = 0;
mtr->trx = trx;
ut_d(mtr->state = MTR_ACTIVE);
ut_d(mtr->magic_n = MTR_MAGIC_N);

13
storage/innobase/include/trx0undo.h

@ -243,22 +243,13 @@ Truncates an undo log from the end. This function is used during a rollback
to free space from an undo log. */
UNIV_INTERN
void
trx_undo_truncate_end_func(
trx_undo_truncate_end(
/*=======================*/
#ifdef UNIV_DEBUG
const trx_t* trx, /*!< in: transaction whose undo log it is */
#endif /* UNIV_DEBUG */
trx_t* trx, /*!< in: transaction whose undo log it is */
trx_undo_t* undo, /*!< in/out: undo log */
undo_no_t limit) /*!< in: all undo records with undo number
>= this value should be truncated */
__attribute__((nonnull));
#ifdef UNIV_DEBUG
# define trx_undo_truncate_end(trx,undo,limit) \
trx_undo_truncate_end_func(trx,undo,limit)
#else /* UNIV_DEBUG */
# define trx_undo_truncate_end(trx,undo,limit) \
trx_undo_truncate_end_func(undo,limit)
#endif /* UNIV_DEBUG */
/***********************************************************************//**
Truncates an undo log from the start. This function is used during a purge

3
storage/innobase/row/row0ext.cc

@ -78,7 +78,8 @@ row_ext_cache_fill(
crashed during the execution of
btr_free_externally_stored_field(). */
ext->len[i] = btr_copy_externally_stored_field_prefix(
buf, ext->max_len, zip_size, field, f_len);
buf, ext->max_len, zip_size, field, f_len,
NULL);
}
}
}

3
storage/innobase/row/row0ftsort.cc

@ -660,7 +660,8 @@ loop:
doc.text.f_str =
btr_copy_externally_stored_field(
&doc.text.f_len, data,
zip_size, data_len, blob_heap);
zip_size, data_len, blob_heap,
NULL);
} else {
doc.text.f_str = data;
doc.text.f_len = data_len;

24
storage/innobase/row/row0ins.cc

@ -1294,7 +1294,7 @@ row_ins_foreign_check_on_constraint(
row_mysql_freeze_data_dictionary(thr_get_trx(thr));
mtr_start(mtr);
mtr_start_trx(mtr, trx);
/* Restore pcur position */
@ -1322,7 +1322,7 @@ nonstandard_exit_func:
btr_pcur_store_position(pcur, mtr);
mtr_commit(mtr);
mtr_start(mtr);
mtr_start_trx(mtr, trx);
btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr);
@ -1530,7 +1530,7 @@ run_again:
}
}
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Store old value on n_fields_cmp */
@ -2331,7 +2331,7 @@ row_ins_clust_index_entry_low(
|| n_uniq == dict_index_get_n_unique(index));
ut_ad(!n_uniq || n_uniq == dict_index_get_n_unique(index));
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) {
mode = BTR_MODIFY_LEAF | BTR_ALREADY_S_LATCHED;
@ -2544,9 +2544,10 @@ Starts a mini-transaction and checks if the index will be dropped.
@return true if the index is to be dropped */
static __attribute__((nonnull, warn_unused_result))
bool
row_ins_sec_mtr_start_and_check_if_aborted(
row_ins_sec_mtr_start_trx_and_check_if_aborted(
/*=======================================*/
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx, /*!< in: transaction handle */
dict_index_t* index, /*!< in/out: secondary index */
bool check, /*!< in: whether to check */
ulint search_mode)
@ -2554,7 +2555,7 @@ row_ins_sec_mtr_start_and_check_if_aborted(
{
ut_ad(!dict_index_is_clust(index));
mtr_start(mtr);
mtr_start_trx(mtr, trx);
if (!check) {
return(false);
@ -2612,13 +2613,14 @@ row_ins_sec_index_entry_low(
ulint n_unique;
mtr_t mtr;
ulint* offsets = NULL;
trx_t* trx = thr_get_trx(thr);
ut_ad(!dict_index_is_clust(index));
ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE);
cursor.thr = thr;
ut_ad(thr_get_trx(thr)->id);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Ensure that we acquire index->lock when inserting into an
index with index->online_status == ONLINE_INDEX_COMPLETE, but
@ -2679,8 +2681,8 @@ row_ins_sec_index_entry_low(
DEBUG_SYNC_C("row_ins_sec_index_unique");
if (row_ins_sec_mtr_start_and_check_if_aborted(
&mtr, index, check, search_mode)) {
if (row_ins_sec_mtr_start_trx_and_check_if_aborted(
&mtr, trx, index, check, search_mode)) {
goto func_exit;
}
@ -2714,8 +2716,8 @@ row_ins_sec_index_entry_low(
return(err);
}
if (row_ins_sec_mtr_start_and_check_if_aborted(
&mtr, index, check, search_mode)) {
if (row_ins_sec_mtr_start_trx_and_check_if_aborted(
&mtr, trx, index, check, search_mode)) {
goto func_exit;
}

4
storage/innobase/row/row0log.cc

@ -980,7 +980,7 @@ row_log_table_get_pk_col(
mem_heap_alloc(heap, field_len));
len = btr_copy_externally_stored_field_prefix(
blob_field, field_len, zip_size, field, len);
blob_field, field_len, zip_size, field, len, NULL);
if (len >= max_len + 1) {
return(DB_TOO_BIG_INDEX_COL);
}
@ -1371,7 +1371,7 @@ row_log_table_apply_convert_mrec(
data = btr_rec_copy_externally_stored_field(
mrec, offsets,
dict_table_zip_size(index->table),
i, &len, heap);
i, &len, heap, NULL);
ut_a(data);
dfield_set_data(dfield, data, len);
blob_done:

2
storage/innobase/row/row0merge.cc

@ -2246,7 +2246,7 @@ row_merge_copy_blobs(
BLOB pointers are read (row_merge_read_clustered_index())
and dereferenced (below). */
data = btr_rec_copy_externally_stored_field(
mrec, offsets, zip_size, i, &len, heap);
mrec, offsets, zip_size, i, &len, heap, NULL);
/* Because we have locked the table, any records
written by incomplete transactions must have been
rolled back already. There must not be any incomplete

8
storage/innobase/row/row0mysql.cc

@ -1850,7 +1850,7 @@ row_unlock_for_mysql(
trx_id_t rec_trx_id;
mtr_t mtr;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Restore the cursor position and find the record */
@ -3412,7 +3412,7 @@ row_truncate_table_for_mysql(
index = dict_table_get_next_index(index);
} while (index);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
fsp_header_init(space,
FIL_IBD_FILE_INITIAL_SIZE, &mtr);
mtr_commit(&mtr);
@ -3441,7 +3441,7 @@ row_truncate_table_for_mysql(
sys_index = dict_table_get_first_index(dict_sys->sys_indexes);
dict_index_copy_types(tuple, sys_index, 1);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_MODIFY_LEAF, &pcur, &mtr);
for (;;) {
@ -3488,7 +3488,7 @@ row_truncate_table_for_mysql(
a page in this mini-transaction, and the rest of
this loop could latch another index page. */
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
btr_pcur_restore_position(BTR_MODIFY_LEAF,
&pcur, &mtr);
}

19
storage/innobase/row/row0sel.cc

@ -132,7 +132,8 @@ row_sel_sec_rec_is_for_blob(
len = btr_copy_externally_stored_field_prefix(buf, prefix_len,
zip_size,
clust_field, clust_len);
clust_field, clust_len,
NULL);
if (UNIV_UNLIKELY(len == 0)) {
/* The BLOB was being deleted as the server crashed.
@ -451,7 +452,7 @@ row_sel_fetch_columns(
data = btr_rec_copy_externally_stored_field(
rec, offsets,
dict_table_zip_size(index->table),
field_no, &len, heap);
field_no, &len, heap, NULL);
/* data == NULL means that the
externally stored field was not
@ -1398,7 +1399,7 @@ table_loop:
/* Open a cursor to index, or restore an open cursor position */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (consistent_read && plan->unique_search && !plan->pcur_is_open
&& !plan->must_get_clust
@ -1438,7 +1439,7 @@ table_loop:
plan_reset_cursor(plan);
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
}
if (search_latch_locked) {
@ -2809,7 +2810,7 @@ row_sel_store_mysql_field_func(
data = btr_rec_copy_externally_stored_field(
rec, offsets,
dict_table_zip_size(prebuilt->table),
field_no, &len, heap);
field_no, &len, heap, NULL);
if (UNIV_UNLIKELY(!data)) {
/* The externally stored field was not written
@ -3885,7 +3886,7 @@ row_search_for_mysql(
}
}
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/*-------------------------------------------------------------*/
/* PHASE 2: Try fast adaptive hash index search if possible */
@ -4015,7 +4016,7 @@ release_search_latch_if_needed:
}
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
}
}
@ -5002,7 +5003,7 @@ next_rec:
mtr_commit(&mtr);
mtr_has_extra_clust_latch = FALSE;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
if (sel_restore_position_for_mysql(&same_user_rec,
BTR_SEARCH_LEAF,
pcur, moves_up, &mtr)) {
@ -5067,7 +5068,7 @@ lock_table_wait:
/* It was a lock wait, and it ended */
thr->lock_state = QUE_THR_LOCK_NOLOCK;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Table lock waited, go try to obtain table lock
again */

14
storage/innobase/row/row0umod.cc

@ -297,7 +297,7 @@ row_undo_mod_clust(
pcur = &node->pcur;
index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur));
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
online = dict_index_is_online_ddl(index);
if (online) {
@ -326,7 +326,7 @@ row_undo_mod_clust(
/* We may have to modify tree structure: do a pessimistic
descent down the index tree */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
err = row_undo_mod_clust_low(
node, &offsets, &offsets_heap,
@ -371,7 +371,7 @@ row_undo_mod_clust(
if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) {
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
/* It is not necessary to call row_log_table,
because the record is delete-marked and would thus
@ -384,7 +384,7 @@ row_undo_mod_clust(
/* We may have to modify tree structure: do a
pessimistic descent down the index tree */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
err = row_undo_mod_remove_clust_low(node, thr, &mtr,
BTR_MODIFY_TREE);
@ -431,7 +431,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
enum row_search_result search_result;
log_free_check();
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
@ -487,7 +487,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
which cannot be purged yet, requires its existence. If some requires,
we should delete mark the record. */
mtr_start(&mtr_vers);
mtr_start_trx(&mtr_vers, thr_get_trx(thr));
success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur),
&mtr_vers);
@ -603,7 +603,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
ut_ad(trx->id);
log_free_check();
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the

12
storage/innobase/row/row0upd.cc

@ -210,7 +210,7 @@ row_upd_check_references_constraints(
DEBUG_SYNC_C("foreign_constraint_check_for_update");
mtr_start(mtr);
mtr_start_trx(mtr, trx);
if (trx->dict_operation_lock_mode == 0) {
got_s_lock = TRUE;
@ -984,7 +984,7 @@ row_upd_ext_fetch(
byte* buf = static_cast<byte*>(mem_heap_alloc(heap, *len));
*len = btr_copy_externally_stored_field_prefix(
buf, *len, zip_size, data, local_len);
buf, *len, zip_size, data, local_len, NULL);
/* We should never update records containing a half-deleted BLOB. */
ut_a(*len);
@ -1685,7 +1685,7 @@ row_upd_sec_index_entry(
}
#endif /* UNIV_DEBUG */
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
@ -2152,7 +2152,7 @@ row_upd_clust_rec(
/* We may have to modify the tree structure: do a pessimistic descent
down the index tree */
mtr_start(mtr);
mtr_start_trx(mtr, thr_get_trx(thr));
/* NOTE: this transaction has an s-lock or x-lock on the record and
therefore other transactions cannot modify the record when we have no
@ -2319,7 +2319,7 @@ row_upd_clust_step(
/* We have to restore the cursor to its position */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
/* If the restoration does not succeed, then the same
transaction has deleted the record on which the cursor was,
@ -2373,7 +2373,7 @@ row_upd_clust_step(
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur,
&mtr);

8
storage/innobase/trx/trx0rec.cc

@ -466,7 +466,7 @@ trx_undo_page_fetch_ext(
{
/* Fetch the BLOB. */
ulint ext_len = btr_copy_externally_stored_field_prefix(
ext_buf, prefix_len, zip_size, field, *len);
ext_buf, prefix_len, zip_size, field, *len, NULL);
/* BLOBs should always be nonempty. */
ut_a(ext_len);
/* Append the BLOB pointer to the prefix. */
@ -1247,7 +1247,7 @@ trx_undo_report_row_operation(
rseg = trx->rseg;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
mutex_enter(&trx->undo_mutex);
/* If the undo log is not assigned yet, assign one */
@ -1336,7 +1336,7 @@ trx_undo_report_row_operation(
latches, such as SYNC_FSP and SYNC_FSP_PAGE. */
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
mutex_enter(&rseg->mutex);
trx_undo_free_last_page(trx, undo, &mtr);
@ -1373,7 +1373,7 @@ trx_undo_report_row_operation(
/* We have to extend the undo log by one page */
ut_ad(++loop_count < 2);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* When we add a page to an undo log, this is analogous to
a pessimistic insert in a B-tree, and we must reserve the

10
storage/innobase/trx/trx0undo.cc

@ -1067,11 +1067,9 @@ Truncates an undo log from the end. This function is used during a rollback
to free space from an undo log. */
UNIV_INTERN
void
trx_undo_truncate_end_func(
trx_undo_truncate_end(
/*=======================*/
#ifdef UNIV_DEBUG
const trx_t* trx, /*!< in: transaction whose undo log it is */
#endif /* UNIV_DEBUG */
trx_t* trx, /*!< in: transaction whose undo log it is */
trx_undo_t* undo, /*!< in: undo log */
undo_no_t limit) /*!< in: all undo records with undo number
>= this value should be truncated */
@ -1086,7 +1084,7 @@ trx_undo_truncate_end_func(
ut_ad(mutex_own(&(trx->rseg->mutex)));
for (;;) {
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
trunc_here = NULL;
@ -1773,7 +1771,7 @@ trx_undo_assign_undo(
ut_ad(mutex_own(&(trx->undo_mutex)));
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
mutex_enter(&rseg->mutex);

2
storage/xtradb/api/api0api.cc

@ -427,7 +427,7 @@ ib_read_tuple(
data = btr_rec_copy_externally_stored_field(
copy, offsets, zip_size, i, &len,
tuple->heap);
tuple->heap, NULL);
ut_a(len != UNIV_SQL_NULL);
}

34
storage/xtradb/btr/btr0cur.cc

@ -3801,7 +3801,8 @@ btr_estimate_n_rows_in_range(
const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */
ulint mode1, /*!< in: search mode for range start */
const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */
ulint mode2) /*!< in: search mode for range end */
ulint mode2, /*!< in: search mode for range end */
trx_t* trx) /*!< in: trx */
{
btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS];
btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS];
@ -3819,7 +3820,7 @@ btr_estimate_n_rows_in_range(
table_n_rows = dict_table_get_n_rows(index->table);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
cursor.path_arr = path1;
@ -3837,7 +3838,7 @@ btr_estimate_n_rows_in_range(
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
cursor.path_arr = path2;
@ -5430,7 +5431,8 @@ btr_copy_blob_prefix(
ulint len, /*!< in: length of buf, in bytes */
ulint space_id,/*!< in: space id of the BLOB pages */
ulint page_no,/*!< in: page number of the first BLOB page */
ulint offset) /*!< in: offset on the first BLOB page */
ulint offset, /*!< in: offset on the first BLOB page */
trx_t* trx) /*!< in: transaction handle */
{
ulint copied_len = 0;
@ -5442,7 +5444,7 @@ btr_copy_blob_prefix(
ulint part_len;
ulint copy_len;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr);
buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
@ -5645,7 +5647,8 @@ btr_copy_externally_stored_field_prefix_low(
zero for uncompressed BLOBs */
ulint space_id,/*!< in: space id of the first BLOB page */
ulint page_no,/*!< in: page number of the first BLOB page */
ulint offset) /*!< in: offset on the first BLOB page */
ulint offset, /*!< in: offset on the first BLOB page */
trx_t* trx) /*!< in: transaction handle */
{
if (UNIV_UNLIKELY(len == 0)) {
return(0);
@ -5656,7 +5659,7 @@ btr_copy_externally_stored_field_prefix_low(
space_id, page_no, offset));
} else {
return(btr_copy_blob_prefix(buf, len, space_id,
page_no, offset));
page_no, offset, trx));
}
}
@ -5677,7 +5680,8 @@ btr_copy_externally_stored_field_prefix(
field containing also the reference to
the external part; must be protected by
a lock or a page latch */
ulint local_len)/*!< in: length of data, in bytes */
ulint local_len,/*!< in: length of data, in bytes */
trx_t* trx) /*!< in: transaction handle */
{
ulint space_id;
ulint page_no;
@ -5716,7 +5720,7 @@ btr_copy_externally_stored_field_prefix(
len - local_len,
zip_size,
space_id, page_no,
offset));
offset, trx));
}
/*******************************************************************//**
@ -5735,7 +5739,8 @@ btr_copy_externally_stored_field(
ulint zip_size,/*!< in: nonzero=compressed BLOB page size,
zero for uncompressed BLOBs */
ulint local_len,/*!< in: length of data */
mem_heap_t* heap) /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx) /*!< in: transaction handle */
{
ulint space_id;
ulint page_no;
@ -5766,7 +5771,8 @@ btr_copy_externally_stored_field(
extern_len,
zip_size,
space_id,
page_no, offset);
page_no, offset,
trx);
return(buf);
}
@ -5785,7 +5791,8 @@ btr_rec_copy_externally_stored_field(
zero for uncompressed BLOBs */
ulint no, /*!< in: field number */
ulint* len, /*!< out: length of the field */
mem_heap_t* heap) /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx) /*!< in: transaction handle */
{
ulint local_len;
const byte* data;
@ -5816,6 +5823,7 @@ btr_rec_copy_externally_stored_field(
}
return(btr_copy_externally_stored_field(len, data,
zip_size, local_len, heap));
zip_size, local_len, heap,
trx));
}
#endif /* !UNIV_HOTBACKUP */

2
storage/xtradb/btr/btr0pcur.cc

@ -501,7 +501,7 @@ btr_pcur_move_backward_from_page(
mtr_commit(mtr);
mtr_start(mtr);
mtr_start_trx(mtr, mtr->trx);
btr_pcur_restore_position(latch_mode2, cursor, mtr);

6
storage/xtradb/fts/fts0fts.cc

@ -3393,7 +3393,8 @@ fts_fetch_doc_from_rec(
dict_table_zip_size(table),
clust_pos, &doc->text.f_len,
static_cast<mem_heap_t*>(
doc->self_heap->arg));
doc->self_heap->arg),
NULL);
} else {
doc->text.f_str = (byte*) rec_get_nth_field(
clust_rec, offsets, clust_pos,
@ -7077,7 +7078,8 @@ fts_init_recover_doc(
&doc.text.f_len,
static_cast<byte*>(dfield_get_data(dfield)),
zip_size, len,
static_cast<mem_heap_t*>(doc.self_heap->arg));
static_cast<mem_heap_t*>(doc.self_heap->arg),
NULL);
} else {
doc.text.f_str = static_cast<byte*>(
dfield_get_data(dfield));

3
storage/xtradb/fts/fts0que.cc

@ -1918,7 +1918,8 @@ fts_query_fetch_document(
if (dfield_is_ext(dfield)) {
data = btr_copy_externally_stored_field(
&cur_len, data, phrase->zip_size,
dfield_get_len(dfield), phrase->heap);
dfield_get_len(dfield), phrase->heap,
NULL);
} else {
cur_len = dfield_get_len(dfield);
}

2
storage/xtradb/handler/ha_innodb.cc

@ -11512,7 +11512,7 @@ ha_innobase::records_in_range(
n_rows = btr_estimate_n_rows_in_range(index, range_start,
mode1, range_end,
mode2);
mode2, prebuilt->trx);
} else {
n_rows = HA_POS_ERROR;

12
storage/xtradb/include/btr0cur.h

@ -567,7 +567,8 @@ btr_estimate_n_rows_in_range(
const dtuple_t* tuple1, /*!< in: range start, may also be empty tuple */
ulint mode1, /*!< in: search mode for range start */
const dtuple_t* tuple2, /*!< in: range end, may also be empty tuple */
ulint mode2); /*!< in: search mode for range end */
ulint mode2, /*!< in: search mode for range end */
trx_t* trx); /*!< in: trx */
/*******************************************************************//**
Estimates the number of different key values in a given index, for
each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index).
@ -703,7 +704,8 @@ btr_copy_externally_stored_field_prefix(
field containing also the reference to
the external part; must be protected by
a lock or a page latch */
ulint local_len);/*!< in: length of data, in bytes */
ulint local_len,/*!< in: length of data, in bytes */
trx_t* trx); /*!< in: transaction handle */
/*******************************************************************//**
Copies an externally stored field of a record to mem heap. The
clustered index record must be protected by a lock or a page latch.
@ -720,7 +722,8 @@ btr_copy_externally_stored_field(
ulint zip_size,/*!< in: nonzero=compressed BLOB page size,
zero for uncompressed BLOBs */
ulint local_len,/*!< in: length of data */
mem_heap_t* heap); /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx); /*!< in: transaction handle */
/*******************************************************************//**
Copies an externally stored field of a record to mem heap.
@return the field copied to heap, or NULL if the field is incomplete */
@ -735,7 +738,8 @@ btr_rec_copy_externally_stored_field(
zero for uncompressed BLOBs */
ulint no, /*!< in: field number */
ulint* len, /*!< out: length of the field */
mem_heap_t* heap); /*!< in: mem heap */
mem_heap_t* heap, /*!< in: mem heap */
trx_t* trx); /*!< in: transaction handle */
/*******************************************************************//**
Flags the data tuple fields that are marked as extern storage in the
update vector. We use this function to remember which fields we must

16
storage/xtradb/include/mtr0mtr.h

@ -35,6 +35,7 @@ Created 11/26/1995 Heikki Tuuri
#include "ut0byte.h"
#include "mtr0types.h"
#include "page0types.h"
#include "trx0types.h"
/* Logging modes for a mini-transaction */
#define MTR_LOG_ALL 21 /* default mode: log all operations
@ -200,6 +201,15 @@ functions). The page number parameter was originally written as 0. @{ */
/* included here because it needs MLOG_LSN defined */
#include "log0log.h"
/***************************************************************//**
Starts a mini-transaction. */
UNIV_INLINE
void
mtr_start_trx(
/*======*/
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx) /*!< in: transaction */
__attribute__((nonnull (1)));
/***************************************************************//**
Starts a mini-transaction. */
UNIV_INLINE
@ -207,7 +217,10 @@ void
mtr_start(
/*======*/
mtr_t* mtr) /*!< out: mini-transaction */
__attribute__((nonnull));
{
mtr_start_trx(mtr, NULL);
}
__attribute__((nonnull))
/***************************************************************//**
Commits a mini-transaction. */
UNIV_INTERN
@ -403,6 +416,7 @@ struct mtr_t{
#ifdef UNIV_DEBUG
ulint magic_n;
#endif /* UNIV_DEBUG */
trx_t* trx; /*!< transaction */
};
#ifdef UNIV_DEBUG

6
storage/xtradb/include/mtr0mtr.ic

@ -43,9 +43,10 @@ mtr_block_dirtied(
Starts a mini-transaction. */
UNIV_INLINE
void
mtr_start(
mtr_start_trx(
/*======*/
mtr_t* mtr) /*!< out: mini-transaction */
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx) /*!< in: transaction */
{
UNIV_MEM_INVALID(mtr, sizeof *mtr);
@ -58,6 +59,7 @@ mtr_start(
mtr->made_dirty = FALSE;
mtr->n_log_recs = 0;
mtr->n_freed_pages = 0;
mtr->trx = trx;
ut_d(mtr->state = MTR_ACTIVE);
ut_d(mtr->magic_n = MTR_MAGIC_N);

13
storage/xtradb/include/trx0undo.h

@ -243,22 +243,13 @@ Truncates an undo log from the end. This function is used during a rollback
to free space from an undo log. */
UNIV_INTERN
void
trx_undo_truncate_end_func(
trx_undo_truncate_end(
/*=======================*/
#ifdef UNIV_DEBUG
const trx_t* trx, /*!< in: transaction whose undo log it is */
#endif /* UNIV_DEBUG */
trx_t* trx, /*!< in: transaction whose undo log it is */
trx_undo_t* undo, /*!< in/out: undo log */
undo_no_t limit) /*!< in: all undo records with undo number
>= this value should be truncated */
__attribute__((nonnull));
#ifdef UNIV_DEBUG
# define trx_undo_truncate_end(trx,undo,limit) \
trx_undo_truncate_end_func(trx,undo,limit)
#else /* UNIV_DEBUG */
# define trx_undo_truncate_end(trx,undo,limit) \
trx_undo_truncate_end_func(undo,limit)
#endif /* UNIV_DEBUG */
/***********************************************************************//**
Truncates an undo log from the start. This function is used during a purge

3
storage/xtradb/row/row0ext.cc

@ -78,7 +78,8 @@ row_ext_cache_fill(
crashed during the execution of
btr_free_externally_stored_field(). */
ext->len[i] = btr_copy_externally_stored_field_prefix(
buf, ext->max_len, zip_size, field, f_len);
buf, ext->max_len, zip_size, field, f_len,
NULL);
}
}
}

3
storage/xtradb/row/row0ftsort.cc

@ -663,7 +663,8 @@ loop:
doc.text.f_str =
btr_copy_externally_stored_field(
&doc.text.f_len, data,
zip_size, data_len, blob_heap);
zip_size, data_len, blob_heap,
NULL);
} else {
doc.text.f_str = data;
doc.text.f_len = data_len;

24
storage/xtradb/row/row0ins.cc

@ -1294,7 +1294,7 @@ row_ins_foreign_check_on_constraint(
row_mysql_freeze_data_dictionary(thr_get_trx(thr));
mtr_start(mtr);
mtr_start_trx(mtr, trx);
/* Restore pcur position */
@ -1322,7 +1322,7 @@ nonstandard_exit_func:
btr_pcur_store_position(pcur, mtr);
mtr_commit(mtr);
mtr_start(mtr);
mtr_start_trx(mtr, trx);
btr_pcur_restore_position(BTR_SEARCH_LEAF, pcur, mtr);
@ -1530,7 +1530,7 @@ run_again:
}
}
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Store old value on n_fields_cmp */
@ -2343,7 +2343,7 @@ row_ins_clust_index_entry_low(
|| n_uniq == dict_index_get_n_unique(index));
ut_ad(!n_uniq || n_uniq == dict_index_get_n_unique(index));
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (mode == BTR_MODIFY_LEAF && dict_index_is_online_ddl(index)) {
if (UNIV_UNLIKELY(thr_get_trx(thr)->fake_changes)) {
@ -2571,9 +2571,10 @@ Starts a mini-transaction and checks if the index will be dropped.
@return true if the index is to be dropped */
static __attribute__((nonnull, warn_unused_result))
bool
row_ins_sec_mtr_start_and_check_if_aborted(
row_ins_sec_mtr_start_trx_and_check_if_aborted(
/*=======================================*/
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx, /*!< in: transaction handle */
dict_index_t* index, /*!< in/out: secondary index */
bool check, /*!< in: whether to check */
ulint search_mode)
@ -2581,7 +2582,7 @@ row_ins_sec_mtr_start_and_check_if_aborted(
{
ut_ad(!dict_index_is_clust(index));
mtr_start(mtr);
mtr_start_trx(mtr, trx);
if (!check) {
return(false);
@ -2639,13 +2640,14 @@ row_ins_sec_index_entry_low(
ulint n_unique;
mtr_t mtr;
ulint* offsets = NULL;
trx_t* trx = thr_get_trx(thr);
ut_ad(!dict_index_is_clust(index));
ut_ad(mode == BTR_MODIFY_LEAF || mode == BTR_MODIFY_TREE);
cursor.thr = thr;
ut_ad(thr_get_trx(thr)->id);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Ensure that we acquire index->lock when inserting into an
index with index->online_status == ONLINE_INDEX_COMPLETE, but
@ -2706,8 +2708,8 @@ row_ins_sec_index_entry_low(
DEBUG_SYNC_C("row_ins_sec_index_unique");
if (row_ins_sec_mtr_start_and_check_if_aborted(
&mtr, index, check, search_mode)) {
if (row_ins_sec_mtr_start_trx_and_check_if_aborted(
&mtr, trx, index, check, search_mode)) {
goto func_exit;
}
@ -2741,8 +2743,8 @@ row_ins_sec_index_entry_low(
return(err);
}
if (row_ins_sec_mtr_start_and_check_if_aborted(
&mtr, index, check, search_mode)) {
if (row_ins_sec_mtr_start_trx_and_check_if_aborted(
&mtr, trx, index, check, search_mode)) {
goto func_exit;
}

4
storage/xtradb/row/row0log.cc

@ -981,7 +981,7 @@ row_log_table_get_pk_col(
mem_heap_alloc(heap, field_len));
len = btr_copy_externally_stored_field_prefix(
blob_field, field_len, zip_size, field, len);
blob_field, field_len, zip_size, field, len, NULL);
if (len >= max_len + 1) {
return(DB_TOO_BIG_INDEX_COL);
}
@ -1372,7 +1372,7 @@ row_log_table_apply_convert_mrec(
data = btr_rec_copy_externally_stored_field(
mrec, offsets,
dict_table_zip_size(index->table),
i, &len, heap);
i, &len, heap, NULL);
ut_a(data);
dfield_set_data(dfield, data, len);
blob_done:

2
storage/xtradb/row/row0merge.cc

@ -2252,7 +2252,7 @@ row_merge_copy_blobs(
BLOB pointers are read (row_merge_read_clustered_index())
and dereferenced (below). */
data = btr_rec_copy_externally_stored_field(
mrec, offsets, zip_size, i, &len, heap);
mrec, offsets, zip_size, i, &len, heap, NULL);
/* Because we have locked the table, any records
written by incomplete transactions must have been
rolled back already. There must not be any incomplete

8
storage/xtradb/row/row0mysql.cc

@ -1859,7 +1859,7 @@ row_unlock_for_mysql(
trx_id_t rec_trx_id;
mtr_t mtr;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Restore the cursor position and find the record */
@ -3426,7 +3426,7 @@ row_truncate_table_for_mysql(
index = dict_table_get_next_index(index);
} while (index);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
fsp_header_init(space,
FIL_IBD_FILE_INITIAL_SIZE, &mtr);
mtr_commit(&mtr);
@ -3455,7 +3455,7 @@ row_truncate_table_for_mysql(
sys_index = dict_table_get_first_index(dict_sys->sys_indexes);
dict_index_copy_types(tuple, sys_index, 1);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_MODIFY_LEAF, &pcur, &mtr);
for (;;) {
@ -3502,7 +3502,7 @@ row_truncate_table_for_mysql(
a page in this mini-transaction, and the rest of
this loop could latch another index page. */
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
btr_pcur_restore_position(BTR_MODIFY_LEAF,
&pcur, &mtr);
}

17
storage/xtradb/row/row0sel.cc

@ -133,7 +133,8 @@ row_sel_sec_rec_is_for_blob(
len = btr_copy_externally_stored_field_prefix(buf, prefix_len,
zip_size,
clust_field, clust_len);
clust_field, clust_len,
NULL);
if (UNIV_UNLIKELY(len == 0)) {
/* The BLOB was being deleted as the server crashed.
@ -452,7 +453,7 @@ row_sel_fetch_columns(
data = btr_rec_copy_externally_stored_field(
rec, offsets,
dict_table_zip_size(index->table),
field_no, &len, heap);
field_no, &len, heap, NULL);
/* data == NULL means that the
externally stored field was not
@ -1400,7 +1401,7 @@ table_loop:
/* Open a cursor to index, or restore an open cursor position */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (consistent_read && plan->unique_search && !plan->pcur_is_open
&& !plan->must_get_clust
@ -1441,7 +1442,7 @@ table_loop:
plan_reset_cursor(plan);
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
}
if (search_latch_locked) {
@ -2815,7 +2816,7 @@ row_sel_store_mysql_field_func(
data = btr_rec_copy_externally_stored_field(
rec, offsets,
dict_table_zip_size(prebuilt->table),
field_no, &len, heap);
field_no, &len, heap, NULL);
if (UNIV_UNLIKELY(!data)) {
/* The externally stored field was not written
@ -3882,7 +3883,7 @@ row_search_for_mysql(
}
}
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/*-------------------------------------------------------------*/
/* PHASE 2: Try fast adaptive hash index search if possible */
@ -5020,7 +5021,7 @@ next_rec:
mtr_commit(&mtr);
mtr_has_extra_clust_latch = FALSE;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
if (sel_restore_position_for_mysql(&same_user_rec,
BTR_SEARCH_LEAF,
pcur, moves_up, &mtr)) {
@ -5085,7 +5086,7 @@ lock_table_wait:
/* It was a lock wait, and it ended */
thr->lock_state = QUE_THR_LOCK_NOLOCK;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* Table lock waited, go try to obtain table lock
again */

14
storage/xtradb/row/row0umod.cc

@ -267,7 +267,7 @@ row_undo_mod_clust(
pcur = &node->pcur;
index = btr_cur_get_index(btr_pcur_get_btr_cur(pcur));
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
online = dict_index_is_online_ddl(index);
if (online) {
@ -296,7 +296,7 @@ row_undo_mod_clust(
/* We may have to modify tree structure: do a pessimistic
descent down the index tree */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
err = row_undo_mod_clust_low(
node, &offsets, &offsets_heap,
@ -341,7 +341,7 @@ row_undo_mod_clust(
if (err == DB_SUCCESS && node->rec_type == TRX_UNDO_UPD_DEL_REC) {
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
/* It is not necessary to call row_log_table,
because the record is delete-marked and would thus
@ -354,7 +354,7 @@ row_undo_mod_clust(
/* We may have to modify tree structure: do a
pessimistic descent down the index tree */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
err = row_undo_mod_remove_clust_low(node, thr, &mtr,
BTR_MODIFY_TREE);
@ -401,7 +401,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
enum row_search_result search_result;
log_free_check();
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
@ -457,7 +457,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
which cannot be purged yet, requires its existence. If some requires,
we should delete mark the record. */
mtr_start(&mtr_vers);
mtr_start_trx(&mtr_vers, thr_get_trx(thr));
success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur),
&mtr_vers);
@ -573,7 +573,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
ut_ad(trx->id);
log_free_check();
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the

12
storage/xtradb/row/row0upd.cc

@ -212,7 +212,7 @@ row_upd_check_references_constraints(
DEBUG_SYNC_C("foreign_constraint_check_for_update");
mtr_start(mtr);
mtr_start_trx(mtr, trx);
if (trx->dict_operation_lock_mode == 0) {
got_s_lock = TRUE;
@ -986,7 +986,7 @@ row_upd_ext_fetch(
byte* buf = static_cast<byte*>(mem_heap_alloc(heap, *len));
*len = btr_copy_externally_stored_field_prefix(
buf, *len, zip_size, data, local_len);
buf, *len, zip_size, data, local_len, NULL);
/* We should never update records containing a half-deleted BLOB. */
ut_a(*len);
@ -1687,7 +1687,7 @@ row_upd_sec_index_entry(
}
#endif /* UNIV_DEBUG */
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
@ -2160,7 +2160,7 @@ row_upd_clust_rec(
/* We may have to modify the tree structure: do a pessimistic descent
down the index tree */
mtr_start(mtr);
mtr_start_trx(mtr, thr_get_trx(thr));
/* NOTE: this transaction has an s-lock or x-lock on the record and
therefore other transactions cannot modify the record when we have no
@ -2330,7 +2330,7 @@ row_upd_clust_step(
/* We have to restore the cursor to its position */
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
/* If the restoration does not succeed, then the same
transaction has deleted the record on which the cursor was,
@ -2386,7 +2386,7 @@ row_upd_clust_step(
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, thr_get_trx(thr));
success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur,
&mtr);

8
storage/xtradb/trx/trx0rec.cc

@ -466,7 +466,7 @@ trx_undo_page_fetch_ext(
{
/* Fetch the BLOB. */
ulint ext_len = btr_copy_externally_stored_field_prefix(
ext_buf, prefix_len, zip_size, field, *len);
ext_buf, prefix_len, zip_size, field, *len, NULL);
/* BLOBs should always be nonempty. */
ut_a(ext_len);
/* Append the BLOB pointer to the prefix. */
@ -1247,7 +1247,7 @@ trx_undo_report_row_operation(
rseg = trx->rseg;
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
mutex_enter(&trx->undo_mutex);
/* If the undo log is not assigned yet, assign one */
@ -1336,7 +1336,7 @@ trx_undo_report_row_operation(
latches, such as SYNC_FSP and SYNC_FSP_PAGE. */
mtr_commit(&mtr);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
mutex_enter(&rseg->mutex);
trx_undo_free_last_page(trx, undo, &mtr);
@ -1373,7 +1373,7 @@ trx_undo_report_row_operation(
/* We have to extend the undo log by one page */
ut_ad(++loop_count < 2);
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
/* When we add a page to an undo log, this is analogous to
a pessimistic insert in a B-tree, and we must reserve the

10
storage/xtradb/trx/trx0undo.cc

@ -1067,11 +1067,9 @@ Truncates an undo log from the end. This function is used during a rollback
to free space from an undo log. */
UNIV_INTERN
void
trx_undo_truncate_end_func(
trx_undo_truncate_end(
/*=======================*/
#ifdef UNIV_DEBUG
const trx_t* trx, /*!< in: transaction whose undo log it is */
#endif /* UNIV_DEBUG */
trx_t* trx, /*!< in: transaction whose undo log it is */
trx_undo_t* undo, /*!< in: undo log */
undo_no_t limit) /*!< in: all undo records with undo number
>= this value should be truncated */
@ -1086,7 +1084,7 @@ trx_undo_truncate_end_func(
ut_ad(mutex_own(&(trx->rseg->mutex)));
for (;;) {
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
trunc_here = NULL;
@ -1773,7 +1771,7 @@ trx_undo_assign_undo(
ut_ad(mutex_own(&(trx->undo_mutex)));
mtr_start(&mtr);
mtr_start_trx(&mtr, trx);
mutex_enter(&rseg->mutex);

Loading…
Cancel
Save