MySQL  8.0.19
Source Code Documentation
page0zip.cc File Reference
#include "page0zip.h"
#include "page0size.h"
#include <zlib.h>
#include "btr0cur.h"
#include "dict0dict.h"
#include "log0recv.h"
#include "mtr0log.h"
#include "page0page.h"
#include "page0types.h"
#include "btr0sea.h"
#include "buf0buf.h"
#include "buf0lru.h"
#include "dict0boot.h"
#include "lock0lock.h"
#include "srv0mon.h"
#include "srv0srv.h"
#include "ut0crc32.h"
#include <algorithm>
#include <map>

Macros

#define ASSERT_ZERO(b, s)
 Assert that a block of memory is filled with zero bytes. More...
 
#define ASSERT_ZERO_BLOB(b)   ut_ad(!memcmp(b, field_ref_zero, sizeof field_ref_zero))
 Assert that a BLOB pointer is filled with zero bytes. More...
 
#define page_zip_dir_start_low(page_zip, n_dense)   ((page_zip)->data + page_zip_dir_start_offs(page_zip, n_dense))
 Gets a pointer to the compressed page trailer (the dense page directory), including deleted records (the free list). More...
 
#define page_zip_dir_start(page_zip)   page_zip_dir_start_low(page_zip, page_zip_dir_elems(page_zip))
 Gets a pointer to the compressed page trailer (the dense page directory), including deleted records (the free list). More...
 
#define PAGE_ZIP_COMPRESS_DBG
 Symbol for enabling compression and decompression diagnostics. More...
 
#define deflate(strm, flush)   page_zip_compress_deflate(logfile, strm, flush)
 Debug wrapper for the zlib compression routine deflate(). More...
 
#define FILE_LOGFILE   FILE *logfile,
 Declaration of the logfile parameter. More...
 
#define LOGFILE   logfile,
 The logfile parameter. More...
 

Functions

ulint page_zip_empty_size (ulint n_fields, ulint zip_size)
 Determine the guaranteed free space on an empty page. More...
 
bool page_zip_is_too_big (const dict_index_t *index, const dtuple_t *entry)
 Check whether a tuple is too big for compressed table. More...
 
UNIV_INLINE bytepage_zip_dir_find (page_zip_des_t *page_zip, ulint offset)
 Find the slot of the given non-free record in the dense page directory. More...
 
static void page_zip_compress_write_log (const page_zip_des_t *page_zip, const page_t *page, dict_index_t *index, mtr_t *mtr)
 Write a log record of compressing an index page. More...
 
static ulint page_zip_get_n_prev_extern (const page_zip_des_t *page_zip, const rec_t *rec, const dict_index_t *index)
 Determine how many externally stored columns are contained in existing records with smaller heap_no than rec. More...
 
static bytepage_zip_fixed_field_encode (byte *buf, ulint val)
 Encode the length of a fixed-length column. More...
 
ulint page_zip_fields_encode (ulint n, const dict_index_t *index, ulint trx_id_pos, byte *buf)
 Write the index information for the compressed page. More...
 
static void page_zip_dir_encode (const page_t *page, byte *buf, const rec_t **recs)
 Populate the dense page directory from the sparse directory. More...
 
static int page_zip_compress_deflate (FILE *logfile, z_streamp strm, int flush)
 Wrapper for deflate(). More...
 
static int page_zip_compress_node_ptrs (FILE_LOGFILE z_stream *c_stream, const rec_t **recs, ulint n_dense, dict_index_t *index, byte *storage, mem_heap_t *heap)
 Compress the records of a node pointer page. More...
 
static int page_zip_compress_sec (FILE_LOGFILE z_stream *c_stream, const rec_t **recs, ulint n_dense)
 Compress the records of a leaf node of a secondary index. More...
 
static int page_zip_compress_clust_ext (FILE_LOGFILE z_stream *c_stream, const rec_t *rec, const ulint *offsets, ulint trx_id_col, byte *deleted, byte *storage, byte **externs, ulint *n_blobs)
 Compress a record of a leaf node of a clustered index that contains externally stored columns. More...
 
static int page_zip_compress_clust (FILE_LOGFILE z_stream *c_stream, const rec_t **recs, ulint n_dense, dict_index_t *index, ulint *n_blobs, ulint trx_id_col, byte *deleted, byte *storage, mem_heap_t *heap)
 Compress the records of a leaf node of a clustered index. More...
 
ibool page_zip_compress (page_zip_des_t *page_zip, const page_t *page, dict_index_t *index, ulint level, mtr_t *mtr)
 Compress a page. More...
 
ibool page_zip_decompress (page_zip_des_t *page_zip, page_t *page, ibool all)
 Decompress a page. More...
 
static ibool page_zip_header_cmp (const page_zip_des_t *page_zip, const byte *page)
 Assert that the compressed and decompressed page headers match. More...
 
static bytepage_zip_write_rec_ext (page_zip_des_t *page_zip, const page_t *page, const byte *rec, const dict_index_t *index, const ulint *offsets, ulint create, ulint trx_id_col, ulint heap_no, byte *storage, byte *data)
 Write a record on the compressed page that contains externally stored columns. More...
 
void page_zip_write_rec (page_zip_des_t *page_zip, const byte *rec, const dict_index_t *index, const ulint *offsets, ulint create)
 Write an entire record on the compressed page. More...
 
bytepage_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. More...
 
void page_zip_write_blob_ptr (page_zip_des_t *page_zip, const byte *rec, const 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. More...
 
bytepage_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. More...
 
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. More...
 
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. More...
 
static void page_zip_clear_rec (page_zip_des_t *page_zip, byte *rec, const dict_index_t *index, const ulint *offsets)
 Clear an area on the uncompressed and compressed page. More...
 
void page_zip_rec_set_deleted (page_zip_des_t *page_zip, const byte *rec, ulint flag)
 Write the "deleted" flag of a record on a compressed page. More...
 
void page_zip_rec_set_owned (page_zip_des_t *page_zip, const byte *rec, ulint flag)
 Write the "owned" flag of a record on a compressed page. More...
 
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. More...
 
void page_zip_dir_delete (page_zip_des_t *page_zip, byte *rec, const dict_index_t *index, const ulint *offsets, const byte *free)
 Shift the dense page directory when a record is deleted. More...
 
void page_zip_dir_add_slot (page_zip_des_t *page_zip, bool is_clustered)
 Add a slot to the dense page directory. More...
 
bytepage_zip_parse_write_header (byte *ptr, byte *end_ptr, page_t *page, page_zip_des_t *page_zip)
 Parses a log record of writing to the header of a page. More...
 
void page_zip_write_header_log (const byte *data, ulint length, mtr_t *mtr)
 Write a log record of writing to the uncompressed header portion of a page. More...
 
ibool page_zip_reorganize (buf_block_t *block, dict_index_t *index, mtr_t *mtr)
 Reorganize and compress a page. More...
 
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. More...
 
bytepage_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. More...
 

Variables

const byte field_ref_zero [FIELD_REF_SIZE]
 A BLOB field reference full of zero, for use in assertions and tests. More...
 
page_zip_stat_t page_zip_stat [PAGE_ZIP_SSIZE_MAX]
 Statistics on compression, indexed by page_zip_des_t::ssize - 1. More...
 
page_zip_stat_per_index_t page_zip_stat_per_index
 Statistics on compression, indexed by index->id. More...
 
uint page_zip_level = DEFAULT_COMPRESSION_LEVEL
 Default Zip compression level. More...
 
bool page_zip_log_pages = true
 
static ibool page_zip_compress_dbg
 Set this variable in a debugger to enable excessive logging in page_zip_compress(). More...
 
static unsigned page_zip_compress_log
 Set this variable in a debugger to enable binary logging of the data passed to deflate(). More...
 

Detailed Description

Compressed page interface

Created June 2005 by Marko Makela

Macro Definition Documentation

◆ ASSERT_ZERO

#define ASSERT_ZERO (   b,
 
)
Value:
ut_ad(!memcmp(b, field_ref_zero, \
ut_min(static_cast<size_t>(s), sizeof field_ref_zero)));

Assert that a block of memory is filled with zero bytes.

Compare at most sizeof(field_ref_zero) bytes.

Parameters
bin: memory block
sin: size of the memory block, in bytes

◆ ASSERT_ZERO_BLOB

#define ASSERT_ZERO_BLOB (   b)    ut_ad(!memcmp(b, field_ref_zero, sizeof field_ref_zero))

Assert that a BLOB pointer is filled with zero bytes.

Parameters
bin: BLOB pointer

◆ deflate

#define deflate (   strm,
  flush 
)    page_zip_compress_deflate(logfile, strm, flush)

Debug wrapper for the zlib compression routine deflate().

Log the operation if page_zip_compress_dbg is set.

Parameters
strmin/out: compressed stream
flushin: flushing method
Returns
deflate() status: Z_OK, Z_BUF_ERROR, ...

◆ FILE_LOGFILE

#define FILE_LOGFILE   FILE *logfile,

Declaration of the logfile parameter.

◆ LOGFILE

#define LOGFILE   logfile,

The logfile parameter.

◆ PAGE_ZIP_COMPRESS_DBG

#define PAGE_ZIP_COMPRESS_DBG

Symbol for enabling compression and decompression diagnostics.

◆ page_zip_dir_start

#define page_zip_dir_start (   page_zip)    page_zip_dir_start_low(page_zip, page_zip_dir_elems(page_zip))

Gets a pointer to the compressed page trailer (the dense page directory), including deleted records (the free list).

Parameters
[in]page_zipcompressed page
Returns
pointer to the dense page directory

◆ page_zip_dir_start_low

#define page_zip_dir_start_low (   page_zip,
  n_dense 
)    ((page_zip)->data + page_zip_dir_start_offs(page_zip, n_dense))

Gets a pointer to the compressed page trailer (the dense page directory), including deleted records (the free list).

Parameters
[in]page_zipcompressed page
[in]n_densenumber of entries in the directory
Returns
pointer to the dense page directory

Function Documentation

◆ page_zip_clear_rec()

static void page_zip_clear_rec ( page_zip_des_t page_zip,
byte rec,
const dict_index_t index,
const ulint *  offsets 
)
static

Clear an area on the uncompressed and compressed page.

Do not clear the data payload, as that would grow the modification log.

Parameters
page_zipin/out: compressed page
recin: record to clear
indexin: index of rec
offsetsin: rec_get_offsets(rec, index)

◆ page_zip_compress()

ibool page_zip_compress ( page_zip_des_t page_zip,
const page_t page,
dict_index_t index,
ulint  level,
mtr_t mtr 
)

Compress a page.

Returns
true on success, false on failure; page_zip will be left intact on failure.

< index field information

< compressed payload of the page

< dense page directory, sorted by address

Parameters
page_zipin: size; out: data, n_blobs, m_start, m_end, m_nonempty
pagein: uncompressed page
indexin: index tree
levelin: commpression level
mtrin/out: mini-transaction, or NULL

◆ page_zip_compress_clust()

static int page_zip_compress_clust ( FILE_LOGFILE z_stream *  c_stream,
const rec_t **  recs,
ulint  n_dense,
dict_index_t index,
ulint *  n_blobs,
ulint  trx_id_col,
byte deleted,
byte storage,
mem_heap_t heap 
)
static

Compress the records of a leaf node of a clustered index.

Returns
Z_OK, or a zlib error code
Parameters
c_streamin/out: compressed page stream
recsin: dense page directory sorted by address
n_densein: size of recs[]
indexin: the index of the page
n_blobsin: 0; out: number of externally stored columns
trx_id_colindex of the trx_id column
deletedin: dense directory entry pointing to the head of the free list
storagein: end of dense page directory
heapin: temporary memory heap

◆ page_zip_compress_clust_ext()

static int page_zip_compress_clust_ext ( FILE_LOGFILE z_stream *  c_stream,
const rec_t rec,
const ulint *  offsets,
ulint  trx_id_col,
byte deleted,
byte storage,
byte **  externs,
ulint *  n_blobs 
)
static

Compress a record of a leaf node of a clustered index that contains externally stored columns.

Returns
Z_OK, or a zlib error code
Parameters
c_streamin/out: compressed page stream
recin: record
offsetsin: rec_get_offsets(rec)
trx_id_colin: position of of DB_TRX_ID
deletedin: dense directory entry pointing to the head of the free list
storagein: end of dense page directory
externsin/out: pointer to the next available BLOB pointer
n_blobsin/out: number of externally stored columns

◆ page_zip_compress_deflate()

static int page_zip_compress_deflate ( FILE *  logfile,
z_streamp  strm,
int  flush 
)
static

Wrapper for deflate().

Log the operation if page_zip_compress_dbg is set.

Returns
deflate() status: Z_OK, Z_BUF_ERROR, ...
Parameters
logfilein: log file, or NULL
strmin/out: compressed stream for deflate()
flushin: deflate() flushing method

◆ page_zip_compress_node_ptrs()

static int page_zip_compress_node_ptrs ( FILE_LOGFILE z_stream *  c_stream,
const rec_t **  recs,
ulint  n_dense,
dict_index_t index,
byte storage,
mem_heap_t heap 
)
static

Compress the records of a node pointer page.

Returns
Z_OK, or a zlib error code
Parameters
c_streamin/out: compressed page stream
recsin: dense page directory sorted by address
n_densein: size of recs[]
indexin: the index of the page
storagein: end of dense page directory
heapin: temporary memory heap

◆ page_zip_compress_sec()

static int page_zip_compress_sec ( FILE_LOGFILE z_stream *  c_stream,
const rec_t **  recs,
ulint  n_dense 
)
static

Compress the records of a leaf node of a secondary index.

Returns
Z_OK, or a zlib error code
Parameters
c_streamin/out: compressed page stream
recsin: dense page directory sorted by address
n_densein: size of recs[]

◆ page_zip_compress_write_log()

static void page_zip_compress_write_log ( const page_zip_des_t page_zip,
const page_t page,
dict_index_t index,
mtr_t mtr 
)
static

Write a log record of compressing an index page.

Parameters
page_zipin: compressed page
pagein: uncompressed page
indexin: index of the B-tree node
mtrin: mini-transaction

◆ page_zip_copy_recs()

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

◆ page_zip_decompress()

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_dir_add_slot()

void page_zip_dir_add_slot ( page_zip_des_t page_zip,
bool  is_clustered 
)

Add a slot to the dense page directory.

in: nonzero for clustered index, zero for others

Parameters
page_zipin/out: compressed page
is_clusteredin: nonzero for clustered index, zero for others

◆ page_zip_dir_delete()

void page_zip_dir_delete ( page_zip_des_t page_zip,
byte rec,
const dict_index_t index,
const ulint *  offsets,
const byte free 
)

Shift the dense page directory when a record is deleted.

Shift the dense page directory and the array of BLOB pointers when a record is deleted.

Parameters
[in,out]page_zipcompressed page
[in]recdeleted record
[in]indexindex of rec
[in]offsetsrec_get_offsets(rec)
[in]freeprevious start of the free list

◆ page_zip_dir_encode()

static void page_zip_dir_encode ( const page_t page,
byte buf,
const rec_t **  recs 
)
static

Populate the dense page directory from the sparse directory.

Parameters
pagein: compact page
bufin: pointer to dense page directory[-1]; out: dense directory on compressed page
recsin: pointer to an array of 0, or NULL; out: dense page directory sorted by ascending address (and heap_no)

◆ page_zip_dir_find()

UNIV_INLINE byte* page_zip_dir_find ( page_zip_des_t page_zip,
ulint  offset 
)

Find the slot of the given non-free record in the dense page directory.

Returns
dense directory slot, or NULL if record not found
Parameters
page_zipin: compressed page
offsetin: offset of user record

◆ page_zip_dir_insert()

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

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

◆ page_zip_empty_size()

ulint page_zip_empty_size ( ulint  n_fields,
ulint  zip_size 
)

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_fields_encode()

ulint page_zip_fields_encode ( ulint  n,
const dict_index_t index,
ulint  trx_id_pos,
byte buf 
)

Write the index information for the compressed page.

Returns
used size of buf
Parameters
nin: number of fields to compress
indexin: index comprising at least n fields
trx_id_posin: position of the trx_id column in the index, or ULINT_UNDEFINED if this is a non-leaf page
bufout: buffer of (n + 1) * 2 bytes

◆ page_zip_fixed_field_encode()

static byte* page_zip_fixed_field_encode ( byte buf,
ulint  val 
)
static

Encode the length of a fixed-length column.

Returns
buf + length of encoded val
Parameters
bufin: pointer to buffer where to write
valin: value to write

◆ page_zip_get_n_prev_extern()

static ulint page_zip_get_n_prev_extern ( const page_zip_des_t page_zip,
const rec_t rec,
const dict_index_t index 
)
static

Determine how many externally stored columns are contained in existing records with smaller heap_no than rec.

Parameters
page_zipin: dense page directory on compressed page
recin: compact physical record on a B-tree leaf page
indexin: record descriptor

◆ page_zip_header_cmp()

static ibool page_zip_header_cmp ( const page_zip_des_t page_zip,
const byte page 
)
static

Assert that the compressed and decompressed page headers match.

Returns
true
Parameters
page_zipin: compressed page
pagein: uncompressed page

◆ page_zip_is_too_big()

bool page_zip_is_too_big ( const dict_index_t index,
const dtuple_t entry 
)

Check whether a tuple is too big for compressed table.

Parameters
[in]indexdict index object
[in]entryentry for the index
Returns
true if it's too big, otherwise false

◆ page_zip_parse_compress()

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()

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
Parameters
ptrin: redo log buffer
end_ptrin: redo log buffer end
pagein/out: uncompressed page
page_zipin/out: compressed page

◆ page_zip_parse_write_header()

byte* page_zip_parse_write_header ( byte ptr,
byte end_ptr,
page_t page,
page_zip_des_t page_zip 
)

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

◆ page_zip_parse_write_node_ptr()

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
Parameters
ptrin: redo log buffer
end_ptrin: redo log buffer end
pagein/out: uncompressed page
page_zipin/out: compressed page

◆ page_zip_rec_set_deleted()

void page_zip_rec_set_deleted ( page_zip_des_t page_zip,
const byte rec,
ulint  flag 
)

Write the "deleted" flag of a record on a compressed page.

The flag must already have been written on the uncompressed page.

Parameters
page_zipin/out: compressed page
recin: record on the uncompressed page
flagin: the deleted flag (nonzero=TRUE)

◆ page_zip_rec_set_owned()

void page_zip_rec_set_owned ( page_zip_des_t page_zip,
const byte rec,
ulint  flag 
)

Write the "owned" flag of a record on a compressed page.

The n_owned field must already have been written on the uncompressed page.

Parameters
page_zipin/out: compressed page
recin: record on the uncompressed page
flagin: the owned flag (nonzero=TRUE)

◆ page_zip_reorganize()

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

◆ page_zip_write_blob_ptr()

void page_zip_write_blob_ptr ( page_zip_des_t page_zip,
const byte rec,
const 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_log()

void page_zip_write_header_log ( const byte data,
ulint  length,
mtr_t mtr 
)

Write a log record of writing to the uncompressed header portion of a page.

Parameters
datain: data on the uncompressed page
lengthin: length of the data
mtrin: mini-transaction

◆ page_zip_write_node_ptr()

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.

in: mini-transaction, or NULL

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()

void page_zip_write_rec ( page_zip_des_t page_zip,
const byte rec,
const 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

◆ page_zip_write_rec_ext()

static byte* page_zip_write_rec_ext ( page_zip_des_t page_zip,
const page_t page,
const byte rec,
const dict_index_t index,
const ulint *  offsets,
ulint  create,
ulint  trx_id_col,
ulint  heap_no,
byte storage,
byte data 
)
static

Write a record on the compressed page that contains externally stored columns.

The data must already have been written to the uncompressed page.

Returns
end of modification log
Parameters
page_zipin/out: compressed page
pagein: page containing rec
recin: record being written
indexin: record descriptor
offsetsin: rec_get_offsets(rec, index)
createin: nonzero=insert, zero=update
trx_id_colin: position of DB_TRX_ID
heap_noin: heap number of rec
storagein: end of dense page directory
datain: end of modification log

◆ page_zip_write_trx_id_and_roll_ptr()

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.

in: roll_ptr

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

Variable Documentation

◆ field_ref_zero

const byte field_ref_zero[FIELD_REF_SIZE]
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}

A BLOB field reference full of zero, for use in assertions and tests.

A BLOB field reference full of zero, for use in assertions and tests.Initially, BLOB field references are set to zero, in dtuple_convert_big_rec().

Initially, BLOB field references are set to zero, in dtuple_convert_big_rec().

◆ page_zip_compress_dbg

ibool page_zip_compress_dbg
static

Set this variable in a debugger to enable excessive logging in page_zip_compress().

◆ page_zip_compress_log

unsigned page_zip_compress_log
static

Set this variable in a debugger to enable binary logging of the data passed to deflate().

When this variable is nonzero, it will act as a log file name generator.

◆ page_zip_level

uint page_zip_level = DEFAULT_COMPRESSION_LEVEL

Default Zip compression level.

◆ page_zip_log_pages

bool page_zip_log_pages = true

◆ page_zip_stat

Statistics on compression, indexed by page_zip_des_t::ssize - 1.

◆ page_zip_stat_per_index

page_zip_stat_per_index_t page_zip_stat_per_index

Statistics on compression, indexed by index->id.

Statistics on compression, indexed by dict_index_t::id.

ut_ad
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:65
ut_min
#define ut_min
Definition: ut0ut.h:151
field_ref_zero
const byte field_ref_zero[FIELD_REF_SIZE]
A BLOB field reference full of zero, for use in assertions and tests.
Definition: page0zip.cc:41