#include "mtr0types.h"
#include "page0types.h"
#include "buf0types.h"
#include "dict0types.h"
#include "trx0types.h"
#include "mem0mem.h"
Go to the source code of this file.
Macros | |
#define | page0zip_h |
#define | PAGE_ZIP_MATCH(ptr, page_zip) (buf_frame_get_page_zip(ptr) == (page_zip)) |
Functions | |
UNIV_INLINE ulint | page_zip_get_size (const page_zip_des_t *page_zip) __attribute__((nonnull |
UNIV_INLINE void | page_zip_set_size (page_zip_des_t *page_zip, ulint size) |
UNIV_INLINE ibool | page_zip_rec_needs_ext (ulint rec_size, ulint comp, ulint n_fields, ulint zip_size) __attribute__((const )) |
UNIV_INTERN ulint | page_zip_empty_size (ulint n_fields, ulint zip_size) __attribute__((const )) |
UNIV_INLINE void | page_zip_des_init (page_zip_des_t *page_zip) |
UNIV_INTERN void | page_zip_set_alloc (void *stream, mem_heap_t *heap) |
UNIV_INTERN ibool | page_zip_compress (page_zip_des_t *page_zip, const page_t *page, dict_index_t *index, mtr_t *mtr) __attribute__((nonnull(1 |
UNIV_INTERN ibool UNIV_INTERN ibool | page_zip_decompress (page_zip_des_t *page_zip, page_t *page, ibool all) __attribute__((nonnull(1 |
UNIV_INTERN ibool UNIV_INTERN ibool UNIV_INLINE lint | page_zip_max_ins_size (const page_zip_des_t *page_zip, ibool is_clust) __attribute__((nonnull |
UNIV_INLINE ibool | page_zip_available (const page_zip_des_t *page_zip, ibool is_clust, ulint length, ulint create) __attribute__((nonnull |
UNIV_INLINE void | page_zip_write_header (page_zip_des_t *page_zip, const byte *str, ulint length, mtr_t *mtr) __attribute__((nonnull(1 |
UNIV_INLINE void UNIV_INTERN void | page_zip_write_rec (page_zip_des_t *page_zip, const byte *rec, dict_index_t *index, const ulint *offsets, ulint create) __attribute__((nonnull)) |
UNIV_INTERN byte * | page_zip_parse_write_blob_ptr (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip) |
UNIV_INTERN void | page_zip_write_blob_ptr (page_zip_des_t *page_zip, const byte *rec, dict_index_t *index, const ulint *offsets, ulint n, mtr_t *mtr) __attribute__((nonnull(1 |
UNIV_INTERN void UNIV_INTERN byte * | page_zip_parse_write_node_ptr (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip) |
UNIV_INTERN void | page_zip_write_node_ptr (page_zip_des_t *page_zip, byte *rec, ulint size, ulint ptr, mtr_t *mtr) __attribute__((nonnull(1 |
UNIV_INTERN void UNIV_INTERN void | page_zip_write_trx_id_and_roll_ptr (page_zip_des_t *page_zip, byte *rec, const ulint *offsets, ulint trx_id_col, trx_id_t trx_id, roll_ptr_t roll_ptr) __attribute__((nonnull)) |
UNIV_INTERN void | page_zip_dir_insert (page_zip_des_t *page_zip, const byte *prev_rec, const byte *free_rec, byte *rec) |
UNIV_INTERN byte * | page_zip_parse_write_header (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip) |
UNIV_INTERN ibool | page_zip_reorganize (buf_block_t *block, dict_index_t *index, mtr_t *mtr) __attribute__((nonnull)) |
UNIV_INTERN void | page_zip_copy_recs (page_zip_des_t *page_zip, page_t *page, const page_zip_des_t *src_zip, const page_t *src, dict_index_t *index, mtr_t *mtr) __attribute__((nonnull(1 |
UNIV_INTERN void UNIV_INTERN byte * | page_zip_parse_compress (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip) __attribute__((nonnull(1 |
UNIV_INTERN void UNIV_INTERN byte UNIV_INTERN ulint | page_zip_calc_checksum (const void *data, ulint size) __attribute__((nonnull)) |
Variables | |
UNIV_INLINE ulint | pure |
#define PAGE_ZIP_MATCH | ( | ptr, | |
page_zip | |||
) | (buf_frame_get_page_zip(ptr) == (page_zip)) |
Check if a pointer to an uncompressed page matches a compressed page.
ptr | pointer to an uncompressed page frame |
page_zip | compressed page descriptor |
Definition at line 390 of file page0zip.h.
Referenced by page_zip_write_rec(), and page_zip_write_trx_id_and_roll_ptr().
UNIV_INLINE ibool page_zip_available | ( | const page_zip_des_t * | page_zip, |
ibool | is_clust, | ||
ulint | length, | ||
ulint | create | ||
) |
Determine if enough space is available in the modification log.
page_zip | in: compressed page |
is_clust | in: TRUE if clustered index |
length | in: combined size of the record |
create | in: nonzero=add the record to the heap |
Referenced by btr_cur_update_alloc_zip(), and page_cur_insert_rec_zip().
UNIV_INTERN void UNIV_INTERN byte UNIV_INTERN ulint page_zip_calc_checksum | ( | const void * | data, |
ulint | size | ||
) |
Calculate the compressed page checksum.
data | in: compressed page |
size | in: size of compressed page |
Definition at line 4648 of file page0zip.cc.
References FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, FIL_PAGE_LSN, FIL_PAGE_OFFSET, FIL_PAGE_TYPE, page_zip_calc_checksum(), and ut_ad.
Referenced by buf_flush_init_for_writing(), buf_LRU_free_block(), buf_page_is_corrupted(), buf_page_print(), buf_zip_decompress(), and page_zip_calc_checksum().
UNIV_INTERN ibool page_zip_compress | ( | page_zip_des_t * | page_zip, |
const page_t * | page, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Compress a page.
page_zip | in: size; out: data, n_blobs, m_start, m_end, m_nonempty |
page | in: uncompressed page |
index | in: index of the B-tree node |
mtr | in: mini-transaction, or NULL |
Referenced by btr_cur_update_alloc_zip(), page_copy_rec_list_end(), page_copy_rec_list_start(), page_create_zip(), and page_zip_reorganize().
UNIV_INTERN void page_zip_copy_recs | ( | page_zip_des_t * | page_zip, |
page_t * | page, | ||
const page_zip_des_t * | src_zip, | ||
const page_t * | src, | ||
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Copy the records of a page byte for byte. Do not copy the page header or trailer, except those B-tree header fields that are directly related to the storage of records. Also copy PAGE_MAX_TRX_ID. NOTE: The caller must update the lock table and the adaptive hash index.
page_zip | out: copy of src_zip (n_blobs, m_start, m_end, m_nonempty, data[0..size-1]) |
page | out: copy of src |
src_zip | in: compressed page |
src | in: page |
index | in: index of the B-tree |
mtr | in: mini-transaction |
Referenced by btr_page_split_and_insert(), and btr_root_raise_and_insert().
UNIV_INTERN ibool UNIV_INTERN ibool page_zip_decompress | ( | page_zip_des_t * | page_zip, |
page_t * | page, | ||
ibool | all | ||
) |
Decompress a page. This function should tolerate errors on the compressed page. Instead of letting assertions fail, it will return FALSE if an inconsistency is detected.
page_zip | in: data, ssize; out: m_start, m_end, m_nonempty, n_blobs |
page | out: uncompressed page, may be trashed |
all | in: TRUE=decompress the whole page; FALSE=verify but do not copy some page header fields that should not change after page creation |
Referenced by buf_zip_decompress(), page_copy_rec_list_end(), and page_copy_rec_list_start().
UNIV_INLINE void page_zip_des_init | ( | page_zip_des_t * | page_zip) |
Initialize a compressed page descriptor. in/out: compressed page descriptor
Referenced by buf_page_init_for_read(), and fil_reset_too_high_lsns().
UNIV_INTERN void page_zip_dir_insert | ( | page_zip_des_t * | page_zip, |
const byte * | prev_rec, | ||
const byte * | free_rec, | ||
byte * | rec | ||
) |
Insert a record to the dense page directory. in: record to insert
Insert a record to the dense page directory.
page_zip | in/out: compressed page |
prev_rec | in: record after which to insert |
free_rec | in: record from which rec was allocated, or NULL |
rec | in: record to insert |
Definition at line 4074 of file page0zip.cc.
References page_zip_des_struct::data, mach_write_to_2(), page_dir_get_n_heap(), page_offset(), page_rec_get_next(), page_rec_is_infimum(), page_zip_dir_insert(), page_zip_get_size(), rec_get_heap_no_new(), ut_a, and ut_ad.
Referenced by page_cur_insert_rec_zip(), and page_zip_dir_insert().
UNIV_INTERN ulint page_zip_empty_size | ( | ulint | n_fields, |
ulint | zip_size | ||
) | const |
Determine the guaranteed free space on an empty page.
n_fields | in: number of columns in the index |
zip_size | in: compressed page size in bytes |
UNIV_INLINE ulint page_zip_get_size | ( | const page_zip_des_t * | page_zip) |
Determine the size of a compressed page in bytes.
page_zip | in: compressed page |
Referenced by btr_root_raise_and_insert(), buf_flush_init_for_writing(), buf_LRU_block_free_non_file_page(), buf_LRU_free_block(), buf_page_get_gen(), buf_page_init_for_read(), buf_zip_decompress(), page_zip_dir_add_slot(), page_zip_dir_insert(), page_zip_parse_write_node_ptr(), page_zip_rec_set_deleted(), page_zip_rec_set_owned(), page_zip_reorganize(), page_zip_write_rec(), and page_zip_write_trx_id_and_roll_ptr().
UNIV_INTERN ibool UNIV_INTERN ibool UNIV_INLINE lint page_zip_max_ins_size | ( | const page_zip_des_t * | page_zip, |
ibool | is_clust | ||
) |
Determine how big record can be inserted without recompressing the page.
page_zip | in: compressed page |
is_clust | in: TRUE if clustered index |
UNIV_INTERN void UNIV_INTERN byte* page_zip_parse_compress | ( | byte * | ptr, |
byte * | end_ptr, | ||
page_t * | page, | ||
page_zip_des_t * | page_zip | ||
) |
Parses a log record of compressing an index page.
ptr | in: buffer |
end_ptr | in: buffer end |
page | out: uncompressed page |
page_zip | out: compressed page |
UNIV_INTERN byte* page_zip_parse_write_blob_ptr | ( | byte * | ptr, |
byte * | end_ptr, | ||
page_t * | page, | ||
page_zip_des_t * | page_zip | ||
) |
Parses a log record of writing a BLOB pointer of a record.
Parses a log record of writing a BLOB pointer of a record.
ptr | in: redo log buffer |
end_ptr | in: redo log buffer end |
page | in/out: uncompressed page |
page_zip | in/out: compressed page |
Definition at line 3562 of file page0zip.cc.
References page_zip_des_struct::data, recv_sys_struct::found_corrupt_log, mach_read_from_2(), page_is_leaf(), page_zip_parse_write_blob_ptr(), recv_sys, ut_a, and ut_ad.
Referenced by page_zip_parse_write_blob_ptr().
UNIV_INTERN byte* page_zip_parse_write_header | ( | byte * | ptr, |
byte * | end_ptr, | ||
page_t * | page, | ||
page_zip_des_t * | page_zip | ||
) |
in/out: compressed page
Parses a log record of writing to the header of a page.
ptr | in: redo log buffer |
end_ptr | in: redo log buffer end |
page | in/out: uncompressed page |
page_zip | in/out: compressed page |
Definition at line 4307 of file page0zip.cc.
References page_zip_des_struct::data, recv_sys_struct::found_corrupt_log, page_zip_parse_write_header(), recv_sys, ut_a, and ut_ad.
Referenced by page_zip_parse_write_header().
UNIV_INTERN void UNIV_INTERN byte* page_zip_parse_write_node_ptr | ( | byte * | ptr, |
byte * | end_ptr, | ||
page_t * | page, | ||
page_zip_des_t * | page_zip | ||
) |
Parses a log record of writing the node pointer of a record.
Parses a log record of writing the node pointer of a record.
ptr | in: redo log buffer |
end_ptr | in: redo log buffer end |
page | in/out: uncompressed page |
page_zip | in/out: compressed page |
Definition at line 3705 of file page0zip.cc.
References page_zip_des_struct::data, recv_sys_struct::found_corrupt_log, mach_read_from_2(), page_dir_get_n_heap(), page_is_leaf(), page_zip_get_size(), page_zip_parse_write_node_ptr(), recv_sys, ut_a, and ut_ad.
Referenced by page_zip_parse_write_node_ptr().
UNIV_INLINE ibool page_zip_rec_needs_ext | ( | ulint | rec_size, |
ulint | comp, | ||
ulint | n_fields, | ||
ulint | zip_size | ||
) | const |
Determine if a record is so big that it needs to be stored externally.
rec_size | in: length of the record in bytes |
comp | in: nonzero=compact format |
n_fields | in: number of fields in the record; ignored if zip_size == 0 |
zip_size | in: compressed page size in bytes, or 0 |
Referenced by dtuple_convert_big_rec().
UNIV_INTERN ibool page_zip_reorganize | ( | buf_block_t * | block, |
dict_index_t * | index, | ||
mtr_t * | mtr | ||
) |
Reorganize and compress a page. This is a low-level operation for compressed pages, to be used when page_zip_compress() fails. On success, a redo log entry MLOG_ZIP_PAGE_COMPRESS will be written. The function btr_page_reorganize() should be preferred whenever possible. IMPORTANT: if page_zip_reorganize() is invoked on a leaf page of a non-clustered index, the caller must update the insert buffer free bits in the same mini-transaction in such a way that the modification will be redo-logged.
block | in/out: page with compressed page; on the compressed page, in: size; out: data, n_blobs, m_start, m_end, m_nonempty |
index | in: index of the B-tree node |
mtr | in: mini-transaction |
Definition at line 4410 of file page0zip.cc.
References buf_block_free(), buf_block_get_page_zip, buf_frame_copy(), buf_pool_from_block(), buf_block_struct::check_index_page_at_flush, page_zip_des_struct::data, dict_index_is_clust(), dict_index_is_ibuf(), buf_block_struct::frame, lock_move_reorganize_page(), mtr_set_log_mode(), page_copy_rec_list_end_no_locks(), page_create(), page_get_max_trx_id(), page_is_comp(), page_is_leaf(), page_set_max_trx_id(), page_zip_compress(), page_zip_get_size(), page_zip_reorganize(), and ut_ad.
Referenced by page_copy_rec_list_end(), page_copy_rec_list_start(), and page_zip_reorganize().
UNIV_INTERN void page_zip_set_alloc | ( | void * | stream, |
mem_heap_t * | heap | ||
) |
Configure the zlib allocator to use the given memory heap. in: memory heap to use
Configure the zlib allocator to use the given memory heap.
stream | in/out: zlib stream |
heap | in: memory heap to use |
Definition at line 674 of file page0zip.cc.
References page_zip_set_alloc().
Referenced by page_zip_set_alloc().
UNIV_INLINE void page_zip_set_size | ( | page_zip_des_t * | page_zip, |
ulint | size | ||
) |
Set the size of a compressed page in bytes. in: size in bytes
page_zip | in/out: compressed page |
Referenced by buf_LRU_block_free_non_file_page(), buf_LRU_free_block(), buf_LRU_get_free_block(), buf_page_create(), buf_page_init_for_read(), fil_create_new_single_table_tablespace(), and fil_reset_too_high_lsns().
UNIV_INTERN void page_zip_write_blob_ptr | ( | page_zip_des_t * | page_zip, |
const byte * | rec, | ||
dict_index_t * | index, | ||
const ulint * | offsets, | ||
ulint | n, | ||
mtr_t * | mtr | ||
) |
Write a BLOB pointer of a record on the leaf page of a clustered index. The information must already have been updated on the uncompressed page.
page_zip | in/out: compressed page |
rec | in/out: record whose data is being written |
index | in: index of the page |
offsets | in: rec_get_offsets(rec, index) |
n | in: column index |
mtr | in: mini-transaction handle, or NULL if no logging is needed |
UNIV_INLINE void page_zip_write_header | ( | page_zip_des_t * | page_zip, |
const byte * | str, | ||
ulint | length, | ||
mtr_t * | mtr | ||
) |
Write data to the uncompressed header portion of a page. The data must already have been written to the uncompressed page.
page_zip | in/out: compressed page |
str | in: address on the uncompressed page |
length | in: length of the data |
mtr | in: mini-transaction, or NULL |
Referenced by page_set_max_trx_id().
UNIV_INTERN void page_zip_write_node_ptr | ( | page_zip_des_t * | page_zip, |
byte * | rec, | ||
ulint | size, | ||
ulint | ptr, | ||
mtr_t * | mtr | ||
) |
Write the node pointer of a record on a non-leaf compressed page.
page_zip | in/out: compressed page |
rec | in/out: record |
size | in: data size of rec |
ptr | in: node pointer |
mtr | in: mini-transaction, or NULL |
UNIV_INLINE void UNIV_INTERN void page_zip_write_rec | ( | page_zip_des_t * | page_zip, |
const byte * | rec, | ||
dict_index_t * | index, | ||
const ulint * | offsets, | ||
ulint | create | ||
) |
Write an entire record on the compressed page. The data must already have been written to the uncompressed page.
page_zip | in/out: compressed page |
rec | in: record being written |
index | in: the index the record belongs to |
offsets | in: rec_get_offsets(rec, index) |
create | in: nonzero=insert, zero=update |
Definition at line 3374 of file page0zip.cc.
References page_zip_des_struct::data, dict_index_get_sys_col_pos(), dict_index_is_clust(), page_zip_des_struct::m_end, page_zip_des_struct::m_nonempty, page_align(), page_dir_get_n_heap(), page_dir_get_n_slots(), page_is_leaf(), page_offset(), page_simple_validate_new(), page_zip_get_size(), PAGE_ZIP_MATCH, page_zip_write_rec(), rec_get_deleted_flag(), rec_get_end(), rec_get_heap_no_new(), rec_get_start(), rec_offs_any_extern(), rec_offs_comp(), rec_offs_data_size(), rec_offs_extra_size(), rec_offs_validate(), ut_a, and ut_ad.
Referenced by page_cur_insert_rec_zip(), page_zip_write_rec(), and row_upd_rec_in_place().
UNIV_INTERN void UNIV_INTERN void page_zip_write_trx_id_and_roll_ptr | ( | page_zip_des_t * | page_zip, |
byte * | rec, | ||
const ulint * | offsets, | ||
ulint | trx_id_col, | ||
trx_id_t | trx_id, | ||
roll_ptr_t | roll_ptr | ||
) |
Write the trx_id and roll_ptr of a record on a B-tree leaf node page.
page_zip | in/out: compressed page |
rec | in/out: record |
offsets | in: rec_get_offsets(rec, index) |
trx_id_col | in: column number of TRX_ID in rec |
trx_id | in: transaction identifier |
roll_ptr | in: roll_ptr |
Definition at line 3848 of file page0zip.cc.
References page_zip_des_struct::data, mach_write_to_6(), mach_write_to_7(), page_align(), page_dir_get_n_heap(), page_is_leaf(), page_simple_validate_new(), page_zip_get_size(), PAGE_ZIP_MATCH, page_zip_write_trx_id_and_roll_ptr(), rec_get_heap_no_new(), rec_offs_comp(), rec_offs_data_size(), rec_offs_extra_size(), rec_offs_validate(), ut_a, and ut_ad.
Referenced by page_zip_write_trx_id_and_roll_ptr(), and row_upd_rec_sys_fields_in_recovery().