mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
c2f0c211cd
Fixes: - Bug #23710: crash_commit_before fails if innodb_file_per_table=1 - Bug #28254: innodb crash if shutdown during innodb_table_monitor is running - Bug #28604: innodb_force_recovery restricts data dump - Bug #29097: fsp_get_available_space_in_free_extents() is capped at 4TB - Bug #29155: Innodb "Parallel recovery" is not prevented storage/innobase/Makefile.am: Apply snapshot innodb-51-ss1644 Revision r1632: Add include/lock0priv.h to noinst_HEADERS in Makefile.am. Revision r1636: Move lock_get_type() from lock/lock0lock.c to include/lock0priv.ic: * lock0lock.c: remove lock_get_type() and include include/lock0priv.ic * lock0priv.h: include lock0priv.ic and add lock_get_type() prototype * Makefile.am: add lock0priv.ic to noinst_HEADERS * lock0priv.ic: introduce this new file containing the body of lock_get_type() This move is necessary in order to use lock_get_type() from other lock/ source files (it's going to be used in lock/lock0iter.c). Approved by: Heikki Revision r1638: Introduce a lock queue iterator for easy (and opaque) traversing of lock queues. Supports table and record lock queues via the same interface. There is only "get previous" method because currently there is no need for "get next" - it would be unused. Feel free to add one if needed. Approved by: Heikki storage/innobase/buf/buf0buf.c: Apply snapshot innodb-51-ss1644 Revision r1624: Fix change missed as part of Bug 15815. Use a function to check if a block needs to be made younger. Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/buf/buf0lru.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/fsp/fsp0fsp.c: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki storage/innobase/handler/ha_innodb.cc: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki Revision r1573: create_table_def(): Eliminate the inline function call to dict_table_is_comp() that was introduced in r1571. Inlining is disabled in ha_innodb.cc. Revision r1574: innodb_check_for_record_too_big_error(): Divide the return value of page_get_free_space_of_empty_noninline() by 2. Until r1571, that function did not return the same value as page_get_free_space_of_empty(). Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/include/buf0buf.ic: Apply snapshot innodb-51-ss1644 Revision r1624: Fix change missed as part of Bug 15815. Use a function to check if a block needs to be made younger. storage/innobase/include/fsp0fsp.h: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki storage/innobase/include/lock0lock.h: Apply snapshot innodb-51-ss1644 Revision r1623: Fix typo in comment. Revision r1628: lock_has_to_wait() is needed in the INFORMATION_SCHEMA implementation in order to determine which lock is blocking which. Make it non-static and put its definition in include/lock0lock.h. Approved by: Heikki (via IM) storage/innobase/include/mem0mem.ic: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/include/page0page.h: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/include/row0mysql.h: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/include/univ.i: Apply snapshot innodb-51-ss1644 Revision r1605: Fix Bug#29097 "fsp_get_available_space_in_free_extents() is capped at 4TB" by typecasting the variables before multiplying them, so that the result of the multiplication is of type "unsigned long long". I verified this fix by creating a sparse file of 6TB and forcing InnoDB to use it without overwriting it with zeroes (by commenting the code that overwrites :newraw files). New type ullint is introduced with the sole purpose of shortening "unsigned long long", please do not define it to something else than "unsigned long long". Approved by: Heikki Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/lock/lock0lock.c: Apply snapshot innodb-51-ss1644 Revision r1631: Move lock_rec_find_set_bit() and lock_rec_get_prev() from lock/lock0lock.c to include/lock0priv.h and make them non-static. They will be used in lock/lock0iter.c. Approved by: Heikki Revision r1636: Move lock_get_type() from lock/lock0lock.c to include/lock0priv.ic: * lock0lock.c: remove lock_get_type() and include include/lock0priv.ic * lock0priv.h: include lock0priv.ic and add lock_get_type() prototype * Makefile.am: add lock0priv.ic to noinst_HEADERS * lock0priv.ic: introduce this new file containing the body of lock_get_type() This move is necessary in order to use lock_get_type() from other lock/ source files (it's going to be used in lock/lock0iter.c). Approved by: Heikki Revision r1628: lock_has_to_wait() is needed in the INFORMATION_SCHEMA implementation in order to determine which lock is blocking which. Make it non-static and put its definition in include/lock0lock.h. Approved by: Heikki (via IM) Revision r1629: Add "const" qualifiers to lock_get_type() and lock_get_mode(). Approved by: Sunny Revision r1626: Move lock_*struct structures from lock/lock0lock.c to include/lock0priv.h. This is needed in order to add more code to lock/ that uses members of these structures (internal to the lock module) but in a separate file, rather than lock0lock.c. lock0lock.c is a way too big already. Approved by: Sunny storage/innobase/log/log0recv.c: Apply snapshot innodb-51-ss1644 Revision r1607: Bug#23710 At InnoDB startup consider the case where log scan went beyond checkpoint_lsn as a crash and initiate crash recovery code path. reviewed by: Heikki storage/innobase/mem/mem0mem.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/mem/mem0pool.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/os/os0file.c: Apply snapshot innodb-51-ss1644 Revision r1613: Fix Bug#29155 by enabling file locking on FreeBSD. It has been disabled because InnoDB has refused to start on FreeBSD & LinuxThreads, but now it starts just fine. Approved by: Heikki storage/innobase/page/page0page.c: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/rem/rem0rec.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/row/row0mysql.c: Apply snapshot innodb-51-ss1644 Revision r1571: Fix a severe bug that was introduced in r1422 when fixing Bug 21101. When creating an index containing a too long record, InnoDB would dereference a NULL pointer when trying to determine the maximum row length. innodb_check_for_record_too_big_error(): Replace the dict_table_t* parameter with a Boolean flag. There is not always a dict_table_t object when this function is called. page_get_free_space_of_empty_noninline(): Move the definition and declaration from row0mysql (!) to page0page. Make the signature identical with page_get_free_space_of_empty(). create_clustered_index_when_no_primary(): Add the parameter "comp". Remove unnecessary casts. storage/innobase/sync/sync0rw.c: Apply snapshot innodb-51-ss1644 Revision r1598: Add some comments. Approved by: Heikki (via IM) storage/innobase/sync/sync0sync.c: Apply snapshot innodb-51-ss1644 Revision r1598: Add some comments. Approved by: Heikki (via IM) storage/innobase/trx/trx0sys.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip. storage/innobase/trx/trx0trx.c: Apply snapshot innodb-51-ss1644 Revision r1595: trx_commit_for_mysql(): Avoid acquiring and releasing kernel_mutex when trx->sess or trx_dummy_sess is non-NULL. storage/innobase/ut/ut0mem.c: Apply snapshot innodb-51-ss1644 Revision r1581: Port extra Valgrind instrumentation (UNIV_DEBUG_VALGRIND) from branches/zip.
391 lines
14 KiB
C
391 lines
14 KiB
C
/******************************************************
|
|
File space management
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 12/18/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef fsp0fsp_h
|
|
#define fsp0fsp_h
|
|
|
|
#include "univ.i"
|
|
|
|
#include "mtr0mtr.h"
|
|
#include "fut0lst.h"
|
|
#include "ut0byte.h"
|
|
#include "page0types.h"
|
|
|
|
/* If records are inserted in order, there are the following
|
|
flags to tell this (their type is made byte for the compiler
|
|
to warn if direction and hint parameters are switched in
|
|
fseg_alloc_free_page): */
|
|
#define FSP_UP ((byte)111) /* alphabetically upwards */
|
|
#define FSP_DOWN ((byte)112) /* alphabetically downwards */
|
|
#define FSP_NO_DIR ((byte)113) /* no order */
|
|
|
|
/* File space extent size in pages */
|
|
#define FSP_EXTENT_SIZE 64
|
|
|
|
/* On a page of any file segment, data may be put starting from this offset: */
|
|
#define FSEG_PAGE_DATA FIL_PAGE_DATA
|
|
|
|
/* File segment header which points to the inode describing the file segment */
|
|
typedef byte fseg_header_t;
|
|
|
|
#define FSEG_HDR_SPACE 0 /* space id of the inode */
|
|
#define FSEG_HDR_PAGE_NO 4 /* page number of the inode */
|
|
#define FSEG_HDR_OFFSET 8 /* byte offset of the inode */
|
|
|
|
#define FSEG_HEADER_SIZE 10
|
|
|
|
/**************************************************************************
|
|
Initializes the file space system. */
|
|
|
|
void
|
|
fsp_init(void);
|
|
/*==========*/
|
|
/**************************************************************************
|
|
Gets the current free limit of a tablespace. The free limit means the
|
|
place of the first page which has never been put to the the free list
|
|
for allocation. The space above that address is initialized to zero.
|
|
Sets also the global variable log_fsp_current_free_limit. */
|
|
|
|
ulint
|
|
fsp_header_get_free_limit(
|
|
/*======================*/
|
|
/* out: free limit in megabytes */
|
|
ulint space); /* in: space id, must be 0 */
|
|
/**************************************************************************
|
|
Gets the size of the tablespace from the tablespace header. If we do not
|
|
have an auto-extending data file, this should be equal to the size of the
|
|
data files. If there is an auto-extending data file, this can be smaller. */
|
|
|
|
ulint
|
|
fsp_header_get_tablespace_size(
|
|
/*===========================*/
|
|
/* out: size in pages */
|
|
ulint space); /* in: space id, must be 0 */
|
|
/**************************************************************************
|
|
Reads the file space size stored in the header page. */
|
|
|
|
ulint
|
|
fsp_get_size_low(
|
|
/*=============*/
|
|
/* out: tablespace size stored in the space header */
|
|
page_t* page); /* in: header page (page 0 in the tablespace) */
|
|
/**************************************************************************
|
|
Reads the space id from the first page of a tablespace. */
|
|
|
|
ulint
|
|
fsp_header_get_space_id(
|
|
/*====================*/
|
|
/* out: space id, ULINT UNDEFINED if error */
|
|
page_t* page); /* in: first page of a tablespace */
|
|
/**************************************************************************
|
|
Writes the space id to a tablespace header. This function is used past the
|
|
buffer pool when we in fil0fil.c create a new single-table tablespace. */
|
|
|
|
void
|
|
fsp_header_write_space_id(
|
|
/*======================*/
|
|
page_t* page, /* in: first page in the space */
|
|
ulint space_id); /* in: space id */
|
|
/**************************************************************************
|
|
Initializes the space header of a new created space and creates also the
|
|
insert buffer tree root if space == 0. */
|
|
|
|
void
|
|
fsp_header_init(
|
|
/*============*/
|
|
ulint space, /* in: space id */
|
|
ulint size, /* in: current size in blocks */
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
/**************************************************************************
|
|
Increases the space size field of a space. */
|
|
|
|
void
|
|
fsp_header_inc_size(
|
|
/*================*/
|
|
ulint space, /* in: space id */
|
|
ulint size_inc,/* in: size increment in pages */
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
/**************************************************************************
|
|
Creates a new segment. */
|
|
|
|
page_t*
|
|
fseg_create(
|
|
/*========*/
|
|
/* out: the page where the segment header is placed,
|
|
x-latched, NULL if could not create segment
|
|
because of lack of space */
|
|
ulint space, /* in: space id */
|
|
ulint page, /* in: page where the segment header is placed: if
|
|
this is != 0, the page must belong to another segment,
|
|
if this is 0, a new page will be allocated and it
|
|
will belong to the created segment */
|
|
ulint byte_offset, /* in: byte offset of the created segment header
|
|
on the page */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/**************************************************************************
|
|
Creates a new segment. */
|
|
|
|
page_t*
|
|
fseg_create_general(
|
|
/*================*/
|
|
/* out: the page where the segment header is placed,
|
|
x-latched, NULL if could not create segment
|
|
because of lack of space */
|
|
ulint space, /* in: space id */
|
|
ulint page, /* in: page where the segment header is placed: if
|
|
this is != 0, the page must belong to another segment,
|
|
if this is 0, a new page will be allocated and it
|
|
will belong to the created segment */
|
|
ulint byte_offset, /* in: byte offset of the created segment header
|
|
on the page */
|
|
ibool has_done_reservation, /* in: TRUE if the caller has already
|
|
done the reservation for the pages with
|
|
fsp_reserve_free_extents (at least 2 extents: one for
|
|
the inode and the other for the segment) then there is
|
|
no need to do the check for this individual
|
|
operation */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/**************************************************************************
|
|
Calculates the number of pages reserved by a segment, and how many pages are
|
|
currently used. */
|
|
|
|
ulint
|
|
fseg_n_reserved_pages(
|
|
/*==================*/
|
|
/* out: number of reserved pages */
|
|
fseg_header_t* header, /* in: segment header */
|
|
ulint* used, /* out: number of pages used (<= reserved) */
|
|
mtr_t* mtr); /* in: mtr handle */
|
|
/**************************************************************************
|
|
Allocates a single free page from a segment. This function implements
|
|
the intelligent allocation strategy which tries to minimize
|
|
file space fragmentation. */
|
|
|
|
ulint
|
|
fseg_alloc_free_page(
|
|
/*=================*/
|
|
/* out: the allocated page offset
|
|
FIL_NULL if no page could be allocated */
|
|
fseg_header_t* seg_header, /* in: segment header */
|
|
ulint hint, /* in: hint of which page would be desirable */
|
|
byte direction, /* in: if the new page is needed because
|
|
of an index page split, and records are
|
|
inserted there in order, into which
|
|
direction they go alphabetically: FSP_DOWN,
|
|
FSP_UP, FSP_NO_DIR */
|
|
mtr_t* mtr); /* in: mtr handle */
|
|
/**************************************************************************
|
|
Allocates a single free page from a segment. This function implements
|
|
the intelligent allocation strategy which tries to minimize file space
|
|
fragmentation. */
|
|
|
|
ulint
|
|
fseg_alloc_free_page_general(
|
|
/*=========================*/
|
|
/* out: allocated page offset, FIL_NULL if no
|
|
page could be allocated */
|
|
fseg_header_t* seg_header,/* in: segment header */
|
|
ulint hint, /* in: hint of which page would be desirable */
|
|
byte direction,/* in: if the new page is needed because
|
|
of an index page split, and records are
|
|
inserted there in order, into which
|
|
direction they go alphabetically: FSP_DOWN,
|
|
FSP_UP, FSP_NO_DIR */
|
|
ibool has_done_reservation, /* in: TRUE if the caller has
|
|
already done the reservation for the page
|
|
with fsp_reserve_free_extents, then there
|
|
is no need to do the check for this individual
|
|
page */
|
|
mtr_t* mtr); /* in: mtr handle */
|
|
/**************************************************************************
|
|
Reserves free pages from a tablespace. All mini-transactions which may
|
|
use several pages from the tablespace should call this function beforehand
|
|
and reserve enough free extents so that they certainly will be able
|
|
to do their operation, like a B-tree page split, fully. Reservations
|
|
must be released with function fil_space_release_free_extents!
|
|
|
|
The alloc_type below has the following meaning: FSP_NORMAL means an
|
|
operation which will probably result in more space usage, like an
|
|
insert in a B-tree; FSP_UNDO means allocation to undo logs: if we are
|
|
deleting rows, then this allocation will in the long run result in
|
|
less space usage (after a purge); FSP_CLEANING means allocation done
|
|
in a physical record delete (like in a purge) or other cleaning operation
|
|
which will result in less space usage in the long run. We prefer the latter
|
|
two types of allocation: when space is scarce, FSP_NORMAL allocations
|
|
will not succeed, but the latter two allocations will succeed, if possible.
|
|
The purpose is to avoid dead end where the database is full but the
|
|
user cannot free any space because these freeing operations temporarily
|
|
reserve some space.
|
|
|
|
Single-table tablespaces whose size is < 32 pages are a special case. In this
|
|
function we would liberally reserve several 64 page extents for every page
|
|
split or merge in a B-tree. But we do not want to waste disk space if the table
|
|
only occupies < 32 pages. That is why we apply different rules in that special
|
|
case, just ensuring that there are 3 free pages available. */
|
|
|
|
ibool
|
|
fsp_reserve_free_extents(
|
|
/*=====================*/
|
|
/* out: TRUE if we were able to make the reservation */
|
|
ulint* n_reserved,/* out: number of extents actually reserved; if we
|
|
return TRUE and the tablespace size is < 64 pages,
|
|
then this can be 0, otherwise it is n_ext */
|
|
ulint space, /* in: space id */
|
|
ulint n_ext, /* in: number of extents to reserve */
|
|
ulint alloc_type,/* in: FSP_NORMAL, FSP_UNDO, or FSP_CLEANING */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/**************************************************************************
|
|
This function should be used to get information on how much we still
|
|
will be able to insert new data to the database without running out the
|
|
tablespace. Only free extents are taken into account and we also subtract
|
|
the safety margin required by the above function fsp_reserve_free_extents. */
|
|
|
|
ullint
|
|
fsp_get_available_space_in_free_extents(
|
|
/*====================================*/
|
|
/* out: available space in kB */
|
|
ulint space); /* in: space id */
|
|
/**************************************************************************
|
|
Frees a single page of a segment. */
|
|
|
|
void
|
|
fseg_free_page(
|
|
/*===========*/
|
|
fseg_header_t* seg_header, /* in: segment header */
|
|
ulint space, /* in: space id */
|
|
ulint page, /* in: page offset */
|
|
mtr_t* mtr); /* in: mtr handle */
|
|
/***********************************************************************
|
|
Frees a segment. The freeing is performed in several mini-transactions,
|
|
so that there is no danger of bufferfixing too many buffer pages. */
|
|
|
|
void
|
|
fseg_free(
|
|
/*======*/
|
|
ulint space, /* in: space id */
|
|
ulint page_no,/* in: page number where the segment header is
|
|
placed */
|
|
ulint offset);/* in: byte offset of the segment header on that
|
|
page */
|
|
/**************************************************************************
|
|
Frees part of a segment. This function can be used to free a segment
|
|
by repeatedly calling this function in different mini-transactions.
|
|
Doing the freeing in a single mini-transaction might result in
|
|
too big a mini-transaction. */
|
|
|
|
ibool
|
|
fseg_free_step(
|
|
/*===========*/
|
|
/* out: TRUE if freeing completed */
|
|
fseg_header_t* header, /* in, own: segment header; NOTE: if the header
|
|
resides on the first page of the frag list
|
|
of the segment, this pointer becomes obsolete
|
|
after the last freeing step */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/**************************************************************************
|
|
Frees part of a segment. Differs from fseg_free_step because this function
|
|
leaves the header page unfreed. */
|
|
|
|
ibool
|
|
fseg_free_step_not_header(
|
|
/*======================*/
|
|
/* out: TRUE if freeing completed, except the
|
|
header page */
|
|
fseg_header_t* header, /* in: segment header which must reside on
|
|
the first fragment page of the segment */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/***************************************************************************
|
|
Checks if a page address is an extent descriptor page address. */
|
|
UNIV_INLINE
|
|
ibool
|
|
fsp_descr_page(
|
|
/*===========*/
|
|
/* out: TRUE if a descriptor page */
|
|
ulint page_no);/* in: page number */
|
|
/***************************************************************
|
|
Parses a redo log record of a file page init. */
|
|
|
|
byte*
|
|
fsp_parse_init_file_page(
|
|
/*=====================*/
|
|
/* out: end of log record or NULL */
|
|
byte* ptr, /* in: buffer */
|
|
byte* end_ptr,/* in: buffer end */
|
|
page_t* page); /* in: page or NULL */
|
|
/***********************************************************************
|
|
Validates the file space system and its segments. */
|
|
|
|
ibool
|
|
fsp_validate(
|
|
/*=========*/
|
|
/* out: TRUE if ok */
|
|
ulint space); /* in: space id */
|
|
/***********************************************************************
|
|
Prints info of a file space. */
|
|
|
|
void
|
|
fsp_print(
|
|
/*======*/
|
|
ulint space); /* in: space id */
|
|
/***********************************************************************
|
|
Validates a segment. */
|
|
|
|
ibool
|
|
fseg_validate(
|
|
/*==========*/
|
|
/* out: TRUE if ok */
|
|
fseg_header_t* header, /* in: segment header */
|
|
mtr_t* mtr2); /* in: mtr */
|
|
/***********************************************************************
|
|
Writes info of a segment. */
|
|
|
|
void
|
|
fseg_print(
|
|
/*=======*/
|
|
fseg_header_t* header, /* in: segment header */
|
|
mtr_t* mtr); /* in: mtr */
|
|
|
|
/* Flags for fsp_reserve_free_extents */
|
|
#define FSP_NORMAL 1000000
|
|
#define FSP_UNDO 2000000
|
|
#define FSP_CLEANING 3000000
|
|
|
|
/* Number of pages described in a single descriptor page: currently each page
|
|
description takes less than 1 byte; a descriptor page is repeated every
|
|
this many file pages */
|
|
#define XDES_DESCRIBED_PER_PAGE UNIV_PAGE_SIZE
|
|
|
|
/* The space low address page map */
|
|
/*--------------------------------------*/
|
|
/* The following two pages are repeated
|
|
every XDES_DESCRIBED_PER_PAGE pages in
|
|
every tablespace. */
|
|
#define FSP_XDES_OFFSET 0 /* extent descriptor */
|
|
#define FSP_IBUF_BITMAP_OFFSET 1 /* insert buffer bitmap */
|
|
/* The ibuf bitmap pages are the ones whose
|
|
page number is the number above plus a
|
|
multiple of XDES_DESCRIBED_PER_PAGE */
|
|
|
|
#define FSP_FIRST_INODE_PAGE_NO 2 /* in every tablespace */
|
|
/* The following pages exist
|
|
in the system tablespace (space 0). */
|
|
#define FSP_IBUF_HEADER_PAGE_NO 3 /* in tablespace 0 */
|
|
#define FSP_IBUF_TREE_ROOT_PAGE_NO 4 /* in tablespace 0 */
|
|
/* The ibuf tree root page number in
|
|
tablespace 0; its fseg inode is on the page
|
|
number FSP_FIRST_INODE_PAGE_NO */
|
|
#define FSP_TRX_SYS_PAGE_NO 5 /* in tablespace 0 */
|
|
#define FSP_FIRST_RSEG_PAGE_NO 6 /* in tablespace 0 */
|
|
#define FSP_DICT_HDR_PAGE_NO 7 /* in tablespace 0 */
|
|
/*--------------------------------------*/
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "fsp0fsp.ic"
|
|
#endif
|
|
|
|
#endif
|