mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
d2c4b54540
Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/btr/btr0btr.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/btr/btr0cur.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/btr/btr0pcur.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/btr/btr0sea.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/data/data0data.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/data/data0type.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/dict/dict0boot.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/dict/dict0crea.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/dict/dict0dict.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/dict/dict0load.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/dict/dict0mem.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/fil/fil0fil.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/fsp/fsp0fsp.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/ibuf/ibuf0ibuf.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/btr0btr.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/btr0btr.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/btr0cur.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/btr0cur.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/btr0pcur.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/btr0sea.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/data0type.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/dict0dict.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/dict0dict.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/dict0mem.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/lock0lock.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/lock0lock.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/mtr0log.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/mtr0mtr.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/page0cur.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/page0cur.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/page0page.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/page0page.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/rem0cmp.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/rem0cmp.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/rem0rec.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/rem0rec.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/row0row.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/row0row.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/row0upd.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/row0upd.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/row0vers.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/row0vers.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/srv0srv.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/trx0rec.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/ut0byte.h: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/include/ut0byte.ic: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/lock/lock0lock.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/log/log0recv.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/mtr/mtr0log.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/page/page0cur.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/page/page0page.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/pars/pars0pars.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/rem/rem0cmp.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/rem/rem0rec.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0ins.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0mysql.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0purge.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0row.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0sel.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0umod.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0undo.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0upd.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/row/row0vers.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/srv/srv0srv.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/trx/trx0rec.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. innobase/trx/trx0undo.c: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC. sql/ha_innodb.cc: Implement more compact InnoDB record format. Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC.
233 lines
5.7 KiB
Text
233 lines
5.7 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, 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 */
|
|
const ulint* offsets)/* in: array returned by rec_get_offsets() */
|
|
{
|
|
byte* field;
|
|
ulint len;
|
|
ulint page_no;
|
|
|
|
ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec));
|
|
|
|
/* The child address is in the last field */
|
|
field = rec_get_nth_field(rec, offsets,
|
|
rec_offs_n_fields(offsets) - 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",
|
|
(unsigned long)(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);
|
|
}
|
|
}
|