mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
d1485aad0e
Multiple tablespaces for InnoDB sql_table.cc: Tell explicitly that InnoDB should retrieve all columns in CHECKSUM TABLE sql_update.cc, sql_select.cc, my_base.h: More descriptive flag name HA_EXTRA_RETRIEVE_ALL_COLS include/my_base.h: More descriptive flag name HA_EXTRA_RETRIEVE_ALL_COLS sql/sql_select.cc: More descriptive flag name HA_EXTRA_RETRIEVE_ALL_COLS sql/sql_update.cc: More descriptive flag name HA_EXTRA_RETRIEVE_ALL_COLS sql/sql_table.cc: Tell explicitly that InnoDB should retrieve all columns in CHECKSUM TABLE sql/sql_db.cc: Multiple tablespaces for InnoDB sql/ha_innodb.cc: Multiple tablespaces for InnoDB sql/mysqld.cc: Multiple tablespaces for InnoDB sql/set_var.cc: Multiple tablespaces for InnoDB sql/sql_cache.cc: Multiple tablespaces for InnoDB sql/ha_innodb.h: Multiple tablespaces for InnoDB innobase/include/btr0btr.ic: Multiple tablespaces for InnoDB innobase/include/btr0pcur.ic: Multiple tablespaces for InnoDB innobase/include/data0type.ic: Multiple tablespaces for InnoDB innobase/include/dyn0dyn.ic: Multiple tablespaces for InnoDB innobase/include/fut0lst.ic: Multiple tablespaces for InnoDB innobase/include/log0log.ic: Multiple tablespaces for InnoDB innobase/include/mach0data.ic: Multiple tablespaces for InnoDB innobase/include/mtr0log.ic: Multiple tablespaces for InnoDB innobase/include/rem0rec.ic: Multiple tablespaces for InnoDB innobase/include/ut0byte.ic: Multiple tablespaces for InnoDB innobase/include/ut0ut.ic: Multiple tablespaces for InnoDB innobase/include/buf0buf.h: Multiple tablespaces for InnoDB innobase/include/buf0lru.h: Multiple tablespaces for InnoDB innobase/include/buf0rea.h: Multiple tablespaces for InnoDB innobase/include/data0type.h: Multiple tablespaces for InnoDB innobase/include/db0err.h: Multiple tablespaces for InnoDB innobase/include/dict0boot.h: Multiple tablespaces for InnoDB innobase/include/dict0dict.h: Multiple tablespaces for InnoDB innobase/include/dict0load.h: Multiple tablespaces for InnoDB innobase/include/dict0mem.h: Multiple tablespaces for InnoDB innobase/include/fil0fil.h: Multiple tablespaces for InnoDB innobase/include/fsp0fsp.h: Multiple tablespaces for InnoDB innobase/include/ibuf0ibuf.h: Multiple tablespaces for InnoDB innobase/include/lock0lock.h: Multiple tablespaces for InnoDB innobase/include/log0log.h: Multiple tablespaces for InnoDB innobase/include/log0recv.h: Multiple tablespaces for InnoDB innobase/include/os0file.h: Multiple tablespaces for InnoDB innobase/include/page0page.h: Multiple tablespaces for InnoDB innobase/include/que0types.h: Multiple tablespaces for InnoDB innobase/include/rem0rec.h: Multiple tablespaces for InnoDB innobase/include/srv0srv.h: Multiple tablespaces for InnoDB innobase/include/srv0start.h: Multiple tablespaces for InnoDB innobase/include/sync0sync.h: Multiple tablespaces for InnoDB innobase/include/trx0sys.h: Multiple tablespaces for InnoDB innobase/include/ut0byte.h: Multiple tablespaces for InnoDB innobase/include/univ.i: Multiple tablespaces for InnoDB innobase/btr/btr0cur.c: Multiple tablespaces for InnoDB innobase/btr/btr0sea.c: Multiple tablespaces for InnoDB innobase/buf/buf0buf.c: Multiple tablespaces for InnoDB innobase/buf/buf0flu.c: Multiple tablespaces for InnoDB innobase/buf/buf0lru.c: Multiple tablespaces for InnoDB innobase/buf/buf0rea.c: Multiple tablespaces for InnoDB innobase/data/data0type.c: Multiple tablespaces for InnoDB innobase/dict/dict0boot.c: Multiple tablespaces for InnoDB innobase/dict/dict0crea.c: Multiple tablespaces for InnoDB innobase/dict/dict0dict.c: Multiple tablespaces for InnoDB innobase/dict/dict0load.c: Multiple tablespaces for InnoDB innobase/dict/dict0mem.c: Multiple tablespaces for InnoDB innobase/fil/fil0fil.c: Multiple tablespaces for InnoDB innobase/fsp/fsp0fsp.c: Multiple tablespaces for InnoDB innobase/ha/ha0ha.c: Multiple tablespaces for InnoDB innobase/ibuf/ibuf0ibuf.c: Multiple tablespaces for InnoDB innobase/log/log0log.c: Multiple tablespaces for InnoDB innobase/log/log0recv.c: Multiple tablespaces for InnoDB innobase/mach/mach0data.c: Multiple tablespaces for InnoDB innobase/mem/mem0dbg.c: Multiple tablespaces for InnoDB innobase/mem/mem0pool.c: Multiple tablespaces for InnoDB innobase/mtr/mtr0log.c: Multiple tablespaces for InnoDB innobase/os/os0file.c: Multiple tablespaces for InnoDB innobase/os/os0proc.c: Multiple tablespaces for InnoDB innobase/page/page0cur.c: Multiple tablespaces for InnoDB innobase/que/que0que.c: Multiple tablespaces for InnoDB innobase/row/row0ins.c: Multiple tablespaces for InnoDB innobase/row/row0mysql.c: Multiple tablespaces for InnoDB innobase/row/row0sel.c: Multiple tablespaces for InnoDB innobase/row/row0upd.c: Multiple tablespaces for InnoDB innobase/srv/srv0srv.c: Multiple tablespaces for InnoDB innobase/srv/srv0start.c: Multiple tablespaces for InnoDB innobase/sync/sync0rw.c: Multiple tablespaces for InnoDB innobase/sync/sync0sync.c: Multiple tablespaces for InnoDB innobase/trx/trx0sys.c: Multiple tablespaces for InnoDB innobase/trx/trx0trx.c: Multiple tablespaces for InnoDB innobase/trx/trx0undo.c: Multiple tablespaces for InnoDB innobase/ut/ut0byte.c: Multiple tablespaces for InnoDB innobase/ut/ut0ut.c: Multiple tablespaces for InnoDB
233 lines
5.6 KiB
Text
233 lines
5.6 KiB
Text
/******************************************************
|
|
The B-tree
|
|
|
|
(c) 1994-1996 Innobase Oy
|
|
|
|
Created 6/2/1994 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#include "mach0data.h"
|
|
#include "mtr0mtr.h"
|
|
#include "mtr0log.h"
|
|
|
|
#define BTR_MAX_NODE_LEVEL 50 /* used in debug checking */
|
|
|
|
/******************************************************************
|
|
Gets a buffer page and declares its latching order level. */
|
|
UNIV_INLINE
|
|
page_t*
|
|
btr_page_get(
|
|
/*=========*/
|
|
ulint space, /* in: space id */
|
|
ulint page_no, /* in: page number */
|
|
ulint mode, /* in: latch mode */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
page_t* page;
|
|
|
|
page = buf_page_get(space, page_no, mode, mtr);
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
if (mode != RW_NO_LATCH) {
|
|
|
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
|
}
|
|
#endif
|
|
return(page);
|
|
}
|
|
|
|
/******************************************************************
|
|
Sets the index id field of a page. */
|
|
UNIV_INLINE
|
|
void
|
|
btr_page_set_index_id(
|
|
/*==================*/
|
|
page_t* page, /* in: page to be created */
|
|
dulint id, /* in: index id */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
mlog_write_dulint(page + PAGE_HEADER + PAGE_INDEX_ID, id,
|
|
MLOG_8BYTES, mtr);
|
|
}
|
|
|
|
/******************************************************************
|
|
Gets the index id field of a page. */
|
|
UNIV_INLINE
|
|
dulint
|
|
btr_page_get_index_id(
|
|
/*==================*/
|
|
/* out: index id */
|
|
page_t* page) /* in: index page */
|
|
{
|
|
return(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID));
|
|
}
|
|
|
|
/************************************************************
|
|
Gets the node level field in an index page. */
|
|
UNIV_INLINE
|
|
ulint
|
|
btr_page_get_level_low(
|
|
/*===================*/
|
|
/* out: level, leaf level == 0 */
|
|
page_t* page) /* in: index page */
|
|
{
|
|
ulint level;
|
|
|
|
ut_ad(page);
|
|
|
|
level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL);
|
|
|
|
ut_ad(level <= BTR_MAX_NODE_LEVEL);
|
|
|
|
return(level);
|
|
}
|
|
|
|
/************************************************************
|
|
Gets the node level field in an index page. */
|
|
UNIV_INLINE
|
|
ulint
|
|
btr_page_get_level(
|
|
/*===============*/
|
|
/* out: level, leaf level == 0 */
|
|
page_t* page, /* in: index page */
|
|
mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */
|
|
{
|
|
ut_ad(page && mtr);
|
|
|
|
return(btr_page_get_level_low(page));
|
|
}
|
|
|
|
/************************************************************
|
|
Sets the node level field in an index page. */
|
|
UNIV_INLINE
|
|
void
|
|
btr_page_set_level(
|
|
/*===============*/
|
|
page_t* page, /* in: index page */
|
|
ulint level, /* in: level, leaf level == 0 */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ut_ad(page && mtr);
|
|
ut_ad(level <= BTR_MAX_NODE_LEVEL);
|
|
|
|
mlog_write_ulint(page + PAGE_HEADER + PAGE_LEVEL, level,
|
|
MLOG_2BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************
|
|
Gets the next index page number. */
|
|
UNIV_INLINE
|
|
ulint
|
|
btr_page_get_next(
|
|
/*==============*/
|
|
/* out: next page number */
|
|
page_t* page, /* in: index page */
|
|
mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */
|
|
{
|
|
ut_ad(page && mtr);
|
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
|
|
MTR_MEMO_PAGE_X_FIX)
|
|
|| mtr_memo_contains(mtr, buf_block_align(page),
|
|
MTR_MEMO_PAGE_S_FIX));
|
|
|
|
return(mach_read_from_4(page + FIL_PAGE_NEXT));
|
|
}
|
|
|
|
/************************************************************
|
|
Sets the next index page field. */
|
|
UNIV_INLINE
|
|
void
|
|
btr_page_set_next(
|
|
/*==============*/
|
|
page_t* page, /* in: index page */
|
|
ulint next, /* in: next page number */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ut_ad(page && mtr);
|
|
|
|
mlog_write_ulint(page + FIL_PAGE_NEXT, next, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/************************************************************
|
|
Gets the previous index page number. */
|
|
UNIV_INLINE
|
|
ulint
|
|
btr_page_get_prev(
|
|
/*==============*/
|
|
/* out: prev page number */
|
|
page_t* page, /* in: index page */
|
|
mtr_t* mtr __attribute__((unused))) /* in: mini-transaction handle */
|
|
{
|
|
ut_ad(page && mtr);
|
|
|
|
return(mach_read_from_4(page + FIL_PAGE_PREV));
|
|
}
|
|
|
|
/************************************************************
|
|
Sets the previous index page field. */
|
|
UNIV_INLINE
|
|
void
|
|
btr_page_set_prev(
|
|
/*==============*/
|
|
page_t* page, /* in: index page */
|
|
ulint prev, /* in: previous page number */
|
|
mtr_t* mtr) /* in: mini-transaction handle */
|
|
{
|
|
ut_ad(page && mtr);
|
|
|
|
mlog_write_ulint(page + FIL_PAGE_PREV, prev, MLOG_4BYTES, mtr);
|
|
}
|
|
|
|
/******************************************************************
|
|
Gets the child node file address in a node pointer. */
|
|
UNIV_INLINE
|
|
ulint
|
|
btr_node_ptr_get_child_page_no(
|
|
/*===========================*/
|
|
/* out: child node address */
|
|
rec_t* rec) /* in: node pointer record */
|
|
{
|
|
ulint n_fields;
|
|
byte* field;
|
|
ulint len;
|
|
ulint page_no;
|
|
|
|
n_fields = rec_get_n_fields(rec);
|
|
|
|
/* The child address is in the last field */
|
|
field = rec_get_nth_field(rec, n_fields - 1, &len);
|
|
|
|
ut_ad(len == 4);
|
|
|
|
page_no = mach_read_from_4(field);
|
|
|
|
if (page_no == 0) {
|
|
fprintf(stderr,
|
|
"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
|
|
(ulint)(rec - buf_frame_align(rec)));
|
|
buf_page_print(buf_frame_align(rec));
|
|
}
|
|
|
|
return(page_no);
|
|
}
|
|
|
|
/******************************************************************
|
|
Releases the latches on a leaf page and bufferunfixes it. */
|
|
UNIV_INLINE
|
|
void
|
|
btr_leaf_page_release(
|
|
/*==================*/
|
|
page_t* page, /* in: page */
|
|
ulint latch_mode, /* in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF */
|
|
mtr_t* mtr) /* in: mtr */
|
|
{
|
|
ut_ad(!mtr_memo_contains(mtr, buf_block_align(page),
|
|
MTR_MEMO_MODIFY));
|
|
if (latch_mode == BTR_SEARCH_LEAF) {
|
|
mtr_memo_release(mtr, buf_block_align(page),
|
|
MTR_MEMO_PAGE_S_FIX);
|
|
} else {
|
|
ut_ad(latch_mode == BTR_MODIFY_LEAF);
|
|
mtr_memo_release(mtr, buf_block_align(page),
|
|
MTR_MEMO_PAGE_X_FIX);
|
|
}
|
|
}
|