diff options
Diffstat (limited to 'storage/innobase/include/page0zip.ic')
-rw-r--r-- | storage/innobase/include/page0zip.ic | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic index 6c7d8cd32c7..cbb3660a6ae 100644 --- a/storage/innobase/include/page0zip.ic +++ b/storage/innobase/include/page0zip.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -32,6 +32,7 @@ Created June 2005 by Marko Makela #include "page0zip.h" #include "mtr0log.h" #include "page0page.h" +#include "srv0srv.h" /* The format of compressed pages is as follows. @@ -100,20 +101,9 @@ In summary, the compressed page looks like this: - deleted records (free list) in link order */ -/** Start offset of the area that will be compressed */ -#define PAGE_ZIP_START PAGE_NEW_SUPREMUM_END -/** Size of an compressed page directory entry */ -#define PAGE_ZIP_DIR_SLOT_SIZE 2 -/** Mask of record offsets */ -#define PAGE_ZIP_DIR_SLOT_MASK 0x3fff -/** 'owned' flag */ -#define PAGE_ZIP_DIR_SLOT_OWNED 0x4000 -/** 'deleted' flag */ -#define PAGE_ZIP_DIR_SLOT_DEL 0x8000 - /**********************************************************************//** Determine the size of a compressed page in bytes. -@return size in bytes */ +@return size in bytes */ UNIV_INLINE ulint page_zip_get_size( @@ -159,22 +149,23 @@ page_zip_set_size( } #ifndef UNIV_HOTBACKUP -/**********************************************************************//** -Determine if a record is so big that it needs to be stored externally. -@return FALSE if the entire record can be stored locally on the page */ +/** Determine if a record is so big that it needs to be stored externally. +@param[in] rec_size length of the record in bytes +@param[in] comp nonzero=compact format +@param[in] n_fields number of fields in the record; ignored if +tablespace is not compressed +@param[in] page_size page size +@return FALSE if the entire record can be stored locally on the page */ UNIV_INLINE ibool page_zip_rec_needs_ext( -/*===================*/ - ulint rec_size, /*!< in: length of the record in bytes */ - ulint comp, /*!< in: nonzero=compact format */ - ulint n_fields, /*!< in: number of fields in the record; - ignored if zip_size == 0 */ - ulint zip_size) /*!< in: compressed page size in bytes, or 0 */ + ulint rec_size, + ulint comp, + ulint n_fields, + const page_size_t& page_size) { ut_ad(rec_size > comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES); - ut_ad(ut_is_2pow(zip_size)); - ut_ad(comp || !zip_size); + ut_ad(comp || !page_size.is_compressed()); #if UNIV_PAGE_SIZE_MAX > REC_MAX_DATA_SIZE if (rec_size >= REC_MAX_DATA_SIZE) { @@ -182,7 +173,7 @@ page_zip_rec_needs_ext( } #endif - if (zip_size) { + if (page_size.is_compressed()) { ut_ad(comp); /* On a compressed page, there is a two-byte entry in the dense page directory for every record. But there @@ -191,7 +182,7 @@ page_zip_rec_needs_ext( the encoded heap number. Check also the available space on the uncompressed page. */ return(rec_size - (REC_N_NEW_EXTRA_BYTES - 2 - 1) - >= page_zip_empty_size(n_fields, zip_size) + >= page_zip_empty_size(n_fields, page_size.physical()) || rec_size >= page_get_free_space_of_empty(TRUE) / 2); } @@ -202,7 +193,7 @@ page_zip_rec_needs_ext( #ifdef UNIV_DEBUG /**********************************************************************//** Validate a compressed page descriptor. -@return TRUE if ok */ +@return TRUE if ok */ UNIV_INLINE ibool page_zip_simple_validate( @@ -286,7 +277,7 @@ page_zip_max_ins_size( /**********************************************************************//** Determine if enough space is available in the modification log. -@return TRUE if enough space is available */ +@return TRUE if enough space is available */ UNIV_INLINE ibool page_zip_available( @@ -336,7 +327,6 @@ page_zip_des_init( /**********************************************************************//** Write a log record of writing to the uncompressed header portion of a page. */ -UNIV_INTERN void page_zip_write_header_log( /*======================*/ @@ -403,7 +393,7 @@ page_zip_compress_write_log_no_data( /**********************************************************************//** Parses a log record of compressing an index page without the data. -@return end of log record or NULL */ +@return end of log record or NULL */ UNIV_INLINE byte* page_zip_parse_compress_no_data( @@ -426,7 +416,7 @@ page_zip_parse_compress_no_data( was successful. Crash in this case. */ if (page - && !page_zip_compress(page_zip, page, index, level, NULL)) { + && !page_zip_compress(page_zip, page, index, level, NULL, NULL)) { ut_error; } |