2001-02-17 14:19:19 +02:00
|
|
|
/************************************************************************
|
|
|
|
The page cursor
|
|
|
|
|
|
|
|
(c) 1994-1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 10/4/1994 Heikki Tuuri
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef page0cur_h
|
|
|
|
#define page0cur_h
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
|
|
|
|
#include "page0types.h"
|
|
|
|
#include "page0page.h"
|
|
|
|
#include "rem0rec.h"
|
|
|
|
#include "data0data.h"
|
|
|
|
#include "mtr0mtr.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define PAGE_CUR_ADAPT
|
|
|
|
|
|
|
|
/* Page cursor search modes; the values must be in this order! */
|
|
|
|
|
|
|
|
#define PAGE_CUR_G 1
|
|
|
|
#define PAGE_CUR_GE 2
|
|
|
|
#define PAGE_CUR_L 3
|
|
|
|
#define PAGE_CUR_LE 4
|
2005-06-30 11:15:06 +03:00
|
|
|
/*#define PAGE_CUR_LE_OR_EXTENDS 5*/ /* This is a search mode used in
|
Many files:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
mysqld.cc:
Change MySQL default isolation level to REPEATABLE READ; note that InnoDB has always had that default, and BDB and MyISAM always run at SERIALIZABLE level anyway
sql/mysqld.cc:
Change MySQL default isolation level to REPEATABLE READ; note that InnoDB has always had that default, and BDB and MyISAM always run at SERIALIZABLE level anyway
sql/ha_innodb.cc:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
sql/ha_innodb.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/buf0buf.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/dict0dict.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/fil0fil.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/lock0lock.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0file.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0proc.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0thread.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/page0cur.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/page0page.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/read0read.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/rem0rec.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/srv0srv.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/sync0rw.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/sync0sync.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/trx0purge.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/trx0trx.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/rem0rec.ic:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0btr.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0cur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0pcur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/buf/buf0buf.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/buf/buf0flu.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/dict/dict0dict.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/fil/fil0fil.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/fsp/fsp0fsp.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/ibuf/ibuf0ibuf.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/lock/lock0lock.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/mem/mem0dbg.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/os/os0file.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/os/os0proc.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/page/page0cur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/page/page0page.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/pars/lexyy.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/pars/pars0grm.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/read/read0read.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0ins.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0mysql.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0purge.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0sel.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0uins.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0undo.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0upd.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/srv/srv0srv.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/srv/srv0start.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/sync/sync0rw.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/sync/sync0sync.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/trx/trx0purge.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/trx/trx0trx.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
2002-10-29 23:16:46 +02:00
|
|
|
"column LIKE 'abc%' ORDER BY column DESC";
|
|
|
|
we have to find strings which are <= 'abc' or
|
|
|
|
which extend it */
|
2005-06-30 11:15:06 +03:00
|
|
|
#ifdef UNIV_SEARCH_DEBUG
|
|
|
|
# define PAGE_CUR_DBG 6 /* As PAGE_CUR_LE, but skips search shortcut */
|
|
|
|
#endif /* UNIV_SEARCH_DEBUG */
|
Many files:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
mysqld.cc:
Change MySQL default isolation level to REPEATABLE READ; note that InnoDB has always had that default, and BDB and MyISAM always run at SERIALIZABLE level anyway
sql/mysqld.cc:
Change MySQL default isolation level to REPEATABLE READ; note that InnoDB has always had that default, and BDB and MyISAM always run at SERIALIZABLE level anyway
sql/ha_innodb.cc:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
sql/ha_innodb.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/buf0buf.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/dict0dict.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/fil0fil.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/lock0lock.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0file.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0proc.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/os0thread.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/page0cur.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/page0page.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/read0read.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/rem0rec.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/srv0srv.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/sync0rw.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/sync0sync.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/trx0purge.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/trx0trx.h:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/include/rem0rec.ic:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0btr.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0cur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/btr/btr0pcur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/buf/buf0buf.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/buf/buf0flu.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/dict/dict0dict.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/fil/fil0fil.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/fsp/fsp0fsp.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/ibuf/ibuf0ibuf.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/lock/lock0lock.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/mem/mem0dbg.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/os/os0file.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/os/os0proc.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/page/page0cur.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/page/page0page.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/pars/lexyy.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/pars/pars0grm.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/read/read0read.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0ins.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0mysql.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0purge.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0sel.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0uins.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0undo.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/row/row0upd.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/srv/srv0srv.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/srv/srv0start.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/sync/sync0rw.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/sync/sync0sync.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/trx/trx0purge.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
innobase/trx/trx0trx.c:
Merge InnoDB-4.0.5: new isolation levels READ COMMITTED and READ UNCOMMITTED now supported, selective deadlock resolution
2002-10-29 23:16:46 +02:00
|
|
|
|
2004-03-16 18:55:44 +02:00
|
|
|
#ifdef PAGE_CUR_ADAPT
|
|
|
|
# ifdef UNIV_SEARCH_PERF_STAT
|
2001-02-17 14:19:19 +02:00
|
|
|
extern ulint page_cur_short_succ;
|
2004-03-16 18:55:44 +02:00
|
|
|
# endif /* UNIV_SEARCH_PERF_STAT */
|
|
|
|
#endif /* PAGE_CUR_ADAPT */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
/*************************************************************
|
|
|
|
Gets pointer to the page frame where the cursor is positioned. */
|
|
|
|
UNIV_INLINE
|
|
|
|
page_t*
|
|
|
|
page_cur_get_page(
|
|
|
|
/*==============*/
|
|
|
|
/* out: page */
|
|
|
|
page_cur_t* cur); /* in: page cursor */
|
|
|
|
/*************************************************************
|
|
|
|
Gets the record where the cursor is positioned. */
|
|
|
|
UNIV_INLINE
|
|
|
|
rec_t*
|
|
|
|
page_cur_get_rec(
|
|
|
|
/*=============*/
|
|
|
|
/* out: record */
|
|
|
|
page_cur_t* cur); /* in: page cursor */
|
|
|
|
/*************************************************************
|
|
|
|
Sets the cursor object to point before the first user record
|
|
|
|
on the page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
page_cur_set_before_first(
|
|
|
|
/*======================*/
|
|
|
|
page_t* page, /* in: index page */
|
|
|
|
page_cur_t* cur); /* in: cursor */
|
|
|
|
/*************************************************************
|
|
|
|
Sets the cursor object to point after the last user record on
|
|
|
|
the page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
page_cur_set_after_last(
|
|
|
|
/*====================*/
|
|
|
|
page_t* page, /* in: index page */
|
|
|
|
page_cur_t* cur); /* in: cursor */
|
|
|
|
/*************************************************************
|
|
|
|
Returns TRUE if the cursor is before first user record on page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
page_cur_is_before_first(
|
|
|
|
/*=====================*/
|
InnoDB: Performance optimizations based on OProfile analysis
innobase/btr/btr0btr.c:
Eliminate some buf_frame_align() calls.
Make use of the page_rec_is_infimum(), page_rec_is_supremum()
and page_rec_is_user_rec() functions.
Replace some index->table->comp with page_is_comp().
Eliminate some variables to reduce register spilling on x86.
Note that page_is_comp() may return nonzero instead of TRUE.
Note that rec_offs_comp() may return nonzero instead of TRUE.
innobase/btr/btr0cur.c:
Eliminate some buf_frame_align() calls.
Replace some index->table->comp with
page_is_comp() or rec_offs_comp().
Eliminate some variables to reduce register spilling on x86.
Note that page_is_comp() may return nonzero instead of TRUE.
Note that rec_offs_comp() may return nonzero instead of TRUE.
Remove an extra mem_heap_create() call from btr_cur_update_in_place().
Add "page" parameter to lock_rec_store_on_page_infimum().
Add some UNIV_LIKELY() and UNIV_UNLIKELY() hints.
btr_estimate_number_of_different_key_vals(): Rename the
offsets_* variables to be more descriptive and eliminate one
rec_get_offsets() and one page_rec_get_next() call in the loop.
innobase/btr/btr0pcur.c:
Eliminate some buf_frame_align() calls.
Make use of the page_rec_is_infimum(), page_rec_is_supremum()
and page_rec_is_user_rec() functions.
Replace some index->table->comp with page_is_comp().
Eliminate some variables to reduce register spilling on x86.
Note that page_is_comp() may return nonzero instead of TRUE.
Make some ut_a() assertions ut_ad() ones to improve performance.
Add some UNIV_LIKELY() and UNIV_UNLIKELY() hints.
innobase/btr/btr0sea.c:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
Eliminate some buf_frame_align() calls.
Add some UNIV_UNLIKELY and UNIV_LIKELY hints.
Turn some assertions into debug assertions.
innobase/dict/dict0crea.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp
innobase/ibuf/ibuf0ibuf.c:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
Add some UNIV_UNLIKELY and UNIV_LIKELY hints.
ibuf_get_merge_page_nos(): Rename parameter "first_rec" to "rec"
and eliminate local variable "rec".
innobase/include/btr0btr.h:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp
innobase/include/buf0buf.h:
Rename buf_frame_get_modify_clock()
to buf_block_get_modify_clock().
innobase/include/buf0buf.ic:
Rename buf_frame_get_modify_clock()
to buf_block_get_modify_clock() and
remove the buf_block_align() call.
innobase/include/lock0lock.h:
lock_rec_store_on_page_infimum(): Add parameter "page"
innobase/include/mach0data.h:
Add mach_encode_2() and mach_decode_2().
innobase/include/mach0data.ic:
Add mach_encode_2() and mach_decode_2().
innobase/include/page0cur.h:
Add const qualifier to page_cur_is_before_first()
and page_cur_is_after_last().
innobase/include/page0cur.ic:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
innobase/include/page0page.h:
Remove page_rec_is_first_user_rec() and page_rec_is_last_user_rec().
Add page_rec_is_infimum() and page_rec_is_supremum().
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/include/page0page.ic:
Remove page_rec_is_first_user_rec() and page_rec_is_last_user_rec().
Add page_rec_is_infimum() and page_rec_is_supremum().
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Add UNIV_UNLIKELY, UNIV_LIKELY and UNIV_EXPECT hints.
Reduce the number of buf_frame_align() calls.
innobase/include/rem0rec.ic:
rec_offs_comp(): Return zero or nonzero instead of FALSE or TRUE.
innobase/include/row0mysql.h:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/lock/lock0lock.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Remove parameter "comp" from lock_rec_get_next(),
lock_rec_has_expl() and lock_rec_other_has_expl_req().
Add parameter "page" to lock_rec_store_on_page_infimum().
Add UNIV_UNLIKELY hints.
Reduce the number of buf_frame_align() calls.
Make use of page_rec_is_infimum(), page_rec_is_supremum() and
page_rec_is_user_rec().
Move the "comp" flag outside some loops.
innobase/mtr/mtr0log.c:
Replace index->table->comp with page_rec_is_comp().
innobase/page/page0cur.c:
Replace index->table->comp with page_is_comp() or page_rec_is_comp().
Eliminate some buf_frame_align() calls.
Add some debug assertions.
innobase/page/page0page.c:
Optimize page_dir_find_owner_slot(). Compare the record offset
16 bits at a time, because that seems to be the only way to avoid
register spilling on x86.
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Remove parameter "page" of page_delete_rec_list_write_log().
Make use of page_rec_is_infimum().
innobase/rem/rem0cmp.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/row/row0ins.c:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
Reduce the amount of buf_frame_align() calls.
row_ins_index_entry_low(): Disable assertion about column count
unless #ifdef UNIV_DEBUG.
innobase/row/row0mysql.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/row/row0row.c:
Eliminate some buf_frame_align() calls.
Make use of page_rec_is_infimum().
innobase/row/row0sel.c:
Make use of page_rec_is_supremum() and page_rec_is_infimum().
Turn some assertions into debug assertions.
Add UNIV_LIKELY and UNIV_UNLIKELY hints.
row_search_for_mysql(): Eliminate local variables "moved",
"cons_read_requires_clust_rec", "was_lock_wait", "shortcut",
"success" and "comp". Replace some of them with goto's.
Disable variable "cnt" unless #ifdef UNIV_SEARCH_DEBUG.
innobase/row/row0vers.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Replace index->table->comp with page_rec_is_comp().
Eliminate some buf_frame_align() calls.
2005-04-25 10:14:35 +03:00
|
|
|
/* out: TRUE if at start */
|
|
|
|
const page_cur_t* cur); /* in: cursor */
|
2001-02-17 14:19:19 +02:00
|
|
|
/*************************************************************
|
|
|
|
Returns TRUE if the cursor is after last user record. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
page_cur_is_after_last(
|
|
|
|
/*===================*/
|
InnoDB: Performance optimizations based on OProfile analysis
innobase/btr/btr0btr.c:
Eliminate some buf_frame_align() calls.
Make use of the page_rec_is_infimum(), page_rec_is_supremum()
and page_rec_is_user_rec() functions.
Replace some index->table->comp with page_is_comp().
Eliminate some variables to reduce register spilling on x86.
Note that page_is_comp() may return nonzero instead of TRUE.
Note that rec_offs_comp() may return nonzero instead of TRUE.
innobase/btr/btr0cur.c:
Eliminate some buf_frame_align() calls.
Replace some index->table->comp with
page_is_comp() or rec_offs_comp().
Eliminate some variables to reduce register spilling on x86.
Note that page_is_comp() may return nonzero instead of TRUE.
Note that rec_offs_comp() may return nonzero instead of TRUE.
Remove an extra mem_heap_create() call from btr_cur_update_in_place().
Add "page" parameter to lock_rec_store_on_page_infimum().
Add some UNIV_LIKELY() and UNIV_UNLIKELY() hints.
btr_estimate_number_of_different_key_vals(): Rename the
offsets_* variables to be more descriptive and eliminate one
rec_get_offsets() and one page_rec_get_next() call in the loop.
innobase/btr/btr0pcur.c:
Eliminate some buf_frame_align() calls.
Make use of the page_rec_is_infimum(), page_rec_is_supremum()
and page_rec_is_user_rec() functions.
Replace some index->table->comp with page_is_comp().
Eliminate some variables to reduce register spilling on x86.
Note that page_is_comp() may return nonzero instead of TRUE.
Make some ut_a() assertions ut_ad() ones to improve performance.
Add some UNIV_LIKELY() and UNIV_UNLIKELY() hints.
innobase/btr/btr0sea.c:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
Eliminate some buf_frame_align() calls.
Add some UNIV_UNLIKELY and UNIV_LIKELY hints.
Turn some assertions into debug assertions.
innobase/dict/dict0crea.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp
innobase/ibuf/ibuf0ibuf.c:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
Add some UNIV_UNLIKELY and UNIV_LIKELY hints.
ibuf_get_merge_page_nos(): Rename parameter "first_rec" to "rec"
and eliminate local variable "rec".
innobase/include/btr0btr.h:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp
innobase/include/buf0buf.h:
Rename buf_frame_get_modify_clock()
to buf_block_get_modify_clock().
innobase/include/buf0buf.ic:
Rename buf_frame_get_modify_clock()
to buf_block_get_modify_clock() and
remove the buf_block_align() call.
innobase/include/lock0lock.h:
lock_rec_store_on_page_infimum(): Add parameter "page"
innobase/include/mach0data.h:
Add mach_encode_2() and mach_decode_2().
innobase/include/mach0data.ic:
Add mach_encode_2() and mach_decode_2().
innobase/include/page0cur.h:
Add const qualifier to page_cur_is_before_first()
and page_cur_is_after_last().
innobase/include/page0cur.ic:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
innobase/include/page0page.h:
Remove page_rec_is_first_user_rec() and page_rec_is_last_user_rec().
Add page_rec_is_infimum() and page_rec_is_supremum().
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/include/page0page.ic:
Remove page_rec_is_first_user_rec() and page_rec_is_last_user_rec().
Add page_rec_is_infimum() and page_rec_is_supremum().
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Add UNIV_UNLIKELY, UNIV_LIKELY and UNIV_EXPECT hints.
Reduce the number of buf_frame_align() calls.
innobase/include/rem0rec.ic:
rec_offs_comp(): Return zero or nonzero instead of FALSE or TRUE.
innobase/include/row0mysql.h:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/lock/lock0lock.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Remove parameter "comp" from lock_rec_get_next(),
lock_rec_has_expl() and lock_rec_other_has_expl_req().
Add parameter "page" to lock_rec_store_on_page_infimum().
Add UNIV_UNLIKELY hints.
Reduce the number of buf_frame_align() calls.
Make use of page_rec_is_infimum(), page_rec_is_supremum() and
page_rec_is_user_rec().
Move the "comp" flag outside some loops.
innobase/mtr/mtr0log.c:
Replace index->table->comp with page_rec_is_comp().
innobase/page/page0cur.c:
Replace index->table->comp with page_is_comp() or page_rec_is_comp().
Eliminate some buf_frame_align() calls.
Add some debug assertions.
innobase/page/page0page.c:
Optimize page_dir_find_owner_slot(). Compare the record offset
16 bits at a time, because that seems to be the only way to avoid
register spilling on x86.
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Remove parameter "page" of page_delete_rec_list_write_log().
Make use of page_rec_is_infimum().
innobase/rem/rem0cmp.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/row/row0ins.c:
Make use of page_rec_is_infimum() and page_rec_is_supremum().
Reduce the amount of buf_frame_align() calls.
row_ins_index_entry_low(): Disable assertion about column count
unless #ifdef UNIV_DEBUG.
innobase/row/row0mysql.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
innobase/row/row0row.c:
Eliminate some buf_frame_align() calls.
Make use of page_rec_is_infimum().
innobase/row/row0sel.c:
Make use of page_rec_is_supremum() and page_rec_is_infimum().
Turn some assertions into debug assertions.
Add UNIV_LIKELY and UNIV_UNLIKELY hints.
row_search_for_mysql(): Eliminate local variables "moved",
"cons_read_requires_clust_rec", "was_lock_wait", "shortcut",
"success" and "comp". Replace some of them with goto's.
Disable variable "cnt" unless #ifdef UNIV_SEARCH_DEBUG.
innobase/row/row0vers.c:
Replace FALSE/TRUE ibool comp with zero/nonzero ulint comp.
Replace index->table->comp with page_rec_is_comp().
Eliminate some buf_frame_align() calls.
2005-04-25 10:14:35 +03:00
|
|
|
/* out: TRUE if at end */
|
|
|
|
const page_cur_t* cur); /* in: cursor */
|
2001-02-17 14:19:19 +02:00
|
|
|
/**************************************************************
|
|
|
|
Positions the cursor on the given record. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
page_cur_position(
|
|
|
|
/*==============*/
|
|
|
|
rec_t* rec, /* in: record on a page */
|
|
|
|
page_cur_t* cur); /* in: page cursor */
|
|
|
|
/**************************************************************
|
|
|
|
Invalidates a page cursor by setting the record pointer NULL. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
page_cur_invalidate(
|
|
|
|
/*================*/
|
|
|
|
page_cur_t* cur); /* in: page cursor */
|
|
|
|
/**************************************************************
|
|
|
|
Moves the cursor to the next record on page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
page_cur_move_to_next(
|
|
|
|
/*==================*/
|
|
|
|
page_cur_t* cur); /* in: cursor; must not be after last */
|
|
|
|
/**************************************************************
|
|
|
|
Moves the cursor to the previous record on page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
page_cur_move_to_prev(
|
|
|
|
/*==================*/
|
|
|
|
page_cur_t* cur); /* in: cursor; must not before first */
|
|
|
|
/***************************************************************
|
|
|
|
Inserts a record next to page cursor. Returns pointer to inserted record if
|
|
|
|
succeed, i.e., enough space available, NULL otherwise. The cursor stays at
|
|
|
|
the same position. */
|
|
|
|
UNIV_INLINE
|
|
|
|
rec_t*
|
|
|
|
page_cur_tuple_insert(
|
|
|
|
/*==================*/
|
|
|
|
/* out: pointer to record if succeed, NULL
|
|
|
|
otherwise */
|
|
|
|
page_cur_t* cursor, /* in: a page cursor */
|
2004-12-02 19:45:07 +02:00
|
|
|
dtuple_t* tuple, /* in: pointer to a data tuple */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
2001-02-17 14:19:19 +02:00
|
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
|
|
/***************************************************************
|
|
|
|
Inserts a record next to page cursor. Returns pointer to inserted record if
|
|
|
|
succeed, i.e., enough space available, NULL otherwise. The cursor stays at
|
|
|
|
the same position. */
|
|
|
|
UNIV_INLINE
|
|
|
|
rec_t*
|
|
|
|
page_cur_rec_insert(
|
|
|
|
/*================*/
|
|
|
|
/* out: pointer to record if succeed, NULL
|
|
|
|
otherwise */
|
|
|
|
page_cur_t* cursor, /* in: a page cursor */
|
|
|
|
rec_t* rec, /* in: record to insert */
|
2004-12-02 19:45:07 +02:00
|
|
|
dict_index_t* index, /* in: record descriptor */
|
2005-01-25 12:10:24 +02:00
|
|
|
ulint* offsets,/* in: rec_get_offsets(rec, index) */
|
2001-02-17 14:19:19 +02:00
|
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
|
|
/***************************************************************
|
|
|
|
Inserts a record next to page cursor. Returns pointer to inserted record if
|
|
|
|
succeed, i.e., enough space available, NULL otherwise. The record to be
|
|
|
|
inserted can be in a data tuple or as a physical record. The other parameter
|
|
|
|
must then be NULL. The cursor stays at the same position. */
|
|
|
|
|
|
|
|
rec_t*
|
|
|
|
page_cur_insert_rec_low(
|
|
|
|
/*====================*/
|
|
|
|
/* out: pointer to record if succeed, NULL
|
|
|
|
otherwise */
|
|
|
|
page_cur_t* cursor, /* in: a page cursor */
|
2004-12-02 19:45:07 +02:00
|
|
|
dtuple_t* tuple, /* in: pointer to a data tuple or NULL */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
|
|
|
rec_t* rec, /* in: pointer to a physical record or NULL */
|
2005-01-25 12:10:24 +02:00
|
|
|
ulint* offsets,/* in: rec_get_offsets(rec, index) or NULL */
|
2001-02-17 14:19:19 +02:00
|
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
|
|
/*****************************************************************
|
|
|
|
Copies records from page to a newly created page, from a given record onward,
|
|
|
|
including that record. Infimum and supremum records are not copied. */
|
|
|
|
|
|
|
|
void
|
|
|
|
page_copy_rec_list_end_to_created_page(
|
|
|
|
/*===================================*/
|
2004-12-02 19:45:07 +02:00
|
|
|
page_t* new_page, /* in: index page to copy to */
|
|
|
|
page_t* page, /* in: index page */
|
|
|
|
rec_t* rec, /* in: first record to copy */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
|
|
|
mtr_t* mtr); /* in: mtr */
|
2001-02-17 14:19:19 +02:00
|
|
|
/***************************************************************
|
|
|
|
Deletes a record at the page cursor. The cursor is moved to the
|
|
|
|
next record after the deleted one. */
|
|
|
|
|
|
|
|
void
|
|
|
|
page_cur_delete_rec(
|
|
|
|
/*================*/
|
2005-03-01 13:54:48 +02:00
|
|
|
page_cur_t* cursor, /* in: a page cursor */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
|
|
|
const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */
|
|
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
2001-02-17 14:19:19 +02:00
|
|
|
/********************************************************************
|
|
|
|
Searches the right position for a page cursor. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
page_cur_search(
|
|
|
|
/*============*/
|
|
|
|
/* out: number of matched fields on the left */
|
|
|
|
page_t* page, /* in: index page */
|
2004-12-02 19:45:07 +02:00
|
|
|
dict_index_t* index, /* in: record descriptor */
|
2001-02-17 14:19:19 +02:00
|
|
|
dtuple_t* tuple, /* in: data tuple */
|
|
|
|
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
|
|
|
|
or PAGE_CUR_GE */
|
|
|
|
page_cur_t* cursor);/* out: page cursor */
|
|
|
|
/********************************************************************
|
|
|
|
Searches the right position for a page cursor. */
|
|
|
|
|
|
|
|
void
|
|
|
|
page_cur_search_with_match(
|
|
|
|
/*=======================*/
|
|
|
|
page_t* page, /* in: index page */
|
2004-12-02 19:45:07 +02:00
|
|
|
dict_index_t* index, /* in: record descriptor */
|
2001-02-17 14:19:19 +02:00
|
|
|
dtuple_t* tuple, /* in: data tuple */
|
|
|
|
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
|
|
|
|
or PAGE_CUR_GE */
|
|
|
|
ulint* iup_matched_fields,
|
|
|
|
/* in/out: already matched fields in upper
|
|
|
|
limit record */
|
|
|
|
ulint* iup_matched_bytes,
|
|
|
|
/* in/out: already matched bytes in a field
|
|
|
|
not yet completely matched */
|
|
|
|
ulint* ilow_matched_fields,
|
|
|
|
/* in/out: already matched fields in lower
|
|
|
|
limit record */
|
|
|
|
ulint* ilow_matched_bytes,
|
|
|
|
/* in/out: already matched bytes in a field
|
|
|
|
not yet completely matched */
|
|
|
|
page_cur_t* cursor); /* out: page cursor */
|
|
|
|
/***************************************************************
|
|
|
|
Positions a page cursor on a randomly chosen user record on a page. If there
|
|
|
|
are no user records, sets the cursor on the infimum record. */
|
|
|
|
|
|
|
|
void
|
|
|
|
page_cur_open_on_rnd_user_rec(
|
|
|
|
/*==========================*/
|
|
|
|
page_t* page, /* in: page */
|
|
|
|
page_cur_t* cursor);/* in/out: page cursor */
|
|
|
|
/***************************************************************
|
|
|
|
Parses a log record of a record insert on a page. */
|
|
|
|
|
|
|
|
byte*
|
|
|
|
page_cur_parse_insert_rec(
|
|
|
|
/*======================*/
|
2004-12-02 19:45:07 +02:00
|
|
|
/* out: end of log record or NULL */
|
|
|
|
ibool is_short,/* in: TRUE if short inserts */
|
|
|
|
byte* ptr, /* in: buffer */
|
|
|
|
byte* end_ptr,/* in: buffer end */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
|
|
|
page_t* page, /* in: page or NULL */
|
|
|
|
mtr_t* mtr); /* in: mtr or NULL */
|
2001-02-17 14:19:19 +02:00
|
|
|
/**************************************************************
|
|
|
|
Parses a log record of copying a record list end to a new created page. */
|
|
|
|
|
|
|
|
byte*
|
|
|
|
page_parse_copy_rec_list_to_created_page(
|
|
|
|
/*=====================================*/
|
2004-12-02 19:45:07 +02:00
|
|
|
/* out: end of log record or NULL */
|
|
|
|
byte* ptr, /* in: buffer */
|
|
|
|
byte* end_ptr,/* in: buffer end */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
|
|
|
page_t* page, /* in: page or NULL */
|
|
|
|
mtr_t* mtr); /* in: mtr or NULL */
|
2001-02-17 14:19:19 +02:00
|
|
|
/***************************************************************
|
|
|
|
Parses log record of a record delete on a page. */
|
|
|
|
|
|
|
|
byte*
|
|
|
|
page_cur_parse_delete_rec(
|
|
|
|
/*======================*/
|
2004-12-02 19:45:07 +02:00
|
|
|
/* out: pointer to record end or NULL */
|
|
|
|
byte* ptr, /* in: buffer */
|
|
|
|
byte* end_ptr,/* in: buffer end */
|
|
|
|
dict_index_t* index, /* in: record descriptor */
|
|
|
|
page_t* page, /* in: page or NULL */
|
|
|
|
mtr_t* mtr); /* in: mtr or NULL */
|
2001-02-17 14:19:19 +02:00
|
|
|
|
|
|
|
/* Index page cursor */
|
|
|
|
|
|
|
|
struct page_cur_struct{
|
|
|
|
byte* rec; /* pointer to a record on page */
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
|
|
#include "page0cur.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|