mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
1d7747aa25
ut0ut.c Merge changes in InnoDB-3.23.43b trx0purge.c Merge changes in InnoDB-3.23.43b trx0rec.c Merge changes in InnoDB-3.23.43b trx0trx.c Merge changes in InnoDB-3.23.43b trx0undo.c Merge changes in InnoDB-3.23.43b thr0loc.c Merge changes in InnoDB-3.23.43b sync0arr.c Merge changes in InnoDB-3.23.43b sync0rw.c Merge changes in InnoDB-3.23.43b sync0sync.c Merge changes in InnoDB-3.23.43b srv0srv.c Merge changes in InnoDB-3.23.43b srv0start.c Merge changes in InnoDB-3.23.43b row0ins.c Merge changes in InnoDB-3.23.43b row0mysql.c Merge changes in InnoDB-3.23.43b row0purge.c Merge changes in InnoDB-3.23.43b row0sel.c Merge changes in InnoDB-3.23.43b row0umod.c Merge changes in InnoDB-3.23.43b row0upd.c Merge changes in InnoDB-3.23.43b row0vers.c Merge changes in InnoDB-3.23.43b rem0cmp.c Merge changes in InnoDB-3.23.43b que0que.c Merge changes in InnoDB-3.23.43b pars0opt.c Merge changes in InnoDB-3.23.43b pars0pars.c Merge changes in InnoDB-3.23.43b lexyy.c Merge changes in InnoDB-3.23.43b pars0grm.c Merge changes in InnoDB-3.23.43b page0page.c Merge changes in InnoDB-3.23.43b os0file.c Merge changes in InnoDB-3.23.43b mtr0log.c Merge changes in InnoDB-3.23.43b mem0pool.c Merge changes in InnoDB-3.23.43b log0log.c Merge changes in InnoDB-3.23.43b log0recv.c Merge changes in InnoDB-3.23.43b lock0lock.c Merge changes in InnoDB-3.23.43b ibuf0ibuf.c Merge changes in InnoDB-3.23.43b fil0fil.c Merge changes in InnoDB-3.23.43b dict0crea.c Merge changes in InnoDB-3.23.43b dict0dict.c Merge changes in InnoDB-3.23.43b dict0load.c Merge changes in InnoDB-3.23.43b dict0mem.c Merge changes in InnoDB-3.23.43b data0data.c Merge changes in InnoDB-3.23.43b data0type.c Merge changes in InnoDB-3.23.43b buf0buf.c Merge changes in InnoDB-3.23.43b buf0lru.c Merge changes in InnoDB-3.23.43b btr0btr.c Merge changes in InnoDB-3.23.43b btr0cur.c Merge changes in InnoDB-3.23.43b btr0pcur.c Merge changes in InnoDB-3.23.43b btr0sea.c Merge changes in InnoDB-3.23.43b data0type.ic Merge changes in InnoDB-3.23.43b dict0dict.ic Merge changes in InnoDB-3.23.43b mtr0mtr.ic Merge changes in InnoDB-3.23.43b row0upd.ic Merge changes in InnoDB-3.23.43b sync0ipm.ic Merge changes in InnoDB-3.23.43b sync0rw.ic Merge changes in InnoDB-3.23.43b sync0sync.ic Merge changes in InnoDB-3.23.43b trx0rseg.ic Merge changes in InnoDB-3.23.43b btr0pcur.ic Merge changes in InnoDB-3.23.43b buf0buf.ic Merge changes in InnoDB-3.23.43b data0data.ic Merge changes in InnoDB-3.23.43b row0upd.h Merge changes in InnoDB-3.23.43b srv0srv.h Merge changes in InnoDB-3.23.43b sync0arr.h Merge changes in InnoDB-3.23.43b sync0rw.h Merge changes in InnoDB-3.23.43b sync0sync.h Merge changes in InnoDB-3.23.43b trx0trx.h Merge changes in InnoDB-3.23.43b ut0mem.h Merge changes in InnoDB-3.23.43b data0data.h Merge changes in InnoDB-3.23.43b data0type.h Merge changes in InnoDB-3.23.43b db0err.h Merge changes in InnoDB-3.23.43b dict0crea.h Merge changes in InnoDB-3.23.43b dict0dict.h Merge changes in InnoDB-3.23.43b dict0load.h Merge changes in InnoDB-3.23.43b dict0mem.h Merge changes in InnoDB-3.23.43b dict0types.h Merge changes in InnoDB-3.23.43b fil0fil.h Merge changes in InnoDB-3.23.43b ibuf0ibuf.h Merge changes in InnoDB-3.23.43b lock0lock.h Merge changes in InnoDB-3.23.43b log0log.h Merge changes in InnoDB-3.23.43b mtr0mtr.h Merge changes in InnoDB-3.23.43b rem0cmp.h Merge changes in InnoDB-3.23.43b row0ins.h Merge changes in InnoDB-3.23.43b row0mysql.h Merge changes in InnoDB-3.23.43b btr0cur.h Merge changes in InnoDB-3.23.43b btr0pcur.h Merge changes in InnoDB-3.23.43b btr0sea.h Merge changes in InnoDB-3.23.43b buf0buf.h Merge changes in InnoDB-3.23.43b sql_table.cc Merge changes in InnoDB-3.23.43b sql_db.cc Merge changes in InnoDB-3.23.43b ha_innobase.cc Merge changes in InnoDB-3.23.43b handler.cc Merge changes in InnoDB-3.23.43b ha_innobase.h Merge changes in InnoDB-3.23.43b handler.h Merge changes in InnoDB-3.23.43b
120 lines
2.9 KiB
Text
120 lines
2.9 KiB
Text
/******************************************************
|
|
Rollback segment
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
Created 3/26/1996 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#include "srv0srv.h"
|
|
|
|
/**********************************************************************
|
|
Gets a rollback segment header. */
|
|
UNIV_INLINE
|
|
trx_rsegf_t*
|
|
trx_rsegf_get(
|
|
/*==========*/
|
|
/* out: rollback segment header, page
|
|
x-latched */
|
|
ulint space, /* in: space where placed */
|
|
ulint page_no, /* in: page number of the header */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
trx_rsegf_t* header;
|
|
|
|
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
|
|
|
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER);
|
|
|
|
return(header);
|
|
}
|
|
|
|
/**********************************************************************
|
|
Gets a newly created rollback segment header. */
|
|
UNIV_INLINE
|
|
trx_rsegf_t*
|
|
trx_rsegf_get_new(
|
|
/*==============*/
|
|
/* out: rollback segment header, page
|
|
x-latched */
|
|
ulint space, /* in: space where placed */
|
|
ulint page_no, /* in: page number of the header */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
trx_rsegf_t* header;
|
|
|
|
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
|
|
|
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER_NEW);
|
|
|
|
return(header);
|
|
}
|
|
|
|
/*******************************************************************
|
|
Gets the file page number of the nth undo log slot. */
|
|
UNIV_INLINE
|
|
ulint
|
|
trx_rsegf_get_nth_undo(
|
|
/*===================*/
|
|
/* out: page number of the undo log segment */
|
|
trx_rsegf_t* rsegf, /* in: rollback segment header */
|
|
ulint n, /* in: index of slot */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
if (n >= TRX_RSEG_N_SLOTS) {
|
|
fprintf(stderr,
|
|
"InnoDB: Error: trying to get slot %lu of rseg\n", n);
|
|
ut_a(0);
|
|
}
|
|
|
|
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. */
|
|
UNIV_INLINE
|
|
void
|
|
trx_rsegf_set_nth_undo(
|
|
/*===================*/
|
|
trx_rsegf_t* rsegf, /* in: rollback segment header */
|
|
ulint n, /* in: index of slot */
|
|
ulint page_no,/* in: page number of the undo log segment */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
if (n >= TRX_RSEG_N_SLOTS) {
|
|
fprintf(stderr,
|
|
"InnoDB: Error: trying to set slot %lu of rseg\n", n);
|
|
ut_a(0);
|
|
}
|
|
|
|
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
|
|
page_no, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/********************************************************************
|
|
Looks for a free slot for an undo log segment. */
|
|
UNIV_INLINE
|
|
ulint
|
|
trx_rsegf_undo_find_free(
|
|
/*=====================*/
|
|
/* out: slot index or ULINT_UNDEFINED if not
|
|
found */
|
|
trx_rsegf_t* rsegf, /* in: rollback segment header */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
ulint i;
|
|
ulint page_no;
|
|
|
|
for (i = 0; i < TRX_RSEG_N_SLOTS; i++) {
|
|
|
|
page_no = trx_rsegf_get_nth_undo(rsegf, i, mtr);
|
|
|
|
if (page_no == FIL_NULL) {
|
|
|
|
return(i);
|
|
}
|
|
}
|
|
|
|
return(ULINT_UNDEFINED);
|
|
}
|