Commit a20340cf authored by Marko Mäkelä's avatar Marko Mäkelä

Hard-code innodb_page_size as the undo log page size.

InnoDB undo logs currently always use the innodb_page_size,
whether they are stored in the system tablespace, in a
dedicated undo tablespace, or in the temporary tablespace.
Remove redundant page_size parameters.

TrxUndoRsegsIterator::set_next(): return bool instead of page_size.
parent 0ef91c89
......@@ -210,11 +210,8 @@ struct TrxUndoRsegsIterator {
TrxUndoRsegsIterator();
/** Sets the next rseg to purge in purge_sys.
@return page size of the table for which the log is.
NOTE: if rseg is NULL when this function returns this means that
there are no rollback segments to purge and then the returned page
size object should not be used. */
const page_size_t set_next();
@return whether anything is to be purged */
bool set_next();
private:
// Disable copying
......
......@@ -35,7 +35,6 @@ Created 3/26/1996 Heikki Tuuri
/** Gets a rollback segment header.
@param[in] space space where placed
@param[in] page_no page number of the header
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return rollback segment header, page x-latched */
UNIV_INLINE
......@@ -43,13 +42,11 @@ trx_rsegf_t*
trx_rsegf_get(
ulint space,
ulint page_no,
const page_size_t& page_size,
mtr_t* mtr);
/** Gets a newly created rollback segment header.
@param[in] space space where placed
@param[in] page_no page number of the header
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return rollback segment header, page x-latched */
UNIV_INLINE
......@@ -57,7 +54,6 @@ trx_rsegf_t*
trx_rsegf_get_new(
ulint space,
ulint page_no,
const page_size_t& page_size,
mtr_t* mtr);
/***************************************************************//**
......@@ -104,7 +100,6 @@ trx_rseg_get_on_id(ulint id)
This function is called only when a new rollback segment is created in
the database.
@param[in] space space id
@param[in] page_size page size
@param[in] max_size max size in pages
@param[in] rseg_slot_no rseg id == slot number in trx sys
@param[in,out] mtr mini-transaction
......@@ -112,7 +107,6 @@ the database.
ulint
trx_rseg_header_create(
ulint space,
const page_size_t& page_size,
ulint max_size,
ulint rseg_slot_no,
mtr_t* mtr);
......@@ -168,9 +162,6 @@ struct trx_rseg_t {
/** page number of the rollback segment header */
ulint page_no;
/** page size of the relevant tablespace */
page_size_t page_size;
/** maximum allowed size in pages */
ulint max_size;
......
......@@ -30,7 +30,6 @@ Created 3/26/1996 Heikki Tuuri
/** Gets a rollback segment header.
@param[in] space space where placed
@param[in] page_no page number of the header
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return rollback segment header, page x-latched */
UNIV_INLINE
......@@ -38,14 +37,15 @@ trx_rsegf_t*
trx_rsegf_get(
ulint space,
ulint page_no,
const page_size_t& page_size,
mtr_t* mtr)
{
buf_block_t* block;
trx_rsegf_t* header;
ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID);
block = buf_page_get(
page_id_t(space, page_no), page_size, RW_X_LATCH, mtr);
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER);
......@@ -57,7 +57,6 @@ trx_rsegf_get(
/** Gets a newly created rollback segment header.
@param[in] space space where placed
@param[in] page_no page number of the header
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return rollback segment header, page x-latched */
UNIV_INLINE
......@@ -65,14 +64,15 @@ trx_rsegf_t*
trx_rsegf_get_new(
ulint space,
ulint page_no,
const page_size_t& page_size,
mtr_t* mtr)
{
buf_block_t* block;
trx_rsegf_t* header;
ut_ad(space <= srv_undo_tablespaces || space == SRV_TMP_SPACE_ID);
block = buf_page_get(
page_id_t(space, page_no), page_size, RW_X_LATCH, mtr);
page_id_t(space, page_no), univ_page_size, RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_RSEG_HEADER_NEW);
......
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
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
......@@ -98,27 +99,19 @@ trx_read_roll_ptr(
/** Gets an undo log page and x-latches it.
@param[in] page_id page id
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return pointer to page x-latched */
UNIV_INLINE
page_t*
trx_undo_page_get(
const page_id_t& page_id,
const page_size_t& page_size,
mtr_t* mtr);
trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr);
/** Gets an undo log page and s-latches it.
@param[in] page_id page id
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return pointer to page s-latched */
UNIV_INLINE
page_t*
trx_undo_page_get_s_latched(
const page_id_t& page_id,
const page_size_t& page_size,
mtr_t* mtr);
trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr);
/******************************************************************//**
Returns the previous undo record on the page in the specified log, or
......@@ -188,7 +181,6 @@ trx_undo_get_next_rec(
/** Gets the first record in an undo log.
@param[in] space undo log header space
@param[in] page_size page size
@param[in] page_no undo log header page number
@param[in] offset undo log header offset on page
@param[in] mode latching mode: RW_S_LATCH or RW_X_LATCH
......@@ -197,7 +189,6 @@ trx_undo_get_next_rec(
trx_undo_rec_t*
trx_undo_get_first_rec(
ulint space,
const page_size_t& page_size,
ulint page_no,
ulint offset,
ulint mode,
......@@ -455,7 +446,6 @@ struct trx_undo_t {
/*-----------------------------*/
ulint space; /*!< space id where the undo log
placed */
page_size_t page_size;
ulint hdr_page_no; /*!< page number of the header page in
the undo log */
ulint hdr_offset; /*!< header offset of the undo log on
......
/*****************************************************************************
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
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
......@@ -153,17 +154,13 @@ trx_read_roll_ptr(
/** Gets an undo log page and x-latches it.
@param[in] page_id page id
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return pointer to page x-latched */
UNIV_INLINE
page_t*
trx_undo_page_get(
const page_id_t& page_id,
const page_size_t& page_size,
mtr_t* mtr)
trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr)
{
buf_block_t* block = buf_page_get(page_id, page_size,
buf_block_t* block = buf_page_get(page_id, univ_page_size,
RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
......@@ -173,17 +170,13 @@ trx_undo_page_get(
/** Gets an undo log page and s-latches it.
@param[in] page_id page id
@param[in] page_size page size
@param[in,out] mtr mini-transaction
@return pointer to page s-latched */
UNIV_INLINE
page_t*
trx_undo_page_get_s_latched(
const page_id_t& page_id,
const page_size_t& page_size,
mtr_t* mtr)
trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr)
{
buf_block_t* block = buf_page_get(page_id, page_size,
buf_block_t* block = buf_page_get(page_id, univ_page_size,
RW_S_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
......
/*****************************************************************************
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
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
......
......@@ -1047,8 +1047,7 @@ srv_undo_tablespaces_init(
if (space_id == *it) {
trx_rseg_header_create(
*it, univ_page_size, ULINT_MAX,
i, &mtr);
*it, ULINT_MAX, i, &mtr);
}
}
......
......@@ -81,11 +81,9 @@ TrxUndoRsegsIterator::TrxUndoRsegsIterator()
}
/** Sets the next rseg to purge in purge_sys.
@return page size of the table for which the log is.
NOTE: if rseg is NULL when this function returns this means that
there are no rollback segments to purge and then the returned page
size object should not be used. */
const page_size_t
@return whether anything is to be purged */
inline
bool
TrxUndoRsegsIterator::set_next()
{
mutex_enter(&purge_sys->pq_mutex);
......@@ -141,9 +139,7 @@ TrxUndoRsegsIterator::set_next()
mutex_exit(&purge_sys->pq_mutex);
purge_sys->rseg = NULL;
/* return a dummy object, not going to be used by the caller */
return(univ_page_size);
return false;
}
purge_sys->rseg = *m_iter++;
......@@ -164,8 +160,6 @@ TrxUndoRsegsIterator::set_next()
|| is_system_tablespace(
purge_sys->rseg->space));
const page_size_t page_size(purge_sys->rseg->page_size);
ut_a(purge_sys->iter.trx_no <= purge_sys->rseg->last_trx_no);
purge_sys->iter.trx_no = purge_sys->rseg->last_trx_no;
......@@ -174,7 +168,7 @@ TrxUndoRsegsIterator::set_next()
mutex_exit(&purge_sys->rseg->mutex);
return(page_size);
return(true);
}
/** Build a purge 'query' graph. The actual purge is performed by executing
......@@ -275,9 +269,7 @@ trx_purge_add_update_undo_to_history(
undo = undo_ptr->update_undo;
rseg = undo->rseg;
rseg_header = trx_rsegf_get(
undo->rseg->space, undo->rseg->page_no, undo->rseg->page_size,
mtr);
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
undo_header = undo_page + undo->hdr_offset;
......@@ -385,12 +377,10 @@ trx_purge_free_segment(
mutex_enter(&rseg->mutex);
rseg_hdr = trx_rsegf_get(
rseg->space, rseg->page_no, rseg->page_size, &mtr);
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr);
undo_page = trx_undo_page_get(
page_id_t(rseg->space, hdr_addr.page), rseg->page_size,
&mtr);
page_id_t(rseg->space, hdr_addr.page), &mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
log_hdr = undo_page + hdr_addr.boffset;
......@@ -483,8 +473,7 @@ trx_purge_truncate_rseg_history(
}
mutex_enter(&(rseg->mutex));
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no,
rseg->page_size, &mtr);
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr);
hdr_addr = trx_purge_get_log_from_hist(
flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr));
......@@ -499,7 +488,7 @@ trx_purge_truncate_rseg_history(
}
undo_page = trx_undo_page_get(page_id_t(rseg->space, hdr_addr.page),
rseg->page_size, &mtr);
&mtr);
log_hdr = undo_page + hdr_addr.boffset;
......@@ -554,8 +543,7 @@ trx_purge_truncate_rseg_history(
}
mutex_enter(&(rseg->mutex));
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no,
rseg->page_size, &mtr);
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr);
hdr_addr = prev_hdr_addr;
......@@ -1189,8 +1177,7 @@ trx_purge_rseg_get_next_history_log(
mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(
page_id_t(rseg->space, rseg->last_page_no),
rseg->page_size, &mtr);
page_id_t(rseg->space, rseg->last_page_no), &mtr);
log_hdr = undo_page + rseg->last_offset;
......@@ -1242,7 +1229,7 @@ trx_purge_rseg_get_next_history_log(
log_hdr = trx_undo_page_get_s_latched(page_id_t(rseg->space,
prev_log_addr.page),
rseg->page_size, &mtr)
&mtr)
+ prev_log_addr.boffset;
trx_no = mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO);
......@@ -1275,12 +1262,10 @@ trx_purge_rseg_get_next_history_log(
mutex_exit(&rseg->mutex);
}
/** Position the purge sys "iterator" on the undo record to use for purging.
@param[in] page_size page size */
/** Position the purge sys "iterator" on the undo record to use for purging. */
static
void
trx_purge_read_undo_rec(
const page_size_t& page_size)
trx_purge_read_undo_rec()
{
ulint offset;
ulint page_no;
......@@ -1298,7 +1283,6 @@ trx_purge_read_undo_rec(
undo_rec = trx_undo_get_first_rec(
purge_sys->rseg->space,
page_size,
purge_sys->hdr_page_no,
purge_sys->hdr_offset, RW_S_LATCH, &mtr);
......@@ -1340,10 +1324,8 @@ trx_purge_choose_next_log(void)
{
ut_ad(!purge_sys->next_stored);
const page_size_t& page_size = purge_sys->rseg_iter.set_next();
if (purge_sys->rseg != NULL) {
trx_purge_read_undo_rec(page_size);
if (purge_sys->rseg_iter.set_next()) {
trx_purge_read_undo_rec();
} else {
/* There is nothing to do yet. */
os_thread_yield();
......@@ -1378,8 +1360,6 @@ trx_purge_get_next_rec(
page_no = purge_sys->page_no;
offset = purge_sys->offset;
const page_size_t page_size(purge_sys->rseg->page_size);
if (offset == 0) {
/* It is the dummy undo log record, which means that there is
no need to purge this undo log */
......@@ -1397,7 +1377,7 @@ trx_purge_get_next_rec(
mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(page_id_t(space, page_no),
page_size, &mtr);
&mtr);
rec = undo_page + offset;
......@@ -1455,7 +1435,7 @@ trx_purge_get_next_rec(
mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(
page_id_t(space, page_no), page_size, &mtr);
page_id_t(space, page_no), &mtr);
rec = undo_page + offset;
} else {
......
......@@ -1972,7 +1972,7 @@ trx_undo_report_row_operation(
page_no = undo->last_page_no;
undo_block = buf_page_get_gen(
page_id_t(undo->space, page_no), undo->page_size, RW_X_LATCH,
page_id_t(undo->space, page_no), univ_page_size, RW_X_LATCH,
buf_pool_is_obsolete(undo->withdraw_clock)
? NULL : undo->guess_block, BUF_GET, __FILE__, __LINE__,
&mtr, &err);
......@@ -2127,8 +2127,7 @@ trx_undo_get_undo_rec_low(
mtr_start(&mtr);
undo_page = trx_undo_page_get_s_latched(
page_id_t(rseg->space, page_no), rseg->page_size,
&mtr);
page_id_t(rseg->space, page_no), &mtr);
undo_rec = trx_undo_rec_copy(undo_page + offset, heap);
......
......@@ -930,8 +930,7 @@ trx_roll_pop_top_rec(
ut_ad(mutex_own(&trx->undo_mutex));
page_t* undo_page = trx_undo_page_get_s_latched(
page_id_t(undo->space, undo->top_page_no),
undo->page_size, mtr);
page_id_t(undo->space, undo->top_page_no), mtr);
ulint offset = undo->top_offset;
......
......@@ -43,7 +43,6 @@ Created 3/26/1996 Heikki Tuuri
This function is called only when a new rollback segment is created in
the database.
@param[in] space space id
@param[in] page_size page size
@param[in] max_size max size in pages
@param[in] rseg_slot_no rseg id == slot number in trx sys
@param[in,out] mtr mini-transaction
......@@ -51,7 +50,6 @@ the database.
ulint
trx_rseg_header_create(
ulint space,
const page_size_t& page_size,
ulint max_size,
ulint rseg_slot_no,
mtr_t* mtr)
......@@ -80,7 +78,7 @@ trx_rseg_header_create(
page_no = block->page.id.page_no();
/* Get the rollback segment file page */
rsegf = trx_rsegf_get_new(space, page_no, page_size, mtr);
rsegf = trx_rsegf_get_new(space, page_no, mtr);
/* Initialize max size field */
mlog_write_ulint(rsegf + TRX_RSEG_MAX_SIZE, max_size,
......@@ -166,7 +164,6 @@ array in the trx system object.
@param[in] id rollback segment id
@param[in] space space where the segment is placed
@param[in] page_no page number of the segment header
@param[in] page_size page size
@param[in,out] mtr mini-transaction */
static
void
......@@ -174,7 +171,6 @@ trx_rseg_mem_create(
ulint id,
ulint space,
ulint page_no,
const page_size_t& page_size,
mtr_t* mtr)
{
ulint len;
......@@ -188,7 +184,6 @@ trx_rseg_mem_create(
rseg->id = id;
rseg->space = space;
rseg->page_size.copy_from(page_size);
rseg->page_no = page_no;
rseg->trx_ref_count = 0;
rseg->skip_allocation = false;
......@@ -206,7 +201,7 @@ trx_rseg_mem_create(
trx_sys->rseg_array[id] = rseg;
rseg_header = trx_rsegf_get_new(space, page_no, page_size, mtr);
rseg_header = trx_rsegf_get_new(space, page_no, mtr);
rseg->max_size = mtr_read_ulint(
rseg_header + TRX_RSEG_MAX_SIZE, MLOG_4BYTES, mtr);
......@@ -231,8 +226,8 @@ trx_rseg_mem_create(
rseg->last_offset = node_addr.boffset;
undo_log_hdr = trx_undo_page_get(
page_id_t(rseg->space, node_addr.page),
rseg->page_size, mtr) + node_addr.boffset;
page_id_t(rseg->space, node_addr.page), mtr)
+ node_addr.boffset;
rseg->last_trx_no = mach_read_from_8(
undo_log_hdr + TRX_UNDO_TRX_NO);
......@@ -262,29 +257,17 @@ trx_rseg_array_init()
mtr_t mtr;
for (ulint i = 0; i < TRX_SYS_N_RSEGS; i++) {
ut_a(!trx_rseg_get_on_id(i));
ulint page_no;
ut_ad(!trx_rseg_get_on_id(i));
mtr.start();
trx_sysf_t* sys_header = trx_sysf_get(&mtr);
page_no = trx_sysf_rseg_get_page_no(sys_header, i, &mtr);
ulint page_no = trx_sysf_rseg_get_page_no(
sys_header, i, &mtr);
if (page_no != FIL_NULL) {
ulint space;
space = trx_sysf_rseg_get_space(sys_header, i, &mtr);
bool found = true;
const page_size_t& page_size
= is_system_tablespace(space)
? univ_page_size
: fil_space_get_page_size(space, &found);
ut_ad(found);
trx_rseg_mem_create(
i, space, page_no, page_size, &mtr);
i,
trx_sysf_rseg_get_space(sys_header, i, &mtr),
page_no, &mtr);
}
mtr.commit();
......@@ -320,13 +303,11 @@ trx_rseg_create(
break;
}
page_size_t page_size(space->flags);
ulint slot_no = trx_sysf_rseg_find_free(
&mtr, space->purpose == FIL_TYPE_TEMPORARY, nth_free_slot);
ulint page_no = slot_no == ULINT_UNDEFINED
? FIL_NULL
: trx_rseg_header_create(
space_id, page_size, ULINT_MAX, slot_no, &mtr);
: trx_rseg_header_create(space_id, ULINT_MAX, slot_no, &mtr);
if (page_no != FIL_NULL) {
trx_sysf_t* sys_header = trx_sysf_get(&mtr);
......@@ -335,8 +316,7 @@ trx_rseg_create(
sys_header, slot_no, &mtr);
ut_a(id == space_id || trx_sys_is_noredo_rseg_slot(slot_no));
trx_rseg_mem_create(
slot_no, space_id, page_no, page_size, &mtr);
trx_rseg_mem_create(slot_no, space_id, page_no, &mtr);
}
mtr.commit();
......
......@@ -224,10 +224,6 @@ trx_sys_update_mysql_binlog_offset(
return;
}
if (sys_header == NULL) {
sys_header = trx_sysf_get(mtr);
}
if (mach_read_from_4(sys_header + field
+ TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
!= TRX_SYS_MYSQL_LOG_MAGIC_N) {
......@@ -571,7 +567,7 @@ trx_sysf_create(
/* Create the first rollback segment in the SYSTEM tablespace */
slot_no = trx_sysf_rseg_find_free(mtr, false, 0);
page_no = trx_rseg_header_create(TRX_SYS_SPACE, univ_page_size,
page_no = trx_rseg_header_create(TRX_SYS_SPACE,
ULINT_MAX, slot_no, mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
......
......@@ -750,8 +750,7 @@ trx_resurrect_table_locks(
/* trx_rseg_mem_create() may have acquired an X-latch on this
page, so we cannot acquire an S-latch. */
undo_page = trx_undo_page_get(
page_id_t(undo->space, undo->top_page_no), undo->page_size,
&mtr);
page_id_t(undo->space, undo->top_page_no), &mtr);
undo_rec = undo_page + undo->top_offset;
......@@ -1577,8 +1576,6 @@ trx_write_serialisation_history(
trx_t* trx, /*!< in/out: transaction */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
trx_sysf_t* sys_header = NULL;
/* Change the undo log segment states from TRX_UNDO_ACTIVE to some
other state: these modifications to the file data structure define
the transaction as committed in the file based domain, at the
......@@ -1698,8 +1695,8 @@ trx_write_serialisation_history(
MONITOR_INC(MONITOR_TRX_COMMIT_UNDO);
trx_sysf_t* sys_header = trx_sysf_get(mtr);
#ifdef WITH_WSREP
sys_header = trx_sysf_get(mtr);
/* Update latest MySQL wsrep XID in trx sys header. */
if (wsrep_is_wsrep_xid(trx->xid)) {
trx_sys_update_wsrep_checkpoint(trx->xid, sys_header, mtr);
......
......@@ -178,14 +178,8 @@ trx_undo_get_prev_rec_from_prev_page(
space = page_get_space_id(undo_page);
bool found;
const page_size_t& page_size = fil_space_get_page_size(space,
&found);
ut_ad(found);
buf_block_t* block = buf_page_get(
page_id_t(space, prev_page_no), page_size,
page_id_t(space, prev_page_no), univ_page_size,
shared ? RW_S_LATCH : RW_X_LATCH, mtr);
buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
......@@ -225,7 +219,6 @@ trx_undo_get_prev_rec(
/** Gets the next record in an undo log from the next page.
@param[in] space undo log header space
@param[in] page_size page size
@param[in] undo_page undo log page
@param[in] page_no undo log header page number
@param[in] offset undo log header offset on page
......@@ -236,7 +229,6 @@ static
trx_undo_rec_t*
trx_undo_get_next_rec_from_next_page(
ulint space,
const page_size_t& page_size,
const page_t* undo_page,
ulint page_no,
ulint offset,
......@@ -271,10 +263,10 @@ trx_undo_get_next_rec_from_next_page(
if (mode == RW_S_LATCH) {
next_page = trx_undo_page_get_s_latched(
next_page_id, page_size, mtr);
next_page_id, mtr);
} else {
ut_ad(mode == RW_X_LATCH);
next_page = trx_undo_page_get(next_page_id, page_size, mtr);
next_page = trx_undo_page_get(next_page_id, mtr);
}
return(trx_undo_page_get_first_rec(next_page, page_no, offset));
......@@ -302,13 +294,7 @@ trx_undo_get_next_rec(
space = page_get_space_id(page_align(rec));
bool found;
const page_size_t& page_size = fil_space_get_page_size(space,
&found);
ut_ad(found);
return(trx_undo_get_next_rec_from_next_page(space, page_size,
return(trx_undo_get_next_rec_from_next_page(space,
page_align(rec),
page_no, offset,
RW_S_LATCH, mtr));
......@@ -316,7 +302,6 @@ trx_undo_get_next_rec(
/** Gets the first record in an undo log.
@param[in] space undo log header space
@param[in] page_size page size
@param[in] page_no undo log header page number
@param[in] offset undo log header offset on page
@param[in] mode latching mode: RW_S_LATCH or RW_X_LATCH
......@@ -325,7 +310,6 @@ trx_undo_get_next_rec(
trx_undo_rec_t*
trx_undo_get_first_rec(
ulint space,
const page_size_t& page_size,
ulint page_no,
ulint offset,
ulint mode,
......@@ -337,10 +321,9 @@ trx_undo_get_first_rec(
const page_id_t page_id(space, page_no);
if (mode == RW_S_LATCH) {
undo_page = trx_undo_page_get_s_latched(
page_id, page_size, mtr);
undo_page = trx_undo_page_get_s_latched(page_id, mtr);
} else {
undo_page = trx_undo_page_get(page_id, page_size, mtr);
undo_page = trx_undo_page_get(page_id, mtr);
}
rec = trx_undo_page_get_first_rec(undo_page, page_no, offset);
......@@ -349,7 +332,7 @@ trx_undo_get_first_rec(
return(rec);
}
return(trx_undo_get_next_rec_from_next_page(space, page_size,
return(trx_undo_get_next_rec_from_next_page(space,
undo_page, page_no, offset,
mode, mtr));
}
......@@ -911,8 +894,7 @@ trx_undo_add_page(
}
header_page = trx_undo_page_get(
page_id_t(undo->space, undo->hdr_page_no),
undo->page_size, mtr);
page_id_t(undo->space, undo->hdr_page_no), mtr);
if (!fsp_reserve_free_extents(&n_reserved, undo->space, 1,
FSP_UNDO, mtr)) {
......@@ -977,11 +959,9 @@ trx_undo_free_page(
ut_a(hdr_page_no != page_no);
ut_ad(mutex_own(&(rseg->mutex)));
undo_page = trx_undo_page_get(
page_id_t(space, page_no), rseg->page_size, mtr);
undo_page = trx_undo_page_get(page_id_t(space, page_no), mtr);
header_page = trx_undo_page_get(
page_id_t(space, hdr_page_no), rseg->page_size, mtr);
header_page = trx_undo_page_get(page_id_t(space, hdr_page_no), mtr);
flst_remove(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST,
undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr);
......@@ -994,8 +974,7 @@ trx_undo_free_page(
rseg->curr_size--;
if (in_history) {
rseg_header = trx_rsegf_get(space, rseg->page_no,
rseg->page_size, mtr);
rseg_header = trx_rsegf_get(space, rseg->page_no, mtr);
hist_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
MLOG_4BYTES, mtr);
......@@ -1036,7 +1015,6 @@ trx_undo_free_last_page_func(
Other undo logs may still have records on that page, if it is an update
undo log.
@param[in] space space
@param[in] page_size page size
@param[in] hdr_page_no header page number
@param[in] hdr_offset header offset
@param[in,out] mtr mini-transaction */
......@@ -1044,7 +1022,6 @@ static
void
trx_undo_empty_header_page(
ulint space,
const page_size_t& page_size,
ulint hdr_page_no,
ulint hdr_offset,
mtr_t* mtr)
......@@ -1053,8 +1030,7 @@ trx_undo_empty_header_page(
trx_ulogf_t* log_hdr;
ulint end;
header_page = trx_undo_page_get(
page_id_t(space, hdr_page_no), page_size, mtr);
header_page = trx_undo_page_get(page_id_t(space, hdr_page_no), mtr);
log_hdr = header_page + hdr_offset;
......@@ -1099,8 +1075,7 @@ trx_undo_truncate_end_func(
last_page_no = undo->last_page_no;
undo_page = trx_undo_page_get(
page_id_t(undo->space, last_page_no),
undo->page_size, &mtr);
page_id_t(undo->space, last_page_no), &mtr);
rec = trx_undo_page_get_last_rec(undo_page, undo->hdr_page_no,
undo->hdr_offset);
......@@ -1172,8 +1147,7 @@ trx_undo_truncate_start(
mtr.set_log_mode(MTR_LOG_NO_REDO);
}
rec = trx_undo_get_first_rec(rseg->space, rseg->page_size,
hdr_page_no, hdr_offset,
rec = trx_undo_get_first_rec(rseg->space, hdr_page_no, hdr_offset,
RW_X_LATCH, &mtr);
if (rec == NULL) {
/* Already empty */
......@@ -1197,7 +1171,7 @@ trx_undo_truncate_start(
page_no = page_get_page_no(undo_page);
if (page_no == hdr_page_no) {
trx_undo_empty_header_page(rseg->space, rseg->page_size,
trx_undo_empty_header_page(rseg->space,
hdr_page_no, hdr_offset,
&mtr);
} else {
......@@ -1240,7 +1214,7 @@ trx_undo_seg_free(
seg_header = trx_undo_page_get(page_id_t(undo->space,
undo->hdr_page_no),
undo->page_size, &mtr)
&mtr)
+ TRX_UNDO_SEG_HDR;
file_seg = seg_header + TRX_UNDO_FSEG_HEADER;
......@@ -1250,8 +1224,7 @@ trx_undo_seg_free(
if (finished) {
/* Update the rseg header */
rseg_header = trx_rsegf_get(
rseg->space, rseg->page_no, rseg->page_size,
&mtr);
rseg->space, rseg->page_no, &mtr);
trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL,
&mtr);
......@@ -1296,8 +1269,7 @@ trx_undo_mem_create_at_db_start(
ut_a(id < TRX_RSEG_N_SLOTS);
undo_page = trx_undo_page_get(
page_id_t(rseg->space, page_no), rseg->page_size, mtr);
undo_page = trx_undo_page_get(page_id_t(rseg->space, page_no), mtr);
page_header = undo_page + TRX_UNDO_PAGE_HDR;
......@@ -1349,8 +1321,7 @@ trx_undo_mem_create_at_db_start(
undo->top_page_no = last_addr.page;
last_page = trx_undo_page_get(
page_id_t(rseg->space, undo->last_page_no),
rseg->page_size, mtr);
page_id_t(rseg->space, undo->last_page_no), mtr);
rec = trx_undo_page_get_last_rec(last_page, page_no, offset);
......@@ -1405,8 +1376,7 @@ trx_undo_lists_init(
mtr_start(&mtr);
rseg_header = trx_rsegf_get_new(
rseg->space, rseg->page_no, rseg->page_size, &mtr);
rseg_header = trx_rsegf_get_new(rseg->space, rseg->page_no, &mtr);
for (i = 0; i < TRX_RSEG_N_SLOTS; i++) {
ulint page_no;
......@@ -1433,8 +1403,7 @@ trx_undo_lists_init(
mtr_start(&mtr);
rseg_header = trx_rsegf_get(
rseg->space, rseg->page_no, rseg->page_size,
&mtr);
rseg->space, rseg->page_no, &mtr);
/* Found a used slot */
MONITOR_INC(MONITOR_NUM_UNDO_SLOT_USED);
......@@ -1488,7 +1457,6 @@ trx_undo_mem_create(
undo->rseg = rseg;
undo->space = rseg->space;
undo->page_size.copy_from(rseg->page_size);
undo->hdr_page_no = page_no;
undo->hdr_offset = offset;
undo->last_page_no = page_no;
......@@ -1577,8 +1545,7 @@ trx_undo_create(
rseg->curr_size++;
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no,
rseg->page_size, mtr);
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
err = trx_undo_seg_create(rseg, rseg_header, type, &id,
&undo_page, mtr);
......@@ -1660,8 +1627,7 @@ trx_undo_reuse_cached(
ut_a(undo->id < TRX_RSEG_N_SLOTS);
undo_page = trx_undo_page_get(
page_id_t(undo->space, undo->hdr_page_no),
undo->page_size, mtr);
page_id_t(undo->space, undo->hdr_page_no), mtr);
if (type == TRX_UNDO_INSERT) {
offset = trx_undo_insert_header_reuse(undo_page, trx_id, mtr);
......@@ -1698,8 +1664,7 @@ trx_undo_mark_as_dict_operation(
page_t* hdr_page;
hdr_page = trx_undo_page_get(
page_id_t(undo->space, undo->hdr_page_no),
undo->page_size, mtr);
page_id_t(undo->space, undo->hdr_page_no), mtr);
switch (trx_get_dict_operation(trx)) {
case TRX_DICT_OP_NONE:
......@@ -1828,8 +1793,7 @@ trx_undo_set_state_at_finish(
ut_a(undo->id < TRX_RSEG_N_SLOTS);
undo_page = trx_undo_page_get(
page_id_t(undo->space, undo->hdr_page_no),
undo->page_size, mtr);
page_id_t(undo->space, undo->hdr_page_no), mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
......@@ -1877,8 +1841,7 @@ trx_undo_set_state_at_prepare(
ut_a(undo->id < TRX_RSEG_N_SLOTS);
undo_page = trx_undo_page_get(
page_id_t(undo->space, undo->hdr_page_no),
undo->page_size, mtr);
page_id_t(undo->space, undo->hdr_page_no), mtr);
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
......@@ -2123,10 +2086,9 @@ trx_undo_truncate_tablespace(
trx_rseg_t* rseg = undo_trunc->get_ith_rseg(i);
rseg->page_no = trx_rseg_header_create(
space_id, univ_page_size, ULINT_MAX, rseg->id, &mtr);
space_id, ULINT_MAX, rseg->id, &mtr);
rseg_header = trx_rsegf_get_new(
space_id, rseg->page_no, rseg->page_size, &mtr);
rseg_header = trx_rsegf_get_new(space_id, rseg->page_no, &mtr);
/* Before re-initialization ensure that we free the existing
structure. There can't be any active transactions. */
......
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