drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
page0zip.h File Reference
#include "mtr0types.h"
#include "page0types.h"
#include "buf0types.h"
#include "dict0types.h"
#include "trx0types.h"
#include "mem0mem.h"
Include dependency graph for page0zip.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define page0zip_h
#define PAGE_ZIP_MATCH(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))
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 byte UNIV_INTERN ulint page_zip_calc_checksum (const void *data, ulint size) __attribute__((nonnull))

Variables

UNIV_INLINE ulint pure

Detailed Description

Compressed page interface

Created June 2005 by Marko Makela

Definition in file page0zip.h.

Macro Definition Documentation

◆ page0zip_h

#define page0zip_h

Definition at line 28 of file page0zip.h.

◆ PAGE_ZIP_MATCH

#define PAGE_ZIP_MATCH ( ptr,
page_zip )
Value:
(buf_frame_get_page_zip(ptr) == (page_zip))

Check if a pointer to an uncompressed page matches a compressed page.

Parameters
ptrpointer to an uncompressed page frame
page_zipcompressed page descriptor
Returns
TRUE if ptr and page_zip refer to the same block

Definition at line 390 of file page0zip.h.

Function Documentation

◆ page_zip_available()

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.

Returns
TRUE if page_zip_write_rec() will succeed
Parameters
page_zipin: compressed page
is_clustin: TRUE if clustered index
lengthin: combined size of the record
createin: nonzero=add the record to the heap

◆ page_zip_calc_checksum()

UNIV_INTERN byte UNIV_INTERN ulint page_zip_calc_checksum ( const void * data,
ulint size )

Calculate the compressed page checksum.

Returns
page checksum
Parameters
datain: compressed page
sizein: size of compressed page

Definition at line 4650 of file page0zip.cc.

◆ page_zip_compress()

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.

Returns
TRUE on success, FALSE on failure; page_zip will be left intact on failure.
Parameters
page_zipin: size; out: data, n_blobs, m_start, m_end, m_nonempty
pagein: uncompressed page
indexin: index of the B-tree node
mtrin: mini-transaction, or NULL

◆ page_zip_copy_recs()

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.

Parameters
page_zipout: copy of src_zip (n_blobs, m_start, m_end, m_nonempty, data[0..size-1])
pageout: copy of src
src_zipin: compressed page
srcin: page
indexin: index of the B-tree
mtrin: mini-transaction

Definition at line 4496 of file page0zip.cc.

◆ page_zip_decompress()

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.

Returns
TRUE on success, FALSE on failure
Parameters
page_zipin: data, ssize; out: m_start, m_end, m_nonempty, n_blobs
pageout: uncompressed page, may be trashed
allin: TRUE=decompress the whole page; FALSE=verify but do not copy some page header fields that should not change after page creation

◆ page_zip_des_init()

UNIV_INLINE void page_zip_des_init ( page_zip_des_t * page_zip)

Initialize a compressed page descriptor. in/out: compressed page descriptor

◆ page_zip_dir_insert()

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.

Parameters
page_zipin/out: compressed page
prev_recin: record after which to insert
free_recin: record from which rec was allocated, or NULL
recin: record to insert

Definition at line 4073 of file page0zip.cc.

◆ page_zip_empty_size()

UNIV_INTERN ulint page_zip_empty_size ( ulint n_fields,
ulint zip_size ) const

Determine the guaranteed free space on an empty page.

Returns
minimum payload size on the page
Parameters
n_fieldsin: number of columns in the index
zip_sizein: compressed page size in bytes

◆ page_zip_get_size()

UNIV_INLINE ulint page_zip_get_size ( const page_zip_des_t * page_zip)

Determine the size of a compressed page in bytes.

Returns
size in bytes
Parameters
page_zipin: compressed page

◆ page_zip_max_ins_size()

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.

Returns
a positive number indicating the maximum size of a record whose insertion is guaranteed to succeed, or zero or negative
Parameters
page_zipin: compressed page
is_clustin: TRUE if clustered index

◆ page_zip_parse_compress()

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.

Returns
end of log record or NULL
Parameters
ptrin: buffer
end_ptrin: buffer end
pageout: uncompressed page
page_zipout: compressed page

◆ page_zip_parse_write_blob_ptr()

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.

Returns
end of log record or NULL in/out: compressed page

Parses a log record of writing a BLOB pointer of a record.

Returns
end of log record or NULL
Parameters
ptrin: redo log buffer
end_ptrin: redo log buffer end
pagein/out: uncompressed page
page_zipin/out: compressed page

Definition at line 3561 of file page0zip.cc.

◆ page_zip_parse_write_header()

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.

Returns
end of log record or NULL
Parameters
ptrin: redo log buffer
end_ptrin: redo log buffer end
pagein/out: uncompressed page
page_zipin/out: compressed page

Definition at line 4306 of file page0zip.cc.

◆ page_zip_parse_write_node_ptr()

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.

Returns
end of log record or NULL in/out: compressed page

Parses a log record of writing the node pointer of a record.

Returns
end of log record or NULL
Parameters
ptrin: redo log buffer
end_ptrin: redo log buffer end
pagein/out: uncompressed page
page_zipin/out: compressed page

Definition at line 3704 of file page0zip.cc.

◆ page_zip_rec_needs_ext()

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.

Returns
FALSE if the entire record can be stored locally on the page
Parameters
rec_sizein: length of the record in bytes
compin: nonzero=compact format
n_fieldsin: number of fields in the record; ignored if zip_size == 0
zip_sizein: compressed page size in bytes, or 0

◆ page_zip_reorganize()

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.

Returns
TRUE on success, FALSE on failure; page_zip will be left intact on failure, but page will be overwritten.
Parameters
blockin/out: page with compressed page; on the compressed page, in: size; out: data, n_blobs, m_start, m_end, m_nonempty
indexin: index of the B-tree node
mtrin: mini-transaction

Definition at line 4409 of file page0zip.cc.

◆ page_zip_set_alloc()

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.

Parameters
streamin/out: zlib stream
heapin: memory heap to use

Definition at line 674 of file page0zip.cc.

◆ page_zip_set_size()

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

Parameters
page_zipin/out: compressed page

◆ page_zip_write_blob_ptr()

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.

Parameters
page_zipin/out: compressed page
recin/out: record whose data is being written
indexin: index of the page
offsetsin: rec_get_offsets(rec, index)
nin: column index
mtrin: mini-transaction handle, or NULL if no logging is needed

◆ page_zip_write_header()

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.

Parameters
page_zipin/out: compressed page
strin: address on the uncompressed page
lengthin: length of the data
mtrin: mini-transaction, or NULL

◆ page_zip_write_node_ptr()

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.

Parameters
page_zipin/out: compressed page
recin/out: record
sizein: data size of rec
ptrin: node pointer
mtrin: mini-transaction, or NULL

◆ page_zip_write_rec()

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.

Parameters
page_zipin/out: compressed page
recin: record being written
indexin: the index the record belongs to
offsetsin: rec_get_offsets(rec, index)
createin: nonzero=insert, zero=update

Definition at line 3373 of file page0zip.cc.

◆ page_zip_write_trx_id_and_roll_ptr()

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.

Parameters
page_zipin/out: compressed page
recin/out: record
offsetsin: rec_get_offsets(rec, index)
trx_id_colin: column number of TRX_ID in rec
trx_idin: transaction identifier
roll_ptrin: roll_ptr

Definition at line 3847 of file page0zip.cc.

Variable Documentation

◆ pure

UNIV_INLINE ibool pure

Definition at line 50 of file page0zip.h.