1
/******************************************************
6
Created 3/26/1996 Heikki Tuuri
7
*******************************************************/
11
/**********************************************************************
12
Gets a rollback segment header. */
17
/* out: rollback segment header, page
19
ulint space, /* in: space where placed */
20
ulint page_no, /* in: page number of the header */
21
mtr_t* mtr) /* in: mtr */
25
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
27
#ifdef UNIV_SYNC_DEBUG
28
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER);
29
#endif /* UNIV_SYNC_DEBUG */
34
/**********************************************************************
35
Gets a newly created rollback segment header. */
40
/* out: rollback segment header, page
42
ulint space, /* in: space where placed */
43
ulint page_no, /* in: page number of the header */
44
mtr_t* mtr) /* in: mtr */
48
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
50
#ifdef UNIV_SYNC_DEBUG
51
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER_NEW);
52
#endif /* UNIV_SYNC_DEBUG */
57
/*******************************************************************
58
Gets the file page number of the nth undo log slot. */
61
trx_rsegf_get_nth_undo(
62
/*===================*/
63
/* out: page number of the undo log segment */
64
trx_rsegf_t* rsegf, /* in: rollback segment header */
65
ulint n, /* in: index of slot */
66
mtr_t* mtr) /* in: mtr */
68
if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
70
"InnoDB: Error: trying to get slot %lu of rseg\n",
75
return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS
76
+ n * TRX_RSEG_SLOT_SIZE, MLOG_4BYTES, mtr));
79
/*******************************************************************
80
Sets the file page number of the nth undo log slot. */
83
trx_rsegf_set_nth_undo(
84
/*===================*/
85
trx_rsegf_t* rsegf, /* in: rollback segment header */
86
ulint n, /* in: index of slot */
87
ulint page_no,/* in: page number of the undo log segment */
88
mtr_t* mtr) /* in: mtr */
90
if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
92
"InnoDB: Error: trying to set slot %lu of rseg\n",
97
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
98
page_no, MLOG_4BYTES, mtr);
101
/********************************************************************
102
Looks for a free slot for an undo log segment. */
105
trx_rsegf_undo_find_free(
106
/*=====================*/
107
/* out: slot index or ULINT_UNDEFINED if not
109
trx_rsegf_t* rsegf, /* in: rollback segment header */
110
mtr_t* mtr) /* in: mtr */
115
for (i = 0; i < TRX_RSEG_N_SLOTS; i++) {
117
page_no = trx_rsegf_get_nth_undo(rsegf, i, mtr);
119
if (page_no == FIL_NULL) {
125
return(ULINT_UNDEFINED);