2009-02-17 09:24:40 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2009-05-25 09:52:29 +00:00
|
|
|
/**************************************************//**
|
|
|
|
@file include/page0types.h
|
2005-10-27 07:29:40 +00:00
|
|
|
Index page routines
|
|
|
|
|
|
|
|
Created 2/2/1994 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#ifndef page0types_h
|
|
|
|
#define page0types_h
|
|
|
|
|
|
|
|
#include "univ.i"
|
2006-02-10 15:06:17 +00:00
|
|
|
#include "dict0types.h"
|
|
|
|
#include "mtr0types.h"
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Eliminates a name collision on HP-UX */
|
2006-02-23 19:25:29 +00:00
|
|
|
#define page_t ib_page_t
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Type of the index page */
|
2005-10-27 07:29:40 +00:00
|
|
|
typedef byte page_t;
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Index page cursor */
|
2005-10-27 07:29:40 +00:00
|
|
|
typedef struct page_cur_struct page_cur_t;
|
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Compressed index page */
|
2005-10-27 11:48:10 +00:00
|
|
|
typedef byte page_zip_t;
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Compressed page descriptor */
|
2005-10-27 11:48:10 +00:00
|
|
|
typedef struct page_zip_des_struct page_zip_des_t;
|
|
|
|
|
|
|
|
/* The following definitions would better belong to page0zip.h,
|
|
|
|
but we cannot include page0zip.h from rem0rec.ic, because
|
|
|
|
page0*.h includes rem0rec.h and may include rem0rec.ic. */
|
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Number of bits needed for representing different compressed page sizes */
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
#define PAGE_ZIP_SSIZE_BITS 3
|
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** log2 of smallest compressed page size */
|
|
|
|
#define PAGE_ZIP_MIN_SIZE_SHIFT 10
|
|
|
|
/** Smallest compressed page size */
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
#define PAGE_ZIP_MIN_SIZE (1 << PAGE_ZIP_MIN_SIZE_SHIFT)
|
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Number of supported compressed page sizes */
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
#define PAGE_ZIP_NUM_SSIZE (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 2)
|
|
|
|
#if PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)
|
|
|
|
# error "PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)"
|
|
|
|
#endif
|
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Compressed page descriptor */
|
2005-10-27 11:48:10 +00:00
|
|
|
struct page_zip_des_struct
|
|
|
|
{
|
2009-05-26 12:28:49 +00:00
|
|
|
page_zip_t* data; /*!< compressed page data */
|
2006-11-30 10:33:35 +00:00
|
|
|
|
2006-11-30 14:09:29 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
2009-05-26 12:28:49 +00:00
|
|
|
unsigned m_start:16; /*!< start offset of modification log */
|
2006-11-30 14:09:29 +00:00
|
|
|
#endif /* UNIV_DEBUG */
|
2009-05-26 12:28:49 +00:00
|
|
|
unsigned m_end:16; /*!< end offset of modification log */
|
|
|
|
unsigned m_nonempty:1; /*!< TRUE if the modification log
|
2006-11-30 14:09:29 +00:00
|
|
|
is not empty */
|
2009-05-26 12:28:49 +00:00
|
|
|
unsigned n_blobs:12; /*!< number of externally stored
|
2006-11-24 08:32:18 +00:00
|
|
|
columns on the page; the maximum
|
|
|
|
is 744 on a 16 KiB page */
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
unsigned ssize:PAGE_ZIP_SSIZE_BITS;
|
2009-05-26 12:28:49 +00:00
|
|
|
/*!< 0 or compressed page size;
|
2007-04-10 08:11:49 +00:00
|
|
|
the size in bytes is
|
|
|
|
PAGE_ZIP_MIN_SIZE << (ssize - 1). */
|
2005-10-27 11:48:10 +00:00
|
|
|
};
|
|
|
|
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
/** Compression statistics for a given page size */
|
|
|
|
struct page_zip_stat_struct {
|
|
|
|
/** Number of page compressions */
|
|
|
|
ulint compressed;
|
|
|
|
/** Number of successful page compressions */
|
|
|
|
ulint compressed_ok;
|
|
|
|
/** Number of page decompressions */
|
|
|
|
ulint decompressed;
|
|
|
|
/** Duration of page compressions in microseconds */
|
|
|
|
ib_uint64_t compressed_usec;
|
|
|
|
/** Duration of page decompressions in microseconds */
|
|
|
|
ib_uint64_t decompressed_usec;
|
|
|
|
};
|
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Compression statistics */
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
typedef struct page_zip_stat_struct page_zip_stat_t;
|
2006-06-07 10:41:58 +00:00
|
|
|
|
2009-05-26 12:28:49 +00:00
|
|
|
/** Statistics on compression, indexed by page_zip_des_struct::ssize - 1 */
|
branches/zip: Rename the INFORMATION_SCHEMA tables
INNODB_ZIP and INNODB_ZIP_RESET to
INNODB_COMPRESSION and INNODB_COMPRESSION_RESET,
and remove the statistics of the buddy system.
This change was discussed with Ken. It makes the tables shorter
and easier to understand. The removed data will be represented in
the tables INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET
that will be added later.
i_s_innodb_zip, i_s_innodb_zip_reset, i_s_zip_fields_info[],
i_s_zip_fill_low(), i_s_zip_fill(), i_s_zip_reset_fill(),
i_s_zip_init(), i_s_zip_reset_init(): Replace "zip" with "compression".
i_s_compression_fields_info[]: Remove "used", "free",
"relocated", "relocated_usec". In "compressed_usec" and "decompressed_usec",
replace microseconds with seconds ("usec" with "sec").
page_zip_decompress(): Correct a typo in the function comment.
PAGE_ZIP_SSIZE_BITS, PAGE_ZIP_NUM_SSIZE: New constants.
page_zip_stat_t, page_zip_stat: Statistics of the compression, grouped
by page size.
page_zip_simple_validate(): Assert that page_zip->ssize is reasonable.
2008-03-28 09:28:54 +00:00
|
|
|
extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
|
2007-04-10 08:11:49 +00:00
|
|
|
|
2009-05-25 09:52:29 +00:00
|
|
|
/**********************************************************************//**
|
2006-02-10 15:06:17 +00:00
|
|
|
Write the "deleted" flag of a record on a compressed page. The flag must
|
|
|
|
already have been written on the uncompressed page. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2006-02-10 15:06:17 +00:00
|
|
|
void
|
|
|
|
page_zip_rec_set_deleted(
|
|
|
|
/*=====================*/
|
2009-05-25 05:30:14 +00:00
|
|
|
page_zip_des_t* page_zip,/*!< in/out: compressed page */
|
|
|
|
const byte* rec, /*!< in: record on the uncompressed page */
|
|
|
|
ulint flag) /*!< in: the deleted flag (nonzero=TRUE) */
|
2006-02-10 15:06:17 +00:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2009-05-25 09:52:29 +00:00
|
|
|
/**********************************************************************//**
|
2006-02-10 15:06:17 +00:00
|
|
|
Write the "owned" flag of a record on a compressed page. The n_owned field
|
|
|
|
must already have been written on the uncompressed page. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2006-02-10 15:06:17 +00:00
|
|
|
void
|
|
|
|
page_zip_rec_set_owned(
|
|
|
|
/*===================*/
|
2009-05-25 05:30:14 +00:00
|
|
|
page_zip_des_t* page_zip,/*!< in/out: compressed page */
|
|
|
|
const byte* rec, /*!< in: record on the uncompressed page */
|
|
|
|
ulint flag) /*!< in: the owned flag (nonzero=TRUE) */
|
2006-02-10 15:06:17 +00:00
|
|
|
__attribute__((nonnull));
|
|
|
|
|
2009-05-25 09:52:29 +00:00
|
|
|
/**********************************************************************//**
|
2006-02-10 15:06:17 +00:00
|
|
|
Shift the dense page directory when a record is deleted. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2006-02-10 15:06:17 +00:00
|
|
|
void
|
|
|
|
page_zip_dir_delete(
|
|
|
|
/*================*/
|
2009-05-25 05:30:14 +00:00
|
|
|
page_zip_des_t* page_zip,/*!< in/out: compressed page */
|
|
|
|
byte* rec, /*!< in: deleted record */
|
|
|
|
dict_index_t* index, /*!< in: index of rec */
|
|
|
|
const ulint* offsets,/*!< in: rec_get_offsets(rec) */
|
|
|
|
const byte* free) /*!< in: previous start of the free list */
|
2006-03-16 14:02:22 +00:00
|
|
|
__attribute__((nonnull(1,2,3,4)));
|
2005-10-27 11:48:10 +00:00
|
|
|
|
2009-05-25 09:52:29 +00:00
|
|
|
/**********************************************************************//**
|
2006-03-06 21:00:05 +00:00
|
|
|
Add a slot to the dense page directory. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2006-03-06 21:00:05 +00:00
|
|
|
void
|
|
|
|
page_zip_dir_add_slot(
|
|
|
|
/*==================*/
|
2009-05-25 05:30:14 +00:00
|
|
|
page_zip_des_t* page_zip, /*!< in/out: compressed page */
|
|
|
|
ulint is_clustered) /*!< in: nonzero for clustered index,
|
2006-03-09 17:26:02 +00:00
|
|
|
zero for others */
|
2006-03-06 21:00:05 +00:00
|
|
|
__attribute__((nonnull));
|
2006-02-23 19:25:29 +00:00
|
|
|
#endif
|