mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
98dc4142b2
innobase/dict/dict0mem.c: dict_mem_table_create(): Add a debug assertion. innobase/include/btr0btr.ic: btr_node_ptr_get_child_page_no(): Add a UNIV_UNLIKELY hint. Remove a buf_frame_align() call. innobase/include/btr0cur.ic: btr_cur_get_page(): Add a debug assertion. innobase/include/buf0buf.ic: buf_block_peek_if_too_old(): Replace if() with return(). buf_block_align(), buf_frame_align(): Add UNIV_UNLIKELY hints. innobase/include/data0type.ic: dtype_get_fixed_size(): Add UNIV_UNLIKELY hints. innobase/include/mem0mem.ic: Remove signedness warning in debug assertion. innobase/include/read0read.ic: read_view_sees_trx_id(): Eliminate a comparison inside loop. innobase/include/row0sel.ic: open_step(): Add UNIV_EXPECT hint. innobase/include/row0upd.ic: upd_field_set_field_no(): Add a UNIV_UNLIKELY hint. innobase/include/sync0rw.ic: Add UNIV_LIKELY and UNIV_UNLIKELY hints. rw_lock_x_lock_func_nowait(): Eliminate a function call. Replace ut_a() assertions with ut_ad(). innobase/include/trx0rseg.ic: Add UNIV_UNLIKELY hints. innobase/include/ut0rnd.ic: ut_fold_binary(): Eliminate a loop variable to avoid register spilling on x86.
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);
|
|
}
|