diff options
author | Guilhem Bichot <guilhem@mysql.com> | 2009-08-07 12:16:00 +0200 |
---|---|---|
committer | Guilhem Bichot <guilhem@mysql.com> | 2009-08-07 12:16:00 +0200 |
commit | 7ceb29ff17047a268d8e8670478f6e1669939904 (patch) | |
tree | 65b42f5cb11f29ea5b4414ff075ccafd48569ad6 /storage/innobase/include/read0read.ic | |
parent | 7fa1449eac29401b3d1f3fb4980149e9e562a705 (diff) | |
download | mariadb-git-7ceb29ff17047a268d8e8670478f6e1669939904.tar.gz |
Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same
layout as we always had in trees containing only the builtin
2) win\configure.js WITH_INNOBASE_STORAGE_ENGINE still works.
storage/innobase/CMakeLists.txt:
fix to new directory name (and like 5.1)
storage/innobase/Makefile.am:
fix to new directory name (and like 5.1)
storage/innobase/handler/ha_innodb.cc:
fix to new directory name (and like 5.1)
storage/innobase/plug.in:
fix to new directory name (and like 5.1)
Diffstat (limited to 'storage/innobase/include/read0read.ic')
-rw-r--r-- | storage/innobase/include/read0read.ic | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/storage/innobase/include/read0read.ic b/storage/innobase/include/read0read.ic new file mode 100644 index 00000000000..9924967cc2d --- /dev/null +++ b/storage/innobase/include/read0read.ic @@ -0,0 +1,98 @@ +/***************************************************************************** + +Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. + +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 +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +*****************************************************************************/ + +/**************************************************//** +@file include/read0read.ic +Cursor read + +Created 2/16/1997 Heikki Tuuri +*******************************************************/ + +/*********************************************************************//** +Gets the nth trx id in a read view. +@return trx id */ +UNIV_INLINE +trx_id_t +read_view_get_nth_trx_id( +/*=====================*/ + const 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 */ + trx_id_t 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. +@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 */ +{ + 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); +} |