MySQL 9.1.0
Source Code Documentation
|
Provides the large objects (LOB) module. More...
Namespaces | |
namespace | bulk |
Classes | |
struct | BaseInserter |
This struct can hold BLOB routines/functions, and state variables, that are common for compressed and uncompressed BLOB. More... | |
struct | basic_page_t |
struct | Being_modified |
This is used to take action when we enter and exit a scope. More... | |
struct | blob_dir_t |
The in-memory blob directory. More... | |
struct | blob_page_info_t |
Information about data stored in one BLOB page. More... | |
class | BtrContext |
The B-tree context under which the LOB operation is done. More... | |
struct | data_page_t |
The LOB data page carrying the user data. More... | |
struct | DeleteContext |
The context information when the delete operation on LOB is taking place. More... | |
class | Deleter |
struct | first_page_t |
The first page of an uncompressed LOB. More... | |
struct | frag_node_t |
The fragment node represents one fragment. More... | |
struct | index_entry_mem_t |
An in-memory copy of an index_entry_t data. More... | |
struct | index_entry_t |
An index entry pointing to an LOB page. More... | |
struct | InsertContext |
The context for a LOB operation. More... | |
class | Inserter |
Insert or write an uncompressed BLOB. More... | |
struct | node_page_t |
The node page (also can be called as the index page) contains a list of index_entry_t objects. More... | |
struct | plist_base_node_t |
The base node of page list. More... | |
class | plist_node_t |
The node of page list. More... | |
struct | ReadContext |
The context information for reading a single BLOB. More... | |
struct | Reader |
Fetch uncompressed BLOB. More... | |
struct | ref_mem_t |
In memory representation of the LOB reference. More... | |
struct | ref_t |
The struct 'lob::ref_t' represents an external field reference. More... | |
struct | undo_data_t |
Undo information about LOB data alone without including LOB index. More... | |
struct | undo_seq_t |
Container to hold a sequence of undo log records containing modification of BLOBs. More... | |
struct | undo_vers_t |
The list of modifications to be applied on LOBs to get older versions. More... | |
struct | z_data_page_t |
The data page holding the zlob. More... | |
struct | z_first_page_t |
The first page of an zlob. More... | |
struct | z_frag_entry_t |
An entry representing one fragment page. More... | |
struct | z_frag_node_page_t |
A frag nodes page containing an array of z_frag_entry_t objects. More... | |
struct | z_frag_page_t |
The fragment page. More... | |
struct | z_index_entry_mem_t |
In-memory copy of the information from z_index_entry_t. More... | |
struct | z_index_entry_t |
An index entry pointing to one zlib stream. More... | |
struct | z_index_page_t |
An index page containing an array of z_index_entry_t objects. More... | |
class | zInserter |
Insert or write the compressed BLOB as a single zlib stream. More... | |
struct | zReader |
Fetch compressed BLOB. More... | |
Typedefs | |
using | paddr_t = ulint |
using | frag_id_t = ulint |
typedef std::map< page_no_t, buf_block_t * > | BlockCache |
using | List_iem_t = std::list< index_entry_mem_t > |
List of index entry memory (iem) objects. More... | |
Enumerations | |
enum | opcode { OPCODE_INSERT = 0 , OPCODE_INSERT_UPDATE , OPCODE_UPDATE , OPCODE_INSERT_BULK , OPCODE_UNKNOWN } |
LOB operation code for btr_store_big_rec_extern_fields(). More... | |
Functions | |
std::ostream & | operator<< (std::ostream &out, const plist_node_t &obj) |
std::ostream & | operator<< (std::ostream &out, const plist_base_node_t &obj) |
std::ostream & | operator<< (std::ostream &out, const z_frag_entry_t &obj) |
dberr_t | z_print_info (const dict_index_t *index, const lob::ref_t &ref, std::ostream &out) |
Print information about the given compressed lob. More... | |
std::ostream & | operator<< (std::ostream &out, const frag_node_t &obj) |
dberr_t | z_insert_chunk (dict_index_t *index, z_first_page_t &first, trx_t *trx, byte *blob, ulint len, z_index_entry_t *out_entry, mtr_t *mtr, bool bulk) |
Insert one chunk of input. More... | |
std::ostream & | operator<< (std::ostream &out, const index_entry_mem_t &obj) |
Overloading the global output operator to print the index_entry_mem_t object. More... | |
std::ostream & | operator<< (std::ostream &out, const index_entry_t &obj) |
Overloading the global output operator to easily print an index entry. More... | |
dberr_t | insert (InsertContext *ctx, trx_t *trx, ref_t &ref, big_rec_field_t *field, ulint field_j) |
Insert a large object (LOB) into the system. More... | |
dberr_t | z_insert (InsertContext *ctx, trx_t *trx, ref_t &ref, big_rec_field_t *field, ulint field_j) |
Insert a compressed large object (LOB) into the system. More... | |
ulint | read (ReadContext *ctx, ref_t ref, ulint offset, ulint len, byte *buf) |
Fetch a large object (LOB) from the system. More... | |
ulint | z_read (lob::ReadContext *ctx, lob::ref_t ref, ulint offset, ulint len, byte *buf) |
Fetch a compressed large object (ZLOB) from the system. More... | |
void | print (trx_t *trx, dict_index_t *index, std::ostream &out, ref_t ref, bool fatal) |
Print information about the given LOB. More... | |
dberr_t | update (trx_t *trx, dict_index_t *index, const upd_t *upd, ulint field_no) |
Update a portion of the given LOB. More... | |
dberr_t | z_update (trx_t *trx, dict_index_t *index, const upd_t *upd, ulint field_no) |
Update a portion of the given LOB. More... | |
dberr_t | get_affected_index_entries (const ref_t &ref, dict_index_t *index, const Binary_diff &bdiff, List_iem_t &entries, mtr_t *mtr) |
Get the list of index entries affected by the given partial update vector. More... | |
dberr_t | apply_undolog (mtr_t *mtr, dict_index_t *index, ref_t ref, const upd_field_t *uf) |
Apply the undo log on the LOB. More... | |
dberr_t | get_info (ref_t &ref, dict_index_t *index, ulint &lob_version, trx_id_t &last_trx_id, undo_no_t &last_undo_no, page_type_t &page_type, mtr_t *mtr) |
Get information about the given LOB. More... | |
bool | validate_size (const ulint lob_size, dict_index_t *index, fil_addr_t node_loc, mtr_t *mtr) |
Validate the size of the given LOB. More... | |
std::ostream & | 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 | 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... | |
byte * | 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 byte * | 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 | 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 byte * | 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 byte * | 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 | 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 & | operator<< (std::ostream &out, const blob_page_info_t &obj) |
std::ostream & | 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 | btr_lob_op_is_update (opcode op) |
Determine if an operation on off-page columns is an update. More... | |
ulint | 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... | |
byte * | 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 | 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 byte * | 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 | 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 | 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 | 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 | 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 | z_import (const dict_index_t *index, byte *field_ref, trx_id_t trx_id) |
Import the given LOB. More... | |
void | import (const dict_index_t *index, byte *field_ref, trx_id_t trx_id) |
Import the given LOB. More... | |
bool | 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 | 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... | |
std::ostream & | operator<< (std::ostream &out, const undo_data_t &obj) |
buf_block_t * | alloc_lob_page (dict_index_t *index, mtr_t *lob_mtr, page_no_t hint, bool bulk) |
Allocate one LOB page. More... | |
bool | entry_visible_to (dict_index_t *index, trx_t *trx, trx_id_t entry_trx_id) |
Check if the index entry is visible to the given transaction. More... | |
std::ostream & | operator<< (std::ostream &out, const z_first_page_t &obj) |
Overloading the global output parameter to print object of type z_first_page_t into the given output stream. More... | |
std::ostream & | operator<< (std::ostream &out, const z_index_entry_mem_t &obj) |
std::ostream & | operator<< (std::ostream &out, const z_index_entry_t &obj) |
ulint | z_read_chunk (dict_index_t *index, z_index_entry_t &entry, ulint offset, ulint &len, byte *&buf, mtr_t *mtr) |
Read one data chunk associated with one index entry. More... | |
ulint | z_read_strm (dict_index_t *index, z_index_entry_t &entry, byte *zbuf, ulint zbuf_size, mtr_t *mtr) |
Read one zlib stream fully, given its index entry. More... | |
ulint | z_read (ReadContext *ctx, trx_t *trx, lob::ref_t ref, ulint offset, ulint len, byte *buf) |
Fetch a compressed large object (ZLOB) from the system. More... | |
bool | z_validate_strm (dict_index_t *index, z_index_entry_t &entry, mtr_t *mtr) |
Validate one zlib stream, given its index entry. More... | |
static page_no_t | btr_blob_get_next_page_no (const byte *blob_header) |
Returns the page number where the next BLOB part is stored. More... | |
static void | buf_block_set_next_page_no (buf_block_t *block, page_no_t next_page_no, mtr_t *mtr) |
dberr_t | z_insert_strm (dict_index_t *index, z_first_page_t &first, trx_id_t trxid, byte *blob, ulint len, mtr_t *mtr, bool bulk, page_no_t &start_page_no, frag_id_t &frag_id) |
Insert a single zlib stream. More... | |
static page_no_t | btr_blob_get_next_page_no (const byte *blob_header) |
Returns the page number where the next BLOB part is stored. More... | |
static void | btr_check_blob_fil_page_type (space_id_t space_id, page_no_t page_no, const page_t *page, bool read) |
Check the FIL_PAGE_TYPE on an uncompressed BLOB page. More... | |
static ulint | btr_blob_get_part_len (const byte *blob_header) |
Returns the length of a BLOB part stored on the header page. More... | |
static void | rollback_from_undolog (DeleteContext *ctx, dict_index_t *index, const upd_field_t *uf) |
Rollback from undo log information. More... | |
static void | rollback (DeleteContext *ctx, dict_index_t *index, trx_id_t trxid, undo_no_t undo_no, ulint rec_type, const upd_field_t *uf) |
Rollback modification of a uncompressed LOB. More... | |
static void | z_rollback (DeleteContext *ctx, dict_index_t *index, trx_id_t trxid, undo_no_t undo_no, ulint rec_type) |
Rollback modification of a compressed LOB. More... | |
static void | z_purge (DeleteContext *ctx, dict_index_t *index, trx_id_t trxid, undo_no_t undo_no, ulint rec_type, purge_node_t *purge_node) |
Purge a compressed LOB. More... | |
dberr_t | replace (InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, first_page_t &first_page, ulint offset, ulint len, byte *buf, int count) |
Replace a large object (LOB) with the given new data of equal length. More... | |
static dberr_t | replace_inline (InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, first_page_t &first_page, ulint offset, ulint len, byte *buf) |
Replace a small portion of large object (LOB) with the given new data of equal length. More... | |
static void | print_partial_update_hit (upd_field_t *uf, dict_index_t *index) |
Print an information message in the server log file, informing that the LOB partial update feature code is hit. More... | |
fil_addr_t | find_offset (dict_index_t *index, fil_addr_t node_loc, ulint &offset, mtr_t *mtr) |
Find the file location of the index entry which gives the portion of LOB containing the requested offset. More... | |
static bool | z_validate_strm_low (dict_index_t *index, z_index_entry_t &entry, mtr_t *mtr) |
static dberr_t | z_replace (InsertContext &ctx, trx_t *trx, dict_index_t *index, ref_t ref, z_first_page_t &first_page, ulint offset, ulint len, byte *buf) |
Replace a large object (LOB) with the given new data. More... | |
static void | z_print_partial_update_hit (upd_field_t *uf, dict_index_t *index) |
Print an information message in the server log file, informing that the ZLOB partial update feature code is hit. More... | |
fil_addr_t | z_find_offset (dict_index_t *index, fil_addr_t node_loc, ulint &offset, mtr_t *mtr) |
Find the location of the given offset within LOB. More... | |
Variables | |
const ulint | FRAG_ID_NULL = std::numeric_limits<uint16_t>::max() |
const ulint | KB16 = 16 * 1024 |
const ulint | MAX_SIZE = UINT32_MAX |
The maximum size possible for an LOB. More... | |
constexpr uint32_t | KB128 = 128 * 1024 |
The compressed LOB is stored as a collection of zlib streams. More... | |
constexpr uint32_t | Z_CHUNK_SIZE = KB128 |
const ulint | BTR_EXTERN_SPACE_ID = 0 |
The reference in a field for which data is stored on a different page. More... | |
const ulint | BTR_EXTERN_PAGE_NO = 4 |
page number where stored More... | |
const ulint | BTR_EXTERN_OFFSET = 8 |
offset of BLOB header on that page More... | |
const ulint | BTR_EXTERN_VERSION = BTR_EXTERN_OFFSET |
Version number of LOB (LOB in new format) More... | |
const ulint | BTR_EXTERN_LEN = 12 |
8 bytes containing the length of the externally stored part of the LOB. More... | |
const ulint | 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 | 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 | 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_HDR_PART_LEN = 0 |
The structure of uncompressed LOB page header. More... | |
const ulint | LOB_HDR_NEXT_PAGE_NO = 4 |
Offset within header of next BLOB part page no. More... | |
const ulint | LOB_HDR_SIZE = 8 |
Size of an uncompressed LOB page header, in bytes. More... | |
const uint | ZLOB_PAGE_DATA = FIL_PAGE_DATA |
Start of the data on an LOB page. More... | |
const byte | field_ref_almost_zero [FIELD_REF_SIZE] |
A BLOB field reference has all the bits set to zero, except the "being
modified" bit. More... | |
const uint32_t | MAX_PARTIAL_UPDATE_LIMIT = 1000 |
Number of times an LOB can be partially updated. More... | |
Provides the large objects (LOB) module.
Previously, the LOB was called as externally stored fields.
typedef std::map<page_no_t, buf_block_t *> lob::BlockCache |
using lob::frag_id_t = typedef ulint |
using lob::List_iem_t = typedef std::list<index_entry_mem_t> |
List of index entry memory (iem) objects.
using lob::paddr_t = typedef ulint |
enum lob::opcode |
LOB operation code for btr_store_big_rec_extern_fields().
buf_block_t * lob::alloc_lob_page | ( | dict_index_t * | index, |
mtr_t * | lob_mtr, | ||
page_no_t | hint, | ||
bool | bulk | ||
) |
Allocate one LOB page.
[in] | index | Index in which LOB exists. |
[in] | lob_mtr | Mini-transaction context. |
[in] | hint | Hint page number for allocation. |
[in] | bulk | true if operation is OPCODE_INSERT_BULK, false otherwise. |
dberr_t lob::apply_undolog | ( | mtr_t * | mtr, |
dict_index_t * | index, | ||
ref_t | ref, | ||
const upd_field_t * | uf | ||
) |
Apply the undo log on the LOB.
[in] | mtr | Mini-transaction context. |
[in] | index | Clustered index to which LOB belongs. |
[in] | ref | LOB reference object. |
[in] | uf | Update vector for LOB field. |
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.
[in] | index | Index |
[in] | block | Buffer block |
[in] | all | true=remove also the compressed page if there is one |
[in] | mtr | Mini-transaction to commit |
Returns the page number where the next BLOB part is stored.
[in] | blob_header | the BLOB header. |
Returns the page number where the next BLOB part is stored.
[in] | blob_header | the BLOB header. |
Returns the length of a BLOB part stored on the header page.
[in] | blob_header | the BLOB header. |
|
static |
Check the FIL_PAGE_TYPE on an uncompressed BLOB page.
[in] | space_id | space identifier. |
[in] | page_no | page number. |
[in] | page | the page |
[in] | read | true=read, false=purge |
|
inlinestatic |
byte * lob::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.
The clustered index record must be protected by a lock or a page latch.
[in] | trx | the current trx object or nullptr |
[in] | index | the clust index in which lob is read. |
[out] | len | length of the whole field |
[out] | lob_version | LOB version number. |
[in] | data | 'internally' stored part of the field containing also the reference to the external part; must be protected by a lock or a page latch. |
[in] | page_size | BLOB page size |
[in] | local_len | length of data |
[in] | is_sdi | true for SDI Indexes |
[in,out] | heap | mem heap |
|
inlinestatic |
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.
The clustered index record must be protected by a lock or a page latch.
[in] | trx | the current transaction object if available or nullptr. |
[in] | index | the clust index in which lob is read. |
[out] | buf | the field, or a prefix of it |
[in] | len | length of buf, in bytes |
[in] | page_size | BLOB page size |
[in] | data | 'internally' stored part of the field containing also the reference to the external part; must be protected by a lock or a page latch. |
[in] | is_sdi | true for SDI indexes |
[in] | local_len | length of data, in bytes |
|
inline |
Determine if an operation on off-page columns is an update.
[in] | op | type of BLOB operation. |
|
inlinestatic |
byte * lob::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.
[in] | trx | the current transaction. |
[in] | index | the clustered index |
[in] | rec | record in a clustered index; must be protected by a lock or a page latch |
[in] | offsets | array returned by rec_get_offsets() |
[in] | page_size | BLOB page size |
[in] | no | field number |
[out] | len | length of the field |
[out] | lob_version | version of lob that has been copied |
[in] | is_sdi | true for SDI Indexes |
[in,out] | heap | mem heap |
[in] | is_rebuilt | true if rebuilt |
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.
[in] | index | index |
[in] | rec | record |
[in] | offsets | array returned by rec_get_offsets() |
|
inlinestatic |
Gets a pointer to the externally stored part of a field.
index | record descriptor |
rec | record |
offsets | rec_get_offsets(rec) |
n | index of the externally stored field |
|
inlinestatic |
Gets a pointer to the externally stored part of a field.
[in] | index | index |
rec | record | |
offsets | rec_get_offsets(rec) | |
n | index of the externally stored field |
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.
[in] | index | Index |
[in] | offsets | array returned by rec_get_offsets() |
[in] | n | index of the external field |
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.
The extern flags in rec will have to be set beforehand. The fields are stored on pages allocated from leaf node file segment of the index tree.
TODO: If the allocation extends the tablespace, it will not be redo logged, in any mini-transaction. Tablespace extension should be redo-logged, so that recovery will not fail when the big_rec was written to the extended portion of the file, in case the file was somehow truncated in the crash.
[in] | trx | the trx doing LOB store. If unavailable it could be nullptr. |
[in,out] | pcur | a persistent cursor. if btr_mtr is restarted, then this can be repositioned. |
[in] | upd | update vector |
[in,out] | offsets | rec_get_offsets() on pcur. the "external in offsets will correctly correspond storage" flagsin offsets will correctly correspond to rec when this function returns |
[in] | big_rec_vec | vector containing fields to be stored externally |
[in,out] | btr_mtr | mtr containing the latches to the clustered index. can be committed and restarted. |
[in] | op | operation code |
|
static |
bool lob::entry_visible_to | ( | dict_index_t * | index, |
trx_t * | trx, | ||
trx_id_t | entry_trx_id | ||
) |
Check if the index entry is visible to the given transaction.
[in] | index | the index to which LOB belongs. |
[in] | trx | the transaction reading the index entry. |
[in] | entry_trx_id | the trx id in the index entry. |
fil_addr_t lob::find_offset | ( | dict_index_t * | index, |
fil_addr_t | node_loc, | ||
ulint & | offset, | ||
mtr_t * | mtr | ||
) |
Find the file location of the index entry which gives the portion of LOB containing the requested offset.
[in] | index | The clustered index containing LOB. |
[in] | node_loc | Location of first index entry. |
[in] | offset | The LOB offset whose location we seek. |
[in] | mtr | Mini-transaction context. |
dberr_t lob::get_affected_index_entries | ( | const ref_t & | ref, |
dict_index_t * | index, | ||
const Binary_diff & | bdiff, | ||
List_iem_t & | entries, | ||
mtr_t * | mtr | ||
) |
Get the list of index entries affected by the given partial update vector.
[in] | ref | LOB reference object. |
[in] | index | Clustered index to which LOB belongs. |
[in] | bdiff | Single partial update vector |
[out] | entries | Affected LOB index entries. |
[in] | mtr | Mini-transaction |
dberr_t lob::get_info | ( | ref_t & | ref, |
dict_index_t * | index, | ||
ulint & | lob_version, | ||
trx_id_t & | last_trx_id, | ||
undo_no_t & | last_undo_no, | ||
page_type_t & | page_type, | ||
mtr_t * | mtr | ||
) |
Get information about the given LOB.
[in] | ref | LOB reference. |
[in] | index | Clustered index to which LOB belongs. |
[out] | lob_version | LOB version number. |
[out] | last_trx_id | trx_id that modified the lob last. |
[out] | last_undo_no | Trx undo no that modified the lob last. |
[out] | page_type | the Page type of first lob page. |
[in] | mtr | Mini-transaction context. |
void lob::import | ( | const dict_index_t * | index, |
byte * | field_ref, | ||
trx_id_t | trx_id | ||
) |
Import the given LOB.
Update the creator trx id and the modifier trx id to the given import trx id.
[in] | index | clustered index containing the lob. |
[in] | field_ref | the lob reference. |
[in] | trx_id | the import trx id. |
dberr_t lob::insert | ( | InsertContext * | ctx, |
trx_t * | trx, | ||
ref_t & | ref, | ||
big_rec_field_t * | field, | ||
ulint | field_j | ||
) |
Insert a large object (LOB) into the system.
[in] | ctx | the B-tree context for this LOB operation. |
[in] | trx | transaction doing the insertion. |
[in,out] | ref | the LOB reference. |
[in] | field | the LOB field. |
[in] | field_j | the LOB field index in big rec vector. |
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.
[in] | trx | Current transaction. |
[in] | index | Clustered index to which the LOB belongs. |
[in] | update | Update vector. |
[in] | btr_mtr | Mini-transaction context holding latches on the B-tree. This function does not generate redo log using this btr_mtr. It only obtains the log mode. |
|
inline |
Overloading the global output operator to print the blob_dir_t object into an output stream.
[in,out] | out | the output stream. |
[in] | obj | the object to be printed. |
|
inline |
|
inline |
|
inline |
Overloading the global output operator to print the index_entry_mem_t object.
[in,out] | out | the output stream. |
[in] | obj | an object of type index_entry_mem_t |
|
inline |
Overloading the global output operator to easily print an index entry.
[in] | out | the output stream. |
[in] | obj | the index entry. |
|
inline |
|
inline |
|
inline |
Overload the global output stream operator to easily print the lob::ref_t object into the output stream.
[in,out] | out | the output stream. |
[in] | obj | the lob::ref_t object to be printed |
|
inline |
|
inline |
Overloading the global output parameter to print object of type z_first_page_t into the given output stream.
[in,out] | out | output stream. |
[in] | obj | object to be printed. |
|
inline |
|
inline |
|
inline |
void lob::print | ( | trx_t * | trx, |
dict_index_t * | index, | ||
std::ostream & | out, | ||
ref_t | ref, | ||
bool | fatal | ||
) |
Print information about the given LOB.
[in] | trx | the current transaction. |
[in] | index | the clust index that contains the LOB. |
[in] | out | the output stream into which LOB info is printed. |
[in] | ref | the LOB reference |
[in] | fatal | if true assert at end of function. |
|
static |
Print an information message in the server log file, informing that the LOB partial update feature code is hit.
[in] | uf | the update field information |
[in] | index | index where partial update happens. |
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).
[in] | ctx | the delete operation context information. |
[in] | index | clustered index in which LOB is present |
[in] | trxid | the transaction that is being purged. |
[in] | undo_no | during rollback to savepoint, purge only up to this undo number. |
[in] | rec_type | undo record type. |
[in] | uf | the update vector for the field. |
[in] | node | the purge node or nullptr. |
Fetch a large object (LOB) from the system.
[in] | ctx | the read context information. |
[in] | ref | the LOB reference identifying the LOB. |
[in] | offset | read the LOB from the given offset. |
[in] | len | the length of LOB data that needs to be fetched. |
[out] | buf | the output buffer (owned by caller) of minimum len bytes. |
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.
[in] | index | the index to which the LOB belongs. |
[in] | rec | the clust_rec in which the LOB references are checked. |
[in] | offsets | the field offsets of the given rec. |
dberr_t lob::replace | ( | InsertContext & | ctx, |
trx_t * | trx, | ||
dict_index_t * | index, | ||
ref_t | ref, | ||
first_page_t & | first_page, | ||
ulint | offset, | ||
ulint | len, | ||
byte * | buf, | ||
int | count | ||
) |
Replace a large object (LOB) with the given new data of equal length.
[in] | ctx | replace operation context. |
[in] | trx | the transaction that is doing the read. |
[in] | index | the clustered index containing the LOB. |
[in] | ref | the LOB reference identifying the LOB. |
[in] | first_page | the first page of the LOB. |
[in] | offset | replace the LOB from the given offset. |
[in] | len | the length of LOB data that needs to be replaced. |
[in] | buf | the buffer (owned by caller) with new data (len bytes). |
[in] | count | number of replace done on current LOB. |
Repeatedly updating the LOB should increment the ref count only once.
Repeatedly updating the LOB should increment the ref count only once.
|
static |
Replace a small portion of large object (LOB) with the given new data of equal length.
[in] | ctx | replace operation context. |
[in] | trx | the transaction that is doing the read. |
[in] | index | the clustered index containing the LOB. |
[in] | ref | the LOB reference identifying the LOB. |
[in] | first_page | the first page of the LOB. |
[in] | offset | replace the LOB from the given offset. |
[in] | len | the length of LOB data that needs to be replaced. |
[in] | buf | the buffer (owned by caller) with new data (len bytes). |
|
static |
Rollback modification of a uncompressed LOB.
[in] | ctx | the delete operation context information. |
[in] | index | clustered index in which LOB is present |
[in] | trxid | the transaction that is being rolled back. |
[in] | undo_no | during rollback to savepoint, rollback only up to this undo number. |
[in] | rec_type | undo record type. |
[in] | uf | update vector of the concerned field. |
|
static |
Rollback from undo log information.
[in] | ctx | the delete operation context. |
[in] | index | the clustered index to which LOB belongs. |
[in] | uf | the update vector of concerned field. |
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.
[in] | ctx | update operation context information. |
[in] | trx | the transaction that is doing the modification. |
[in] | index | the clustered index containing the LOB. |
[in] | upd | update vector |
[in] | field_no | the LOB field number |
[in] | blobref | LOB reference stored in clust record. |
dberr_t lob::update | ( | trx_t * | trx, |
dict_index_t * | index, | ||
const upd_t * | upd, | ||
ulint | field_no | ||
) |
Update a portion of the given LOB.
[in] | trx | the transaction that is doing the modification. |
[in] | index | the clustered index containing the LOB. |
[in] | upd | update vector |
[in] | field_no | the LOB field number |
bool lob::validate_size | ( | const ulint | lob_size, |
dict_index_t * | index, | ||
fil_addr_t | node_loc, | ||
mtr_t * | mtr | ||
) |
Validate the size of the given LOB.
[in] | lob_size | Expected size of the LOB, mostly obtained from the LOB reference. |
[in] | index | Clustered index containing the LOB. |
[in] | node_loc | Location of the first LOB index entry. |
[in] | mtr | Mini-transaction context. |
fil_addr_t lob::z_find_offset | ( | dict_index_t * | index, |
fil_addr_t | node_loc, | ||
ulint & | offset, | ||
mtr_t * | mtr | ||
) |
Find the location of the given offset within LOB.
[in] | index | The index where LOB is located. |
[in] | node_loc | The location of first page. |
[in,out] | offset | The requested offset. |
[in] | mtr | Mini-transaction context. |
void lob::z_import | ( | const dict_index_t * | index, |
byte * | field_ref, | ||
trx_id_t | trx_id | ||
) |
Import the given LOB.
Update the creator trx id and the modifier trx id to the given import trx id.
[in] | index | clustered index containing the lob. |
[in] | field_ref | the lob reference. |
[in] | trx_id | the import trx id. |
dberr_t lob::z_insert | ( | InsertContext * | ctx, |
trx_t * | trx, | ||
ref_t & | ref, | ||
big_rec_field_t * | field, | ||
ulint | field_j | ||
) |
Insert a compressed large object (LOB) into the system.
[in] | ctx | the B-tree context for this LOB operation. |
[in] | trx | transaction doing the insertion. |
[in,out] | ref | the LOB reference. |
[in] | field | the LOB field. |
[in] | field_j | the LOB field index in big rec vector. |
dberr_t lob::z_insert_chunk | ( | dict_index_t * | index, |
z_first_page_t & | first, | ||
trx_t * | trx, | ||
byte * | blob, | ||
ulint | len, | ||
z_index_entry_t * | out_entry, | ||
mtr_t * | mtr, | ||
bool | bulk | ||
) |
Insert one chunk of input.
The maximum size of a chunk is Z_CHUNK_SIZE.
[in] | index | Clustered index in which LOB is inserted. |
[in] | first | First page of the LOB. |
[in] | trx | Transaction doing the insertion. |
[in] | blob | Uncompressed LOB to be inserted. |
[in] | len | Length of the blob. |
[out] | out_entry | Newly inserted index entry. can be NULL. |
[in] | mtr | Mini-transaction |
[in] | bulk | true if it is bulk operation, false otherwise. |
dberr_t lob::z_insert_strm | ( | dict_index_t * | index, |
z_first_page_t & | first, | ||
trx_id_t | trxid, | ||
byte * | blob, | ||
ulint | len, | ||
mtr_t * | mtr, | ||
bool | bulk, | ||
page_no_t & | start_page_no, | ||
frag_id_t & | frag_id | ||
) |
Insert a single zlib stream.
[in] | index | the index to which the LOB belongs. |
[in] | first | the first page of the compressed LOB. |
[in] | trxid | the id of the current transaction. |
[in] | blob | in memory copy of the LOB. |
[in] | len | the length of the LOB. |
[in] | mtr | the mini-transaction context. |
[in] | bulk | true if bulk operation, false otherwise. |
[out] | start_page_no | the first page into which zlib stream was written. |
[out] | frag_id | the fragment id that contains last part of the zlib stream. |
dberr_t lob::z_print_info | ( | const dict_index_t * | index, |
const lob::ref_t & | ref, | ||
std::ostream & | out | ||
) |
Print information about the given compressed lob.
[in] | index | the index dictionary object. |
[in] | ref | the LOB reference |
[out] | out | the output stream where information is printed. |
|
static |
Print an information message in the server log file, informing that the ZLOB partial update feature code is hit.
[in] | uf | the update field information |
[in] | index | index where partial update happens. |
|
static |
Purge a compressed LOB.
[in] | ctx | The delete operation context information. |
[in] | index | Clustered index in which LOB is present |
[in] | trxid | The transaction that is being purged. |
[in] | undo_no | During rollback to savepoint, purge only up to this undo number. |
[in] | rec_type | Undo record type. |
[in,out] | purge_node | if nullptr, free the complete LOB. Otherwise, save the first page of LOB in this purge node. |
ulint lob::z_read | ( | lob::ReadContext * | ctx, |
lob::ref_t | ref, | ||
ulint | offset, | ||
ulint | len, | ||
byte * | buf | ||
) |
Fetch a compressed large object (ZLOB) from the system.
[in] | ctx | the read context information. |
[in] | ref | the LOB reference identifying the LOB. |
[in] | offset | read the LOB from the given offset. |
[in] | len | the length of LOB data that needs to be fetched. |
[out] | buf | the output buffer (owned by caller) of minimum len bytes. |
ulint lob::z_read | ( | ReadContext * | ctx, |
trx_t * | trx, | ||
lob::ref_t | ref, | ||
ulint | offset, | ||
ulint | len, | ||
byte * | buf | ||
) |
Fetch a compressed large object (ZLOB) from the system.
[in] | ctx | the read context information. |
[in] | trx | the transaction that is doing the read. |
[in] | ref | the LOB reference identifying the LOB. |
[in] | offset | read the LOB from the given offset. |
[in] | len | the length of LOB data that needs to be fetched. |
[out] | buf | the output buffer (owned by caller) of minimum len bytes. |
ulint lob::z_read_chunk | ( | dict_index_t * | index, |
z_index_entry_t & | entry, | ||
ulint | offset, | ||
ulint & | len, | ||
byte *& | buf, | ||
mtr_t * | mtr | ||
) |
Read one data chunk associated with one index entry.
[in] | index | The clustered index containing the LOB. |
[in] | entry | Pointer to the index entry |
[in] | offset | The offset from which to read the chunk. |
[in,out] | len | The length of the output buffer. This length can be greater than the chunk size. |
[in,out] | buf | The output buffer. |
[in] | mtr | Mini-transaction context. |
ulint lob::z_read_strm | ( | dict_index_t * | index, |
z_index_entry_t & | entry, | ||
byte * | zbuf, | ||
ulint | zbuf_size, | ||
mtr_t * | mtr | ||
) |
Read one zlib stream fully, given its index entry.
[in] | index | The index dictionary object. |
[in] | entry | The index entry (memory copy). |
[in,out] | zbuf | The output buffer |
[in] | zbuf_size | The size of the output buffer. |
[in,out] | mtr | Mini-transaction. |
|
static |
Replace a large object (LOB) with the given new data.
[in] | ctx | replace operation context. |
[in] | trx | the transaction that is doing the read. |
[in] | index | the clust index that contains the LOB. |
[in] | ref | the LOB reference identifying the LOB. |
[in] | first_page | the first page of the LOB. |
[in] | offset | replace the LOB from the given offset. |
[in] | len | the length of LOB data that needs to be replaced. |
[in] | buf | the buffer (owned by caller) with new data (len bytes). |
|
static |
Rollback modification of a compressed LOB.
[in] | ctx | the delete operation context information. |
[in] | index | clustered index in which LOB is present |
[in] | trxid | the transaction that is being rolled back. |
[in] | undo_no | during rollback to savepoint, rollback only up to this undo number. |
[in] | rec_type | undo record type. |
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.
[in] | ctx | update operation context information. |
[in] | trx | the transaction that is doing the modification. |
[in] | index | the clustered index containing the LOB. |
[in] | upd | update vector |
[in] | field_no | the LOB field number |
[in] | blobref | LOB reference stored in clust record. |
dberr_t lob::z_update | ( | trx_t * | trx, |
dict_index_t * | index, | ||
const upd_t * | upd, | ||
ulint | field_no | ||
) |
Update a portion of the given LOB.
[in] | trx | the transaction that is doing the modification. |
[in] | index | the clustered index containing the LOB. |
[in] | upd | update vector |
[in] | field_no | the LOB field number |
bool lob::z_validate_strm | ( | dict_index_t * | index, |
z_index_entry_t & | entry, | ||
mtr_t * | mtr | ||
) |
Validate one zlib stream, given its index entry.
[in] | index | The index dictionary object. |
[in] | entry | The index entry (memory copy). |
[in] | mtr | Mini-transaction. |
|
static |
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.
This is mainly used by the READ UNCOMMITTED transaction to avoid returning inconsistent blob data.
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.
In rollback we are not allowed to free an inherited external field.
const ulint lob::BTR_EXTERN_LEN = 12 |
8 bytes containing the length of the externally stored part of the LOB.
The 2 highest bits are reserved to the flags below.
const ulint lob::BTR_EXTERN_OFFSET = 8 |
offset of BLOB header on that page
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!
const ulint lob::BTR_EXTERN_PAGE_NO = 4 |
page number where stored
const ulint lob::BTR_EXTERN_SPACE_ID = 0 |
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. Space identifier where stored.
const ulint lob::BTR_EXTERN_VERSION = BTR_EXTERN_OFFSET |
Version number of LOB (LOB in new format)
const byte lob::field_ref_almost_zero |
A BLOB field reference has all the bits set to zero, except the "being modified" bit.
const ulint lob::FRAG_ID_NULL = std::numeric_limits<uint16_t>::max() |
|
constexpr |
The compressed LOB is stored as a collection of zlib streams.
The uncompressed LOB is divided into chunks of size Z_CHUNK_SIZE and each of these chunks are compressed individually and stored as compressed LOB. data.
const ulint lob::KB16 = 16 * 1024 |
const ulint lob::LOB_HDR_NEXT_PAGE_NO = 4 |
Offset within header of next BLOB part page no.
FIL_NULL if none
const ulint lob::LOB_HDR_PART_LEN = 0 |
The structure of uncompressed LOB page header.
Offset within header of LOB length on this page.
const ulint lob::LOB_HDR_SIZE = 8 |
Size of an uncompressed LOB page header, in bytes.
const uint32_t lob::MAX_PARTIAL_UPDATE_LIMIT = 1000 |
Number of times an LOB can be partially updated.
Once this limit is reached, then the LOB will be fully updated.
const ulint lob::MAX_SIZE = UINT32_MAX |
The maximum size possible for an LOB.
|
constexpr |
const uint lob::ZLOB_PAGE_DATA = FIL_PAGE_DATA |
Start of the data on an LOB page.