mariadb/innobase/include/row0sel.ic
unknown 98dc4142b2 InnoDB: Some low-level optimizations made based on OProfile results.
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.
2005-04-22 14:04:18 +03:00

88 lines
1.9 KiB
Text

/******************************************************
Select
(c) 1997 Innobase Oy
Created 12/19/1997 Heikki Tuuri
*******************************************************/
#include "que0que.h"
/*************************************************************************
Gets the plan node for the nth table in a join. */
UNIV_INLINE
plan_t*
sel_node_get_nth_plan(
/*==================*/
/* out: plan node */
sel_node_t* node, /* in: select node */
ulint i) /* in: get ith plan node */
{
ut_ad(i < node->n_tables);
return(node->plans + i);
}
/*************************************************************************
Resets the cursor defined by sel_node to the SEL_NODE_OPEN state, which means
that it will start fetching from the start of the result set again, regardless
of where it was before, and it will set intention locks on the tables. */
UNIV_INLINE
void
sel_node_reset_cursor(
/*==================*/
sel_node_t* node) /* in: select node */
{
node->state = SEL_NODE_OPEN;
}
/**************************************************************************
Performs an execution step of an open or close cursor statement node. */
UNIV_INLINE
que_thr_t*
open_step(
/*======*/
/* out: query thread to run next or NULL */
que_thr_t* thr) /* in: query thread */
{
sel_node_t* sel_node;
open_node_t* node;
ulint err;
ut_ad(thr);
node = thr->run_node;
ut_ad(que_node_get_type(node) == QUE_NODE_OPEN);
sel_node = node->cursor_def;
err = DB_SUCCESS;
if (node->op_type == ROW_SEL_OPEN_CURSOR) {
/* if (sel_node->state == SEL_NODE_CLOSED) { */
sel_node_reset_cursor(sel_node);
/* } else {
err = DB_ERROR;
} */
} else {
if (sel_node->state != SEL_NODE_CLOSED) {
sel_node->state = SEL_NODE_CLOSED;
} else {
err = DB_ERROR;
}
}
if (UNIV_EXPECT(err, DB_SUCCESS) != DB_SUCCESS) {
/* SQL error detected */
fprintf(stderr, "SQL error %lu\n", (ulong) err);
ut_error;
}
thr->run_node = que_node_get_parent(node);
return(thr);
}