MySQL  8.0.22
Source Code Documentation
lob::ref_t Struct Reference

The struct 'lob::ref_t' represents an external field reference. More...

#include <lob0lob.h>

Public Member Functions

 ref_t (byte *ptr)
 Constructor. More...
 
bool use_single_z_stream () const
 For compressed LOB, if the length is less than or equal to Z_CHUNK_SIZE then use the older single z stream format to store the LOB. More...
 
bool is_big (const page_size_t &page_size) const
 Check if this LOB is big enough to do partial update. More...
 
void parse (ref_mem_t &obj) const
 Parse the LOB reference object and copy data into the given ref_mem_t object. More...
 
void copy (byte *field_ref) const
 Copy the LOB reference into the given memory location. More...
 
bool is_equal (const byte *ptr) const
 Check whether the stored external field reference is equal to the given field reference. More...
 
void set_ref (byte *ptr)
 Set the external field reference to the given memory location. More...
 
void set_null (mtr_t *mtr)
 Set the external field reference to null. More...
 
bool is_null_relaxed () const
 Check if the field reference is made of zeroes except the being_modified bit. More...
 
bool is_null () const
 Check if the field reference is made of zeroes. More...
 
void set_owner (bool owner, mtr_t *mtr)
 Set the ownership flag in the blob reference. More...
 
void set_being_modified (bool modifying, mtr_t *mtr)
 Set the being_modified flag in the field reference. More...
 
bool is_being_modified () const
 Check if the current blob is being modified. More...
 
void set_inherited (bool inherited, mtr_t *mtr)
 Set the inherited flag in the field reference. More...
 
bool is_owner () const
 Check if the current row is the owner of the blob. More...
 
bool is_inherited () const
 Check if the current row inherited the blob from parent row. More...
 
space_id_t space_id () const
 Read the space id from the blob reference. More...
 
page_no_t page_no () const
 Read the page number from the blob reference. More...
 
ulint offset () const
 Read the offset of blob header from the blob reference. More...
 
uint32_t version () const
 Read the LOB version from the blob reference. More...
 
ulint length () const
 Read the length from the blob reference. More...
 
void update (space_id_t space_id, ulint page_no, ulint offset, mtr_t *mtr)
 Update the information stored in the external field reference. More...
 
void set_space_id (const space_id_t space_id, mtr_t *mtr)
 Set the space_id in the external field reference. More...
 
void set_page_no (const ulint page_no, mtr_t *mtr)
 Set the page number in the external field reference. More...
 
void set_offset (const ulint offset, mtr_t *mtr)
 Set the offset information in the external field reference. More...
 
void set_length (const ulint len, mtr_t *mtr)
 Set the length of blob in the external field reference. More...
 
page_tpage_align () const
 Get the start of a page containing this blob reference. More...
 
bool validate (mtr_t *mtr)
 Check if the given mtr has necessary latches to update this LOB reference. More...
 
bool check_space_id (dict_index_t *index) const
 Check if the space_id in the LOB reference is equal to the space_id of the index to which it belongs. More...
 
bool is_lob_partially_updatable (const dict_index_t *index) const
 Check if the LOB can be partially updated. More...
 
void mark_not_partially_updatable (trx_t *trx, mtr_t *mtr, dict_index_t *index, const page_size_t &page_size)
 Load the first page of the LOB and mark it as not partially updatable anymore. More...
 
ulint get_lob_page_info (const dict_index_t *index, const page_size_t &page_size, bool &is_partially_updatable) const
 Load the first page of LOB and read its page type. More...
 
std::ostream & print (std::ostream &out) const
 Print this LOB reference into the given output stream. More...
 

Static Public Member Functions

static bool use_single_z_stream (ulint len)
 For compressed LOB, if the length is less than or equal to Z_CHUNK_SIZE then use the older single z stream format to store the LOB. More...
 
static bool is_big (const page_size_t &page_size, const ulint lob_length)
 Check if this LOB is big enough to do partial update. More...
 
static bool is_null_relaxed (const byte *ref)
 Check if the LOB reference is null (all zeroes) except the "is being modified" bit. More...
 
static bool is_null (const byte *ref)
 Check if the LOB reference is null (all zeroes). More...
 
static void set_being_modified (byte *ref, bool modifying, mtr_t *mtr)
 Set the being_modified flag in the field reference. More...
 
static bool is_being_modified (const byte *field_ref)
 Check if the current blob is being modified. More...
 
static space_id_t space_id (const byte *ref)
 Read the space id from the given blob reference. More...
 
static page_no_t page_no (const byte *ref)
 Read the page no from the blob reference. More...
 

Static Public Attributes

static const ulint LOB_SMALL_CHANGE_THRESHOLD = 100
 If the total number of bytes modified in an LOB, in an update operation, is less than or equal to this threshold LOB_SMALL_CHANGE_THRESHOLD, then it is considered as a small change. More...
 
static const uint SIZE = BTR_EXTERN_FIELD_REF_SIZE
 The size of an LOB reference object (in bytes) More...
 

Private Attributes

bytem_ref
 Pointing to a memory of size BTR_EXTERN_FIELD_REF_SIZE. More...
 

Static Private Attributes

static const ulint LOB_BIG_THRESHOLD_SIZE = 2
 If the LOB size is equal to or above this limit (in physical page size terms), then the LOB is big enough to be partially updated. More...
 

Detailed Description

The struct 'lob::ref_t' represents an external field reference.

The reference in a field for which data is stored on a different page. The reference is at the end of the 'locally' stored part of the field. 'Locally' means storage in the index record. We store locally a long enough prefix of each column so that we can determine the ordering parts of each index record without looking into the externally stored part.

Constructor & Destructor Documentation

◆ ref_t()

lob::ref_t::ref_t ( byte ptr)
inlineexplicit

Constructor.

Parameters
[in]ptrPointer to the external field reference.

Member Function Documentation

◆ check_space_id()

bool lob::ref_t::check_space_id ( dict_index_t index) const

Check if the space_id in the LOB reference is equal to the space_id of the index to which it belongs.

Parameters
[in]indexthe index to which LOB belongs.
Returns
true if space is valid in LOB reference, false otherwise.

◆ copy()

void lob::ref_t::copy ( byte field_ref) const
inline

Copy the LOB reference into the given memory location.

Parameters
[out]field_refwrite LOB reference in this location.

◆ get_lob_page_info()

ulint lob::ref_t::get_lob_page_info ( const dict_index_t index,
const page_size_t page_size,
bool is_partially_updatable 
) const

Load the first page of LOB and read its page type.

Parameters
[in]indexthe index object.
[in]page_sizethe page size of LOB.
[out]is_partially_updatableis the LOB partially updatable.
Returns
the page type of first page of LOB.

◆ is_being_modified() [1/2]

static bool lob::ref_t::is_being_modified ( const byte field_ref)
inlinestatic

Check if the current blob is being modified.

Parameters
[in]field_refblob field reference
Returns
true if it is being modified, false otherwise.

◆ is_being_modified() [2/2]

bool lob::ref_t::is_being_modified ( ) const
inline

Check if the current blob is being modified.

Returns
true if it is being modified, false otherwise.

◆ is_big() [1/2]

static bool lob::ref_t::is_big ( const page_size_t page_size,
const ulint  lob_length 
)
inlinestatic

Check if this LOB is big enough to do partial update.

Parameters
[in]page_sizethe page size
[in]lob_lengththe size of BLOB in bytes.
Returns
true if LOB is big enough, false otherwise.

◆ is_big() [2/2]

bool lob::ref_t::is_big ( const page_size_t page_size) const
inline

Check if this LOB is big enough to do partial update.

Parameters
[in]page_sizethe page size
Returns
true if LOB is big enough, false otherwise.

◆ is_equal()

bool lob::ref_t::is_equal ( const byte ptr) const
inline

Check whether the stored external field reference is equal to the given field reference.

Parameters
[in]ptrsupplied external field reference.

◆ is_inherited()

bool lob::ref_t::is_inherited ( ) const
inline

Check if the current row inherited the blob from parent row.

Returns
true if inherited, false otherwise.

◆ is_lob_partially_updatable()

bool lob::ref_t::is_lob_partially_updatable ( const dict_index_t index) const

Check if the LOB can be partially updated.

This is done by loading the first page of LOB and looking at the flags.

Parameters
[in]indexthe index to which LOB belongs.
Returns
true if LOB is partially updatable, false otherwise.

◆ is_null() [1/2]

bool lob::ref_t::is_null ( ) const
inline

Check if the field reference is made of zeroes.

Returns
true if field reference is made of zeroes, false otherwise.

◆ is_null() [2/2]

static bool lob::ref_t::is_null ( const byte ref)
inlinestatic

Check if the LOB reference is null (all zeroes).

Parameters
[in]refthe LOB reference.
Returns
true if the LOB reference is null (all zeros), false otherwise.

◆ is_null_relaxed() [1/2]

bool lob::ref_t::is_null_relaxed ( ) const
inline

Check if the field reference is made of zeroes except the being_modified bit.

Returns
true if field reference is made of zeroes, false otherwise.

◆ is_null_relaxed() [2/2]

static bool lob::ref_t::is_null_relaxed ( const byte ref)
inlinestatic

Check if the LOB reference is null (all zeroes) except the "is being modified" bit.

Parameters
[in]refthe LOB reference.
Returns
true if the LOB reference is null (all zeros) except the "is being modified" bit, false otherwise.

◆ is_owner()

bool lob::ref_t::is_owner ( ) const
inline

Check if the current row is the owner of the blob.

Returns
true if owner, false otherwise.

◆ length()

ulint lob::ref_t::length ( ) const
inline

Read the length from the blob reference.

Returns
length of the blob

◆ mark_not_partially_updatable()

void lob::ref_t::mark_not_partially_updatable ( trx_t trx,
mtr_t mtr,
dict_index_t index,
const page_size_t page_size 
)

Load the first page of the LOB and mark it as not partially updatable anymore.

Parameters
[in]trxCurrent transaction
[in]mtrMini-transaction context.
[in]indexIndex dictionary object.
[in]page_sizePage size information.

◆ offset()

ulint lob::ref_t::offset ( ) const
inline

Read the offset of blob header from the blob reference.

Returns
the offset of the blob header

◆ page_align()

page_t* lob::ref_t::page_align ( ) const
inline

Get the start of a page containing this blob reference.

Returns
start of the page

◆ page_no() [1/2]

static page_no_t lob::ref_t::page_no ( const byte ref)
inlinestatic

Read the page no from the blob reference.

Returns
the page no

◆ page_no() [2/2]

page_no_t lob::ref_t::page_no ( ) const
inline

Read the page number from the blob reference.

Returns
the page number

◆ parse()

void lob::ref_t::parse ( ref_mem_t obj) const
inline

Parse the LOB reference object and copy data into the given ref_mem_t object.

Parameters
[out]objLOB reference memory object.

◆ print()

std::ostream & lob::ref_t::print ( std::ostream &  out) const

Print this LOB reference into the given output stream.

Parameters
[in]outthe output stream.
Returns
the output stream.

◆ set_being_modified() [1/2]

static void lob::ref_t::set_being_modified ( byte ref,
bool  modifying,
mtr_t mtr 
)
inlinestatic

Set the being_modified flag in the field reference.

Parameters
[in,out]refThe LOB reference
[in]modifyingtrue, if blob is being modified.
[in]mtrMini-transaction context.

◆ set_being_modified() [2/2]

void lob::ref_t::set_being_modified ( bool  modifying,
mtr_t mtr 
)
inline

Set the being_modified flag in the field reference.

Parameters
[in]modifyingtrue, if blob is being modified.
[in]mtrMini-transaction context.

◆ set_inherited()

void lob::ref_t::set_inherited ( bool  inherited,
mtr_t mtr 
)
inline

Set the inherited flag in the field reference.

Parameters
[in]inheritedtrue, if inherited.
[in]mtrMini-transaction context.

◆ set_length()

void lob::ref_t::set_length ( const ulint  len,
mtr_t mtr 
)
inline

Set the length of blob in the external field reference.

Parameters
[in]lenthe blob length .
[in]mtrmini-trx or NULL.

◆ set_null()

void lob::ref_t::set_null ( mtr_t mtr)
inline

Set the external field reference to null.

Parameters
[in,out]mtrMini-transaction.

◆ set_offset()

void lob::ref_t::set_offset ( const ulint  offset,
mtr_t mtr 
)
inline

Set the offset information in the external field reference.

Parameters
[in]offsetthe offset.
[in]mtrmini-trx or NULL.

◆ set_owner()

void lob::ref_t::set_owner ( bool  owner,
mtr_t mtr 
)
inline

Set the ownership flag in the blob reference.

Parameters
[in]ownerWhether to own or disown. If owner, unset the owner flag.
[in]mtrMini-transaction or NULL.

◆ set_page_no()

void lob::ref_t::set_page_no ( const ulint  page_no,
mtr_t mtr 
)
inline

Set the page number in the external field reference.

Parameters
[in]page_nothe page number.
[in]mtrmini-trx or NULL.

◆ set_ref()

void lob::ref_t::set_ref ( byte ptr)
inline

Set the external field reference to the given memory location.

Parameters
[in]ptrthe new external field reference.

◆ set_space_id()

void lob::ref_t::set_space_id ( const space_id_t  space_id,
mtr_t mtr 
)
inline

Set the space_id in the external field reference.

Parameters
[in]space_idthe space identifier.
[in]mtrmini-trx or NULL.

◆ space_id() [1/2]

static space_id_t lob::ref_t::space_id ( const byte ref)
inlinestatic

Read the space id from the given blob reference.

Parameters
[in]refthe blob reference.
Returns
the space id

◆ space_id() [2/2]

space_id_t lob::ref_t::space_id ( ) const
inline

Read the space id from the blob reference.

Returns
the space id

◆ update()

void lob::ref_t::update ( space_id_t  space_id,
ulint  page_no,
ulint  offset,
mtr_t mtr 
)
inline

Update the information stored in the external field reference.

Parameters
[in]space_idthe space identifier.
[in]page_nothe page number.
[in]offsetthe offset within the page_no
[in]mtrthe mini trx or NULL.

◆ use_single_z_stream() [1/2]

bool lob::ref_t::use_single_z_stream ( ) const
inline

For compressed LOB, if the length is less than or equal to Z_CHUNK_SIZE then use the older single z stream format to store the LOB.

◆ use_single_z_stream() [2/2]

static bool lob::ref_t::use_single_z_stream ( ulint  len)
inlinestatic

For compressed LOB, if the length is less than or equal to Z_CHUNK_SIZE then use the older single z stream format to store the LOB.

◆ validate()

bool lob::ref_t::validate ( mtr_t mtr)
inline

Check if the given mtr has necessary latches to update this LOB reference.

Parameters
[in]mtrMini-transaction that needs to be checked.
Returns
true if valid, false otherwise.

◆ version()

uint32_t lob::ref_t::version ( ) const
inline

Read the LOB version from the blob reference.

Returns
the LOB version number.

Member Data Documentation

◆ LOB_BIG_THRESHOLD_SIZE

const ulint lob::ref_t::LOB_BIG_THRESHOLD_SIZE = 2
staticprivate

If the LOB size is equal to or above this limit (in physical page size terms), then the LOB is big enough to be partially updated.

Only in this case LOB index needs to be built.

◆ LOB_SMALL_CHANGE_THRESHOLD

const ulint lob::ref_t::LOB_SMALL_CHANGE_THRESHOLD = 100
static

If the total number of bytes modified in an LOB, in an update operation, is less than or equal to this threshold LOB_SMALL_CHANGE_THRESHOLD, then it is considered as a small change.

For small changes to LOB, the changes are undo logged like any other update operation.

◆ m_ref

byte* lob::ref_t::m_ref
private

Pointing to a memory of size BTR_EXTERN_FIELD_REF_SIZE.

◆ SIZE

const uint lob::ref_t::SIZE = BTR_EXTERN_FIELD_REF_SIZE
static

The size of an LOB reference object (in bytes)


The documentation for this struct was generated from the following files: