MySQL 8.4.2
Source Code Documentation
lob0lob.h File Reference

Implements the large objects (LOB) module. More...

#include <my_dbug.h>
#include "btr0pcur.h"
#include "dict0mem.h"
#include "page0page.h"
#include "row0log.h"
#include "univ.i"

Go to the source code of this file.

Classes

struct  lob::ref_mem_t
 In memory representation of the LOB reference. More...
 
struct  lob::ref_t
 The struct 'lob::ref_t' represents an external field reference. More...
 
class  lob::BtrContext
 The B-tree context under which the LOB operation is done. More...
 
struct  lob::InsertContext
 The context for a LOB operation. More...
 
struct  lob::blob_page_info_t
 Information about data stored in one BLOB page. More...
 
struct  lob::blob_dir_t
 The in-memory blob directory. More...
 
struct  lob::ReadContext
 The context information for reading a single BLOB. More...
 
struct  lob::zReader
 Fetch compressed BLOB. More...
 
struct  lob::Reader
 Fetch uncompressed BLOB. More...
 
struct  lob::DeleteContext
 The context information when the delete operation on LOB is taking place. More...
 

Namespaces

namespace  lob
 Provides the large objects (LOB) module.
 

Typedefs

typedef std::map< page_no_t, buf_block_t * > BlockCache
 

Enumerations

enum  lob::opcode {
  lob::OPCODE_INSERT = 0 , lob::OPCODE_INSERT_UPDATE , lob::OPCODE_UPDATE , lob::OPCODE_INSERT_BULK ,
  lob::OPCODE_UNKNOWN
}
 LOB operation code for btr_store_big_rec_extern_fields(). More...
 

Functions

std::ostream & lob::operator<< (std::ostream &out, const ref_t &obj)
 Overload the global output stream operator to easily print the lob::ref_t object into the output stream. More...
 
dberr_t lob::btr_store_big_rec_extern_fields (trx_t *trx, btr_pcur_t *pcur, const upd_t *upd, ulint *offsets, const big_rec_t *big_rec_vec, mtr_t *btr_mtr, opcode op)
 Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. More...
 
bytelob::btr_rec_copy_externally_stored_field_func (trx_t *trx, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const page_size_t &page_size, ulint no, ulint *len, size_t *lob_version, bool is_sdi, mem_heap_t *heap, bool is_rebuilt)
 Copies an externally stored field of a record to mem heap. More...
 
static bytelob::btr_rec_copy_externally_stored_field (trx_t *trx, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const page_size_t &page_size, ulint no, ulint *len, size_t *ver, bool is_sdi, mem_heap_t *heap)
 
ulint lob::btr_rec_get_field_ref_offs (const dict_index_t *index, const ulint *offsets, ulint n)
 Gets the offset of the pointer to the externally stored part of a field. More...
 
static const bytelob::btr_rec_get_field_ref (const dict_index_t *index, const byte *rec, const ulint *offsets, ulint n)
 Gets a pointer to the externally stored part of a field. More...
 
static bytelob::btr_rec_get_field_ref (const dict_index_t *index, byte *rec, const ulint *offsets, ulint n)
 Gets a pointer to the externally stored part of a field. More...
 
void lob::blob_free (dict_index_t *index, buf_block_t *block, bool all, mtr_t *mtr)
 Deallocate a buffer block that was reserved for a BLOB part. More...
 
std::ostream & lob::operator<< (std::ostream &out, const blob_page_info_t &obj)
 
std::ostream & lob::operator<< (std::ostream &out, const blob_dir_t &obj)
 Overloading the global output operator to print the blob_dir_t object into an output stream. More...
 
bool lob::btr_lob_op_is_update (opcode op)
 Determine if an operation on off-page columns is an update. More...
 
ulint lob::btr_copy_externally_stored_field_prefix_func (trx_t *trx, const dict_index_t *index, byte *buf, ulint len, const page_size_t &page_size, const byte *data, bool is_sdi, ulint local_len)
 Copies the prefix of an externally stored field of a record. More...
 
bytelob::btr_copy_externally_stored_field_func (trx_t *trx, const dict_index_t *index, ulint *len, size_t *lob_version, const byte *data, const page_size_t &page_size, ulint local_len, bool is_sdi, mem_heap_t *heap)
 Copies an externally stored field of a record to mem heap. More...
 
static ulint lob::btr_copy_externally_stored_field_prefix (trx_t *trx, const dict_index_t *index, byte *buf, ulint len, const page_size_t &page_size, const byte *data, bool is_sdi, ulint local_len)
 
static bytelob::btr_copy_externally_stored_field (trx_t *trx, const dict_index_t *index, ulint *len, size_t *ver, const byte *data, const page_size_t &page_size, ulint local_len, bool is_sdi, mem_heap_t *heap)
 
ulint lob::btr_rec_get_externally_stored_len (const dict_index_t *index, const rec_t *rec, const ulint *offsets)
 Gets the externally stored size of a record, in units of a database page. More...
 
void lob::purge (lob::DeleteContext *ctx, dict_index_t *index, trx_id_t trxid, undo_no_t undo_no, ulint rec_type, const upd_field_t *uf, purge_node_t *node)
 Purge an LOB (either of compressed or uncompressed). More...
 
dberr_t lob::update (InsertContext &ctx, trx_t *trx, dict_index_t *index, const upd_t *upd, ulint field_no, ref_t blobref)
 Update a portion of the given LOB. More...
 
dberr_t lob::z_update (InsertContext &ctx, trx_t *trx, dict_index_t *index, const upd_t *upd, ulint field_no, ref_t blobref)
 Update a portion of the given LOB. More...
 
void lob::print (trx_t *trx, dict_index_t *index, std::ostream &out, ref_t ref, bool fatal)
 Print information about the given LOB. More...
 
void lob::z_import (const dict_index_t *index, byte *field_ref, trx_id_t trx_id)
 Import the given LOB. More...
 
void lob::import (const dict_index_t *index, byte *field_ref, trx_id_t trx_id)
 Import the given LOB. More...
 
bool lob::rec_check_lobref_space_id (dict_index_t *index, const rec_t *rec, const ulint *offsets)
 Check if all the LOB references in the given clustered index record has valid space_id in it. More...
 
dberr_t lob::mark_not_partially_updatable (trx_t *trx, dict_index_t *index, const upd_t *update, const mtr_t *btr_mtr)
 Mark an LOB that it is not partially updatable anymore. More...
 

Variables

const ulint lob::MAX_SIZE = UINT32_MAX
 The maximum size possible for an LOB. More...
 
constexpr uint32_t lob::KB128 = 128 * 1024
 The compressed LOB is stored as a collection of zlib streams. More...
 
constexpr uint32_t lob::Z_CHUNK_SIZE = KB128
 
const ulint lob::BTR_EXTERN_SPACE_ID = 0
 The reference in a field for which data is stored on a different page. More...
 
const ulint lob::BTR_EXTERN_PAGE_NO = 4
 page number where stored More...
 
const ulint lob::BTR_EXTERN_OFFSET = 8
 offset of BLOB header on that page More...
 
const ulint lob::BTR_EXTERN_VERSION = BTR_EXTERN_OFFSET
 Version number of LOB (LOB in new format) More...
 
const ulint lob::BTR_EXTERN_LEN = 12
 8 bytes containing the length of the externally stored part of the LOB. More...
 
const ulint lob::BTR_EXTERN_OWNER_FLAG = 128UL
 The most significant bit of BTR_EXTERN_LEN (i.e., the most significant bit of the byte at smallest address) is set to 1 if this field does not 'own' the externally stored field; only the owner field is allowed to free the field in purge! More...
 
const ulint lob::BTR_EXTERN_INHERITED_FLAG = 64UL
 If the second most significant bit of BTR_EXTERN_LEN (i.e., the second most significant bit of the byte at smallest address) is 1 then it means that the externally stored field was inherited from an earlier version of the row. More...
 
const ulint lob::BTR_EXTERN_BEING_MODIFIED_FLAG = 32UL
 If the 3rd most significant bit of BTR_EXTERN_LEN is 1, then it means that the externally stored field is currently being modified. More...
 
const ulint lob::LOB_HDR_PART_LEN = 0
 The structure of uncompressed LOB page header. More...
 
const ulint lob::LOB_HDR_NEXT_PAGE_NO = 4
 Offset within header of next BLOB part page no. More...
 
const ulint lob::LOB_HDR_SIZE = 8
 Size of an uncompressed LOB page header, in bytes. More...
 
const uint lob::ZLOB_PAGE_DATA = FIL_PAGE_DATA
 Start of the data on an LOB page. More...
 
const byte lob::field_ref_almost_zero [FIELD_REF_SIZE]
 A BLOB field reference has all the bits set to zero, except the "being modified" bit. More...
 

Detailed Description

Implements the large objects (LOB) module.

InnoDB supports large objects (LOB). Previously, the LOB was called as externally stored fields. A large object contains a singly linked list of database pages, aka LOB pages. A reference to the first LOB page is stored along with the clustered index record. This reference is called the LOB reference (lob::ref_t). A single clustered index record can have many LOB references. Secondary indexes cannot have LOB references.

There are two types of LOB - compressed and uncompressed.

The main operations implemented for LOB are - INSERT, DELETE and FETCH. To carry out these main operations the following classes are provided.

Inserter - for inserting uncompressed LOB data. zInserter - for inserting compressed LOB data. BaseInserter - a base class containing common state and functions useful for both Inserter and zInserter. Inserter and zInserter derives from this base class. Reader - for reading uncompressed LOB data. zReader - for reading compressed LOB data. Deleter - for deleting both compressed and uncompressed LOB data.

For each main operation, the context information is identified separately. They are as follows:

InsertContext - context information for doing insert of LOB. DeleteContext - context information for doing delete of LOB. ReadContext - context information for doing fetch of LOB. `

Typedef Documentation

◆ BlockCache

typedef std::map<page_no_t, buf_block_t *> BlockCache