Commit 648e8c12 authored by Marko Mäkelä's avatar Marko Mäkelä

Remove unnecessary function parameters

trx_rseg_get_nth_undo(), trx_rsegf_undo_find_free():
Add a const qualifier, and remove the unused parameter mtr_t*.
parent 8d1d38f9
...@@ -57,16 +57,6 @@ trx_rsegf_get_new( ...@@ -57,16 +57,6 @@ trx_rsegf_get_new(
mtr_t* mtr); mtr_t* mtr);
/***************************************************************//** /***************************************************************//**
Gets the file page number of the nth undo log slot.
@return page number of the undo log segment */
UNIV_INLINE
ulint
trx_rsegf_get_nth_undo(
/*===================*/
trx_rsegf_t* rsegf, /*!< in: rollback segment header */
ulint n, /*!< in: index of slot */
mtr_t* mtr); /*!< in: mtr */
/***************************************************************//**
Sets the file page number of the nth undo log slot. */ Sets the file page number of the nth undo log slot. */
UNIV_INLINE UNIV_INLINE
void void
...@@ -81,10 +71,7 @@ Looks for a free slot for an undo log segment. ...@@ -81,10 +71,7 @@ Looks for a free slot for an undo log segment.
@return slot index or ULINT_UNDEFINED if not found */ @return slot index or ULINT_UNDEFINED if not found */
UNIV_INLINE UNIV_INLINE
ulint ulint
trx_rsegf_undo_find_free( trx_rsegf_undo_find_free(const trx_rsegf_t* rsegf);
/*=====================*/
trx_rsegf_t* rsegf, /*!< in: rollback segment header */
mtr_t* mtr); /*!< in: mtr */
/** Creates a rollback segment header. /** Creates a rollback segment header.
This function is called only when a new rollback segment is created in This function is called only when a new rollback segment is created in
...@@ -243,6 +230,18 @@ struct trx_rseg_t { ...@@ -243,6 +230,18 @@ struct trx_rseg_t {
/* Undo log segment slots */ /* Undo log segment slots */
/*-------------------------------------------------------------*/ /*-------------------------------------------------------------*/
/** Read the page number of an undo log slot.
@param[in] rsegf rollback segment header
@param[in] n slot number */
inline
uint32_t
trx_rsegf_get_nth_undo(const trx_rsegf_t* rsegf, ulint n)
{
ut_ad(n < TRX_RSEG_N_SLOTS);
return mach_read_from_4(rsegf + TRX_RSEG_UNDO_SLOTS
+ n * TRX_RSEG_SLOT_SIZE);
}
#include "trx0rseg.ic" #include "trx0rseg.ic"
#endif #endif
...@@ -85,23 +85,6 @@ trx_rsegf_get_new( ...@@ -85,23 +85,6 @@ trx_rsegf_get_new(
return(header); return(header);
} }
/***************************************************************//**
Gets the file page number of the nth undo log slot.
@return page number of the undo log segment */
UNIV_INLINE
ulint
trx_rsegf_get_nth_undo(
/*===================*/
trx_rsegf_t* rsegf, /*!< in: rollback segment header */
ulint n, /*!< in: index of slot */
mtr_t* mtr) /*!< in: mtr */
{
ut_a(n < TRX_RSEG_N_SLOTS);
return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS
+ n * TRX_RSEG_SLOT_SIZE, MLOG_4BYTES, mtr));
}
/***************************************************************//** /***************************************************************//**
Sets the file page number of the nth undo log slot. */ Sets the file page number of the nth undo log slot. */
UNIV_INLINE UNIV_INLINE
...@@ -124,10 +107,7 @@ Looks for a free slot for an undo log segment. ...@@ -124,10 +107,7 @@ Looks for a free slot for an undo log segment.
@return slot index or ULINT_UNDEFINED if not found */ @return slot index or ULINT_UNDEFINED if not found */
UNIV_INLINE UNIV_INLINE
ulint ulint
trx_rsegf_undo_find_free( trx_rsegf_undo_find_free(const trx_rsegf_t* rsegf)
/*=====================*/
trx_rsegf_t* rsegf, /*!< in: rollback segment header */
mtr_t* mtr) /*!< in: mtr */
{ {
ulint i; ulint i;
ulint page_no; ulint page_no;
...@@ -141,7 +121,7 @@ trx_rsegf_undo_find_free( ...@@ -141,7 +121,7 @@ trx_rsegf_undo_find_free(
#endif #endif
for (i = 0; i < max_slots; i++) { for (i = 0; i < max_slots; i++) {
page_no = trx_rsegf_get_nth_undo(rsegf, i, mtr); page_no = trx_rsegf_get_nth_undo(rsegf, i);
if (page_no == FIL_NULL) { if (page_no == FIL_NULL) {
return(i); return(i);
......
...@@ -433,7 +433,7 @@ trx_undo_seg_create(trx_rsegf_t* rseg_hdr, ulint* id, dberr_t* err, mtr_t* mtr) ...@@ -433,7 +433,7 @@ trx_undo_seg_create(trx_rsegf_t* rseg_hdr, ulint* id, dberr_t* err, mtr_t* mtr)
ulint n_reserved; ulint n_reserved;
bool success; bool success;
slot_no = trx_rsegf_undo_find_free(rseg_hdr, mtr); slot_no = trx_rsegf_undo_find_free(rseg_hdr);
if (slot_no == ULINT_UNDEFINED) { if (slot_no == ULINT_UNDEFINED) {
ib::warn() << "Cannot find a free slot for an undo log. Do" ib::warn() << "Cannot find a free slot for an undo log. Do"
...@@ -1150,9 +1150,7 @@ trx_undo_lists_init( ...@@ -1150,9 +1150,7 @@ trx_undo_lists_init(
rseg_header = trx_rsegf_get_new(rseg->space, rseg->page_no, &mtr); rseg_header = trx_rsegf_get_new(rseg->space, rseg->page_no, &mtr);
for (i = 0; i < TRX_RSEG_N_SLOTS; i++) { for (i = 0; i < TRX_RSEG_N_SLOTS; i++) {
ulint page_no; uint32_t page_no = trx_rsegf_get_nth_undo(rseg_header, i);
page_no = trx_rsegf_get_nth_undo(rseg_header, i, &mtr);
/* In forced recovery: try to avoid operations which look /* In forced recovery: try to avoid operations which look
at database pages; undo logs are rapidly changing data, and at database pages; undo logs are rapidly changing data, and
......
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