Skip to content

Commit

Permalink
Revert "MDEV-6928: Add trx pointer to struct mtr_t"
Browse files Browse the repository at this point in the history
This reverts commit 3486135.

The commit comment ended in the words: "This is needed later."
Apparently the "later" never arrived.
  • Loading branch information
dr-m committed Jan 29, 2018
1 parent d01dbe6 commit 706ed85
Show file tree
Hide file tree
Showing 42 changed files with 181 additions and 234 deletions.
2 changes: 1 addition & 1 deletion storage/innobase/api/api0api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ ib_read_tuple(

data = btr_rec_copy_externally_stored_field(
copy, offsets, zip_size, i, &len,
tuple->heap, NULL);
tuple->heap);

ut_a(len != UNIV_SQL_NULL);
}
Expand Down
34 changes: 13 additions & 21 deletions storage/innobase/btr/btr0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3681,8 +3681,7 @@ 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 */
trx_t* trx) /*!< in: trx */
ulint mode2) /*!< in: search mode for range end */
{
btr_path_t path1[BTR_PATH_ARRAY_N_SLOTS];
btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS];
Expand All @@ -3700,7 +3699,7 @@ btr_estimate_n_rows_in_range(

table_n_rows = dict_table_get_n_rows(index->table);

mtr_start_trx(&mtr, trx);
mtr_start(&mtr);

cursor.path_arr = path1;

Expand All @@ -3718,7 +3717,7 @@ btr_estimate_n_rows_in_range(

mtr_commit(&mtr);

mtr_start_trx(&mtr, trx);
mtr_start(&mtr);

cursor.path_arr = path2;

Expand Down Expand Up @@ -5329,8 +5328,7 @@ 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 */
trx_t* trx) /*!< in: transaction handle */
ulint offset) /*!< in: offset on the first BLOB page */
{
ulint copied_len = 0;

Expand All @@ -5342,7 +5340,7 @@ btr_copy_blob_prefix(
ulint part_len;
ulint copy_len;

mtr_start_trx(&mtr, trx);
mtr_start(&mtr);

block = buf_page_get(space_id, 0, page_no, RW_S_LATCH, &mtr);
buf_block_dbg_add_level(block, SYNC_EXTERN_STORAGE);
Expand Down Expand Up @@ -5545,8 +5543,7 @@ 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 */
trx_t* trx) /*!< in: transaction handle */
ulint offset) /*!< in: offset on the first BLOB page */
{
if (UNIV_UNLIKELY(len == 0)) {
return(0);
Expand All @@ -5557,7 +5554,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, trx));
page_no, offset));
}
}

Expand All @@ -5578,8 +5575,7 @@ 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 */
trx_t* trx) /*!< in: transaction handle */
ulint local_len)/*!< in: length of data, in bytes */
{
ulint space_id;
ulint page_no;
Expand Down Expand Up @@ -5618,7 +5614,7 @@ btr_copy_externally_stored_field_prefix(
len - local_len,
zip_size,
space_id, page_no,
offset, trx));
offset));
}

/*******************************************************************//**
Expand All @@ -5637,8 +5633,7 @@ 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 */
trx_t* trx) /*!< in: transaction handle */
mem_heap_t* heap) /*!< in: mem heap */
{
ulint space_id;
ulint page_no;
Expand Down Expand Up @@ -5669,8 +5664,7 @@ btr_copy_externally_stored_field(
extern_len,
zip_size,
space_id,
page_no, offset,
trx);
page_no, offset);

return(buf);
}
Expand All @@ -5689,8 +5683,7 @@ 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 */
trx_t* trx) /*!< in: transaction handle */
mem_heap_t* heap) /*!< in: mem heap */
{
ulint local_len;
const byte* data;
Expand Down Expand Up @@ -5721,7 +5714,6 @@ btr_rec_copy_externally_stored_field(
}

return(btr_copy_externally_stored_field(len, data,
zip_size, local_len, heap,
trx));
zip_size, local_len, heap));
}
#endif /* !UNIV_HOTBACKUP */
2 changes: 1 addition & 1 deletion storage/innobase/btr/btr0pcur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ btr_pcur_move_backward_from_page(

mtr_commit(mtr);

mtr_start_trx(mtr, mtr->trx);
mtr_start(mtr);

btr_pcur_restore_position(latch_mode2, cursor, mtr);

Expand Down
6 changes: 2 additions & 4 deletions storage/innobase/fts/fts0fts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3361,8 +3361,7 @@ 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),
NULL);
doc->self_heap->arg));
} else {
doc->text.f_str = (byte*) rec_get_nth_field(
clust_rec, offsets, clust_pos,
Expand Down Expand Up @@ -7599,8 +7598,7 @@ 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),
NULL);
static_cast<mem_heap_t*>(doc.self_heap->arg));
} else {
doc.text.f_str = static_cast<byte*>(
dfield_get_data(dfield));
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/fts/fts0que.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1917,8 +1917,7 @@ 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,
NULL);
dfield_get_len(dfield), phrase->heap);
} else {
cur_len = dfield_get_len(dfield);
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11163,7 +11163,7 @@ ha_innobase::records_in_range(

n_rows = btr_estimate_n_rows_in_range(index, range_start,
mode1, range_end,
mode2, prebuilt->trx);
mode2);
} else {

n_rows = HA_POS_ERROR;
Expand Down
12 changes: 4 additions & 8 deletions storage/innobase/include/btr0cur.h
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,7 @@ 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 */
trx_t* trx); /*!< in: trx */
ulint mode2); /*!< in: search mode for range end */
/*******************************************************************//**
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).
Expand Down Expand Up @@ -703,8 +702,7 @@ 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 */
trx_t* trx); /*!< in: transaction handle */
ulint local_len);/*!< in: length of data, in bytes */
/*******************************************************************//**
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.
Expand All @@ -721,8 +719,7 @@ 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 */
trx_t* trx); /*!< in: transaction handle */
mem_heap_t* heap); /*!< in: mem heap */
/*******************************************************************//**
Copies an externally stored field of a record to mem heap.
@return the field copied to heap, or NULL if the field is incomplete */
Expand All @@ -737,8 +734,7 @@ 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 */
trx_t* trx); /*!< in: transaction handle */
mem_heap_t* heap); /*!< in: mem heap */
/*******************************************************************//**
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
Expand Down
16 changes: 1 addition & 15 deletions storage/innobase/include/mtr0mtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ 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
Expand Down Expand Up @@ -202,26 +201,14 @@ 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 */
MY_ATTRIBUTE((nonnull (1)));
/***************************************************************//**
Starts a mini-transaction. */
UNIV_INLINE
void
mtr_start(
/*======*/
mtr_t* mtr) /*!< out: mini-transaction */
{
mtr_start_trx(mtr, NULL);
}
MY_ATTRIBUTE((nonnull))
MY_ATTRIBUTE((nonnull));
/***************************************************************//**
Commits a mini-transaction. */
UNIV_INTERN
Expand Down Expand Up @@ -417,7 +404,6 @@ struct mtr_t{
#ifdef UNIV_DEBUG
ulint magic_n;
#endif /* UNIV_DEBUG */
trx_t* trx; /*!< transaction */
};

#ifdef UNIV_DEBUG
Expand Down
6 changes: 2 additions & 4 deletions storage/innobase/include/mtr0mtr.ic
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ mtr_block_dirtied(
Starts a mini-transaction. */
UNIV_INLINE
void
mtr_start_trx(
mtr_start(
/*======*/
mtr_t* mtr, /*!< out: mini-transaction */
trx_t* trx) /*!< in: transaction */
mtr_t* mtr) /*!< out: mini-transaction */
{
UNIV_MEM_INVALID(mtr, sizeof *mtr);

Expand All @@ -59,7 +58,6 @@ mtr_start_trx(
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);
Expand Down
13 changes: 11 additions & 2 deletions storage/innobase/include/trx0undo.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,22 @@ 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(
trx_undo_truncate_end_func(
/*=======================*/
trx_t* trx, /*!< in: transaction whose undo log it is */
#ifdef UNIV_DEBUG
const trx_t* trx, /*!< in: transaction whose undo log it is */
#endif /* UNIV_DEBUG */
trx_undo_t* undo, /*!< in/out: undo log */
undo_no_t limit) /*!< in: all undo records with undo number
>= this value should be truncated */
MY_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
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/row/row0ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ 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,
NULL);
buf, ext->max_len, zip_size, field, f_len);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions storage/innobase/row/row0ftsort.cc
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,7 @@ fts_parallel_tokenization(
doc.text.f_str =
btr_copy_externally_stored_field(
&doc.text.f_len, data,
zip_size, data_len, blob_heap,
NULL);
zip_size, data_len, blob_heap);
} else {
doc.text.f_str = data;
doc.text.f_len = data_len;
Expand Down
Loading

0 comments on commit 706ed85

Please sign in to comment.