mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 07:44:22 +01:00
cee82bca29
into dl145b.mysql.com:/home/ndbdev/tomas/mysql-5.1 sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/mysqld.cc: Auto merged storage/innobase/btr/btr0btr.c: Auto merged storage/innobase/btr/btr0cur.c: Auto merged storage/innobase/btr/btr0pcur.c: Auto merged storage/innobase/btr/btr0sea.c: Auto merged storage/innobase/buf/buf0buf.c: Auto merged storage/innobase/buf/buf0flu.c: Auto merged storage/innobase/buf/buf0lru.c: Auto merged storage/innobase/buf/buf0rea.c: Auto merged storage/innobase/data/data0data.c: Auto merged storage/innobase/data/data0type.c: Auto merged storage/innobase/dict/dict0boot.c: Auto merged storage/innobase/dict/dict0crea.c: Auto merged storage/innobase/dict/dict0dict.c: Auto merged storage/innobase/dict/dict0mem.c: Auto merged storage/innobase/fil/fil0fil.c: Auto merged storage/innobase/fsp/fsp0fsp.c: Auto merged storage/innobase/ibuf/ibuf0ibuf.c: Auto merged storage/innobase/include/btr0btr.h: Auto merged storage/innobase/include/btr0btr.ic: Auto merged storage/innobase/include/btr0cur.h: Auto merged storage/innobase/include/btr0cur.ic: Auto merged storage/innobase/include/buf0buf.h: Auto merged storage/innobase/include/buf0buf.ic: Auto merged storage/innobase/include/buf0lru.h: Auto merged storage/innobase/include/data0type.h: Auto merged storage/innobase/include/data0type.ic: Auto merged storage/innobase/include/dyn0dyn.h: Auto merged storage/innobase/include/dyn0dyn.ic: Auto merged storage/innobase/include/lock0lock.h: Auto merged storage/innobase/include/log0log.h: Auto merged storage/innobase/include/mach0data.h: Auto merged storage/innobase/include/mach0data.ic: Auto merged storage/innobase/include/mem0mem.ic: Auto merged storage/innobase/include/mtr0log.h: Auto merged storage/innobase/include/mtr0mtr.h: Auto merged storage/innobase/include/os0file.h: Auto merged storage/innobase/include/page0cur.h: Auto merged storage/innobase/include/page0cur.ic: Auto merged storage/innobase/include/page0page.h: Auto merged storage/innobase/include/page0page.ic: Auto merged storage/innobase/include/read0read.ic: Auto merged storage/innobase/include/rem0rec.h: Auto merged storage/innobase/include/rem0rec.ic: Auto merged storage/innobase/include/row0mysql.h: Auto merged storage/innobase/include/row0sel.ic: Auto merged storage/innobase/include/row0upd.ic: Auto merged storage/innobase/include/sync0rw.ic: Auto merged storage/innobase/include/trx0rseg.ic: Auto merged storage/innobase/include/trx0trx.h: Auto merged storage/innobase/include/univ.i: Auto merged storage/innobase/include/ut0dbg.h: Auto merged storage/innobase/include/ut0rnd.ic: Auto merged storage/innobase/lock/lock0lock.c: Auto merged storage/innobase/log/log0log.c: Auto merged storage/innobase/log/log0recv.c: Auto merged storage/innobase/mtr/mtr0log.c: Auto merged storage/innobase/mtr/mtr0mtr.c: Auto merged storage/innobase/os/os0file.c: Auto merged storage/innobase/page/page0cur.c: Auto merged storage/innobase/page/page0page.c: Auto merged storage/innobase/rem/rem0cmp.c: Auto merged storage/innobase/rem/rem0rec.c: Auto merged storage/innobase/row/row0ins.c: Auto merged storage/innobase/row/row0mysql.c: Auto merged storage/innobase/row/row0purge.c: Auto merged storage/innobase/row/row0row.c: Auto merged storage/innobase/row/row0sel.c: Auto merged storage/innobase/row/row0undo.c: Auto merged storage/innobase/row/row0upd.c: Auto merged storage/innobase/row/row0vers.c: Auto merged storage/innobase/srv/srv0start.c: Auto merged storage/innobase/sync/sync0sync.c: Auto merged storage/innobase/trx/trx0rec.c: Auto merged storage/innobase/trx/trx0roll.c: Auto merged storage/innobase/trx/trx0trx.c: Auto merged storage/innobase/ut/ut0dbg.c: Auto merged
80 lines
1.8 KiB
Text
80 lines
1.8 KiB
Text
/******************************************************
|
|
Cursor read
|
|
|
|
(c) 1997 Innobase Oy
|
|
|
|
Created 2/16/1997 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
/*************************************************************************
|
|
Gets the nth trx id in a read view. */
|
|
UNIV_INLINE
|
|
dulint
|
|
read_view_get_nth_trx_id(
|
|
/*=====================*/
|
|
/* out: trx id */
|
|
read_view_t* view, /* in: read view */
|
|
ulint n) /* in: position */
|
|
{
|
|
ut_ad(n < view->n_trx_ids);
|
|
|
|
return(*(view->trx_ids + n));
|
|
}
|
|
|
|
/*************************************************************************
|
|
Sets the nth trx id in a read view. */
|
|
UNIV_INLINE
|
|
void
|
|
read_view_set_nth_trx_id(
|
|
/*=====================*/
|
|
read_view_t* view, /* in: read view */
|
|
ulint n, /* in: position */
|
|
dulint trx_id) /* in: trx id to set */
|
|
{
|
|
ut_ad(n < view->n_trx_ids);
|
|
|
|
*(view->trx_ids + n) = trx_id;
|
|
}
|
|
|
|
/*************************************************************************
|
|
Checks if a read view sees the specified transaction. */
|
|
UNIV_INLINE
|
|
ibool
|
|
read_view_sees_trx_id(
|
|
/*==================*/
|
|
/* out: TRUE if sees */
|
|
read_view_t* view, /* in: read view */
|
|
dulint trx_id) /* in: trx id */
|
|
{
|
|
ulint n_ids;
|
|
int cmp;
|
|
ulint i;
|
|
|
|
if (ut_dulint_cmp(trx_id, view->up_limit_id) < 0) {
|
|
|
|
return(TRUE);
|
|
}
|
|
|
|
if (ut_dulint_cmp(trx_id, view->low_limit_id) >= 0) {
|
|
|
|
return(FALSE);
|
|
}
|
|
|
|
/* We go through the trx ids in the array smallest first: this order
|
|
may save CPU time, because if there was a very long running
|
|
transaction in the trx id array, its trx id is looked at first, and
|
|
the first two comparisons may well decide the visibility of trx_id. */
|
|
|
|
n_ids = view->n_trx_ids;
|
|
|
|
for (i = 0; i < n_ids; i++) {
|
|
|
|
cmp = ut_dulint_cmp(trx_id,
|
|
read_view_get_nth_trx_id(view, n_ids - i - 1));
|
|
if (cmp <= 0) {
|
|
return(cmp < 0);
|
|
}
|
|
}
|
|
|
|
return(TRUE);
|
|
}
|