2009-05-27 11:45:59 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
|
2012-08-01 16:27:34 +02:00
|
|
|
Copyright (c) 1997, 2009, Oracle and/or its affiliates. All Rights Reserved.
|
2009-05-27 11:45:59 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
2012-08-01 16:27:34 +02:00
|
|
|
this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
2009-05-27 11:45:59 +02:00
|
|
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/**************************************************//**
|
|
|
|
@file include/read0read.ic
|
|
|
|
Cursor read
|
|
|
|
|
|
|
|
Created 2/16/1997 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
/*********************************************************************//**
|
|
|
|
Checks if a read view sees the specified transaction.
|
|
|
|
@return TRUE if sees */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
read_view_sees_trx_id(
|
|
|
|
/*==================*/
|
|
|
|
const read_view_t* view, /*!< in: read view */
|
|
|
|
trx_id_t trx_id) /*!< in: trx id */
|
|
|
|
{
|
2010-06-23 13:06:59 +02:00
|
|
|
if (trx_id < view->up_limit_id) {
|
2009-05-27 11:45:59 +02:00
|
|
|
|
|
|
|
return(TRUE);
|
2012-08-01 16:27:34 +02:00
|
|
|
} else if (trx_id >= view->low_limit_id) {
|
2009-05-27 11:45:59 +02:00
|
|
|
|
|
|
|
return(FALSE);
|
2012-08-01 16:27:34 +02:00
|
|
|
} else {
|
|
|
|
ulint lower = 0;
|
|
|
|
ulint upper = view->n_trx_ids - 1;
|
|
|
|
|
|
|
|
ut_a(view->n_trx_ids > 0);
|
|
|
|
|
|
|
|
do {
|
|
|
|
ulint mid = (lower + upper) >> 1;
|
|
|
|
trx_id_t mid_id = view->trx_ids[mid];
|
|
|
|
|
|
|
|
if (mid_id == trx_id) {
|
|
|
|
return(FALSE);
|
|
|
|
} else if (mid_id < trx_id) {
|
|
|
|
if (mid > 0) {
|
|
|
|
upper = mid - 1;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
lower = mid + 1;
|
|
|
|
}
|
|
|
|
} while (lower <= upper);
|
2009-05-27 11:45:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|