mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
e8e9fb28b4
of clustered indexes. Previously, parts of the code assumed that these columns would exist on all leaf pages. Simplify the update-in-place of these columns. Add inline function dict_index_is_clust() to replace all tests index->type & DICT_CLUSTERED. Remove the redo log entry types MLOG_ZIP_WRITE_TRX_ID and MLOG_ZIP_WRITE_ROLL_PTR, because the modifications to these columns are covered by logical logging. Fuse page_zip_write_trx_id() and page_zip_write_roll_ptr() into page_zip_write_trx_id_and_roll_ptr(). page_zip_dir_add_slot(), page_zip_available(): Add flag "is_clustered", so that no space will be reserved for TRX_ID and ROLL_PTR on leaf pages of secondary indexes. page_zip_apply_log(): Flag an error when val==0 is encoded with two bytes. page_zip_write_rec(): Add debug assertions that there is enough space available for the entry before copying the data bytes of the record.
102 lines
2.5 KiB
Text
102 lines
2.5 KiB
Text
/******************************************************
|
|
General row routines
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
Created 4/20/1996 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#include "dict0dict.h"
|
|
#include "rem0rec.h"
|
|
#include "trx0undo.h"
|
|
|
|
/*************************************************************************
|
|
Reads the trx id field from a clustered index record. */
|
|
UNIV_INLINE
|
|
dulint
|
|
row_get_rec_trx_id(
|
|
/*===============*/
|
|
/* out: value of the field */
|
|
rec_t* rec, /* in: record */
|
|
dict_index_t* index, /* in: clustered index */
|
|
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
|
|
{
|
|
ulint offset;
|
|
|
|
ut_ad(dict_index_is_clust(index));
|
|
ut_ad(rec_offs_validate(rec, index, offsets));
|
|
|
|
offset = index->trx_id_offset;
|
|
|
|
if (!offset) {
|
|
offset = row_get_trx_id_offset(rec, index, offsets);
|
|
}
|
|
|
|
return(trx_read_trx_id(rec + offset));
|
|
}
|
|
|
|
/*************************************************************************
|
|
Reads the roll pointer field from a clustered index record. */
|
|
UNIV_INLINE
|
|
dulint
|
|
row_get_rec_roll_ptr(
|
|
/*=================*/
|
|
/* out: value of the field */
|
|
rec_t* rec, /* in: record */
|
|
dict_index_t* index, /* in: clustered index */
|
|
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
|
|
{
|
|
ulint offset;
|
|
|
|
ut_ad(dict_index_is_clust(index));
|
|
ut_ad(rec_offs_validate(rec, index, offsets));
|
|
|
|
offset = index->trx_id_offset;
|
|
|
|
if (!offset) {
|
|
offset = row_get_trx_id_offset(rec, index, offsets);
|
|
}
|
|
|
|
return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
|
|
}
|
|
|
|
/***********************************************************************
|
|
Builds from a secondary index record a row reference with which we can
|
|
search the clustered index record. */
|
|
UNIV_INLINE
|
|
void
|
|
row_build_row_ref_fast(
|
|
/*===================*/
|
|
dtuple_t* ref, /* in: typed data tuple where the
|
|
reference is built */
|
|
const ulint* map, /* in: array of field numbers in rec
|
|
telling how ref should be built from
|
|
the fields of rec */
|
|
rec_t* rec, /* in: record in the index; must be
|
|
preserved while ref is used, as we do
|
|
not copy field values to heap */
|
|
const ulint* offsets)/* in: array returned by rec_get_offsets() */
|
|
{
|
|
dfield_t* dfield;
|
|
byte* field;
|
|
ulint len;
|
|
ulint ref_len;
|
|
ulint field_no;
|
|
ulint i;
|
|
|
|
ut_ad(rec_offs_validate(rec, NULL, offsets));
|
|
ref_len = dtuple_get_n_fields(ref);
|
|
|
|
for (i = 0; i < ref_len; i++) {
|
|
dfield = dtuple_get_nth_field(ref, i);
|
|
|
|
field_no = *(map + i);
|
|
|
|
if (field_no != ULINT_UNDEFINED) {
|
|
|
|
field = rec_get_nth_field(rec, offsets,
|
|
field_no, &len);
|
|
dfield_set_data(dfield, field, len);
|
|
}
|
|
}
|
|
}
|