diff options
author | unknown <knielsen@knielsen-hq.org> | 2009-11-13 22:26:08 +0100 |
---|---|---|
committer | unknown <knielsen@knielsen-hq.org> | 2009-11-13 22:26:08 +0100 |
commit | 898f6f48b79d1f2c334fb559225b2b0fade5ea93 (patch) | |
tree | 84df8eecd942b650f172cbd67050ee8984c0d52b /storage/xtradb/rem/rem0rec.c | |
parent | 275c0a7f96502b33f763fb9388dcc1c289e4792b (diff) | |
parent | 2bde0c5e6d31583e5197e3b513f572a693161f62 (diff) | |
download | mariadb-git-898f6f48b79d1f2c334fb559225b2b0fade5ea93.tar.gz |
Merge XtraDB 8 into MariaDB.
Diffstat (limited to 'storage/xtradb/rem/rem0rec.c')
-rw-r--r-- | storage/xtradb/rem/rem0rec.c | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c index d6899c810e3..1c8b3fd8c1e 100644 --- a/storage/xtradb/rem/rem0rec.c +++ b/storage/xtradb/rem/rem0rec.c @@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/************************************************************************ +/********************************************************************//** +@file rem/rem0rec.c Record manager Created 5/30/1994 Heikki Tuuri @@ -143,26 +144,26 @@ the corresponding canonical strings have the same property. */ /* this is used to fool compiler in rec_validate */ UNIV_INTERN ulint rec_dummy; -/******************************************************************* -Validates the consistency of an old-style physical record. */ +/***************************************************************//** +Validates the consistency of an old-style physical record. +@return TRUE if ok */ static ibool rec_validate_old( /*=============*/ - /* out: TRUE if ok */ - const rec_t* rec); /* in: physical record */ + const rec_t* rec); /*!< in: physical record */ -/********************************************************** +/******************************************************//** Determine how many of the first n columns in a compact -physical record are stored externally. */ +physical record are stored externally. +@return number of externally stored columns */ UNIV_INTERN ulint rec_get_n_extern_new( /*=================*/ - /* out: number of externally stored columns */ - const rec_t* rec, /* in: compact physical record */ - dict_index_t* index, /* in: record descriptor */ - ulint n) /* in: number of columns to scan */ + const rec_t* rec, /*!< in: compact physical record */ + dict_index_t* index, /*!< in: record descriptor */ + ulint n) /*!< in: number of columns to scan */ { const byte* nulls; const byte* lens; @@ -227,7 +228,7 @@ rec_get_n_extern_new( return(n_extern); } -/********************************************************** +/******************************************************//** Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. This is a special case of rec_init_offsets() and rec_get_offsets_func(). */ @@ -235,14 +236,14 @@ UNIV_INTERN void rec_init_offsets_comp_ordinary( /*===========================*/ - const rec_t* rec, /* in: physical record in + const rec_t* rec, /*!< in: physical record in ROW_FORMAT=COMPACT */ - ulint extra, /* in: number of bytes to reserve + ulint extra, /*!< in: number of bytes to reserve between the record header and the data payload (usually REC_N_NEW_EXTRA_BYTES) */ - const dict_index_t* index, /* in: record descriptor */ - ulint* offsets)/* in/out: array of offsets; + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in/out: array of offsets; in: n=rec_offs_n_fields(offsets) */ { ulint i = 0; @@ -329,7 +330,7 @@ resolved: = (rec - (lens + 1)) | REC_OFFS_COMPACT | any_ext; } -/********************************************************** +/******************************************************//** The following function determines the offsets to each field in the record. The offsets are written to a previously allocated array of ulint, where rec_offs_n_fields(offsets) has been initialized to the @@ -347,9 +348,9 @@ static void rec_init_offsets( /*=============*/ - const rec_t* rec, /* in: physical record */ - const dict_index_t* index, /* in: record descriptor */ - ulint* offsets)/* in/out: array of offsets; + const rec_t* rec, /*!< in: physical record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in/out: array of offsets; in: n=rec_offs_n_fields(offsets) */ { ulint i = 0; @@ -491,26 +492,26 @@ resolved: } } -/********************************************************** +/******************************************************//** The following function determines the offsets to each field -in the record. It can reuse a previously returned array. */ +in the record. It can reuse a previously returned array. +@return the new offsets */ UNIV_INTERN ulint* rec_get_offsets_func( /*=================*/ - /* out: the new offsets */ - const rec_t* rec, /* in: physical record */ - const dict_index_t* index, /* in: record descriptor */ - ulint* offsets,/* in/out: array consisting of + const rec_t* rec, /*!< in: physical record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets,/*!< in/out: array consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL */ - ulint n_fields,/* in: maximum number of + ulint n_fields,/*!< in: maximum number of initialized fields (ULINT_UNDEFINED if all fields) */ - mem_heap_t** heap, /* in/out: memory heap */ - const char* file, /* in: file name where called */ - ulint line) /* in: line number where called */ + mem_heap_t** heap, /*!< in/out: memory heap */ + const char* file, /*!< in: file name where called */ + ulint line) /*!< in: line number where called */ { ulint n; ulint size; @@ -563,21 +564,21 @@ rec_get_offsets_func( return(offsets); } -/********************************************************** +/******************************************************//** The following function determines the offsets to each field in the record. It can reuse a previously allocated array. */ UNIV_INTERN void rec_get_offsets_reverse( /*====================*/ - const byte* extra, /* in: the extra bytes of a + const byte* extra, /*!< in: the extra bytes of a compact record in reverse order, excluding the fixed-size REC_N_NEW_EXTRA_BYTES */ - const dict_index_t* index, /* in: record descriptor */ - ulint node_ptr,/* in: nonzero=node pointer, + const dict_index_t* index, /*!< in: record descriptor */ + ulint node_ptr,/*!< in: nonzero=node pointer, 0=leaf node */ - ulint* offsets)/* in/out: array consisting of + ulint* offsets)/*!< in/out: array consisting of offsets[0] allocated elements */ { ulint n; @@ -678,17 +679,17 @@ resolved: | REC_OFFS_COMPACT | any_ext; } -/**************************************************************** +/************************************************************//** The following function is used to get the offset to the nth -data field in an old-style record. */ +data field in an old-style record. +@return offset to the field */ UNIV_INTERN ulint rec_get_nth_field_offs_old( /*=======================*/ - /* out: offset to the field */ - const rec_t* rec, /* in: record */ - ulint n, /* in: index of the field */ - ulint* len) /* out: length of the field; + const rec_t* rec, /*!< in: record */ + ulint n, /*!< in: index of the field */ + ulint* len) /*!< out: length of the field; UNIV_SQL_NULL if SQL null */ { ulint os; @@ -742,20 +743,20 @@ rec_get_nth_field_offs_old( return(os); } -/************************************************************** -Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. */ +/**********************************************************//** +Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. +@return total size */ UNIV_INTERN ulint rec_get_converted_size_comp_prefix( /*===============================*/ - /* out: total size */ - const dict_index_t* index, /* in: record descriptor; + const dict_index_t* index, /*!< in: record descriptor; dict_table_is_comp() is assumed to hold, even if it does not */ - const dfield_t* fields, /* in: array of data fields */ - ulint n_fields,/* in: number of data fields */ - ulint* extra) /* out: extra size */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ { ulint extra_size; ulint data_size; @@ -817,21 +818,21 @@ rec_get_converted_size_comp_prefix( return(extra_size + data_size); } -/************************************************************** -Determines the size of a data tuple in ROW_FORMAT=COMPACT. */ +/**********************************************************//** +Determines the size of a data tuple in ROW_FORMAT=COMPACT. +@return total size */ UNIV_INTERN ulint rec_get_converted_size_comp( /*========================*/ - /* out: total size */ - const dict_index_t* index, /* in: record descriptor; + const dict_index_t* index, /*!< in: record descriptor; dict_table_is_comp() is assumed to hold, even if it does not */ - ulint status, /* in: status bits of the record */ - const dfield_t* fields, /* in: array of data fields */ - ulint n_fields,/* in: number of data fields */ - ulint* extra) /* out: extra size */ + ulint status, /*!< in: status bits of the record */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields,/*!< in: number of data fields */ + ulint* extra) /*!< out: extra size */ { ulint size; ut_ad(index); @@ -865,15 +866,15 @@ rec_get_converted_size_comp( n_fields, extra)); } -/*************************************************************** +/***********************************************************//** Sets the value of the ith field SQL null bit of an old-style record. */ UNIV_INTERN void rec_set_nth_field_null_bit( /*=======================*/ - rec_t* rec, /* in: record */ - ulint i, /* in: ith field */ - ibool val) /* in: value to set */ + rec_t* rec, /*!< in: record */ + ulint i, /*!< in: ith field */ + ibool val) /*!< in: value to set */ { ulint info; @@ -903,15 +904,15 @@ rec_set_nth_field_null_bit( rec_2_set_field_end_info(rec, i, info); } -/*************************************************************** +/***********************************************************//** Sets an old-style record field to SQL null. The physical size of the field is not changed. */ UNIV_INTERN void rec_set_nth_field_sql_null( /*=======================*/ - rec_t* rec, /* in: record */ - ulint n) /* in: index of the field */ + rec_t* rec, /*!< in: record */ + ulint n) /*!< in: index of the field */ { ulint offset; @@ -922,18 +923,17 @@ rec_set_nth_field_sql_null( rec_set_nth_field_null_bit(rec, n, TRUE); } -/************************************************************* +/*********************************************************//** Builds an old-style physical record out of a data tuple and -stores it beginning from the start of the given buffer. */ +stores it beginning from the start of the given buffer. +@return pointer to the origin of physical record */ static rec_t* rec_convert_dtuple_to_rec_old( /*==========================*/ - /* out: pointer to the origin of - physical record */ - byte* buf, /* in: start address of the physical record */ - const dtuple_t* dtuple, /* in: data tuple */ - ulint n_ext) /* in: number of externally stored columns */ + byte* buf, /*!< in: start address of the physical record */ + const dtuple_t* dtuple, /*!< in: data tuple */ + ulint n_ext) /*!< in: number of externally stored columns */ { const dfield_t* field; ulint n_fields; @@ -949,7 +949,7 @@ rec_convert_dtuple_to_rec_old( ut_ad(dtuple_check_typed(dtuple)); n_fields = dtuple_get_n_fields(dtuple); - data_size = dtuple_get_data_size(dtuple); + data_size = dtuple_get_data_size(dtuple, 0); ut_ad(n_fields > 0); @@ -982,7 +982,7 @@ rec_convert_dtuple_to_rec_old( if (dfield_is_null(field)) { len = dtype_get_sql_null_size( - dfield_get_type(field)); + dfield_get_type(field), 0); data_write_sql_null(rec + end_offset, len); end_offset += len; @@ -1010,7 +1010,7 @@ rec_convert_dtuple_to_rec_old( if (dfield_is_null(field)) { len = dtype_get_sql_null_size( - dfield_get_type(field)); + dfield_get_type(field), 0); data_write_sql_null(rec + end_offset, len); end_offset += len; @@ -1038,21 +1038,21 @@ rec_convert_dtuple_to_rec_old( return(rec); } -/************************************************************* +/*********************************************************//** Builds a ROW_FORMAT=COMPACT record out of a data tuple. */ UNIV_INTERN void rec_convert_dtuple_to_rec_comp( /*===========================*/ - rec_t* rec, /* in: origin of record */ - ulint extra, /* in: number of bytes to + rec_t* rec, /*!< in: origin of record */ + ulint extra, /*!< in: number of bytes to reserve between the record header and the data payload (normally REC_N_NEW_EXTRA_BYTES) */ - const dict_index_t* index, /* in: record descriptor */ - ulint status, /* in: status bits of the record */ - const dfield_t* fields, /* in: array of data fields */ - ulint n_fields)/* in: number of data fields */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint status, /*!< in: status bits of the record */ + const dfield_t* fields, /*!< in: array of data fields */ + ulint n_fields)/*!< in: number of data fields */ { const dfield_t* field; const dtype_t* type; @@ -1160,19 +1160,18 @@ rec_convert_dtuple_to_rec_comp( } } -/************************************************************* +/*********************************************************//** Builds a new-style physical record out of a data tuple and -stores it beginning from the start of the given buffer. */ +stores it beginning from the start of the given buffer. +@return pointer to the origin of physical record */ static rec_t* rec_convert_dtuple_to_rec_new( /*==========================*/ - /* out: pointer to the origin - of physical record */ - byte* buf, /* in: start address of + byte* buf, /*!< in: start address of the physical record */ - const dict_index_t* index, /* in: record descriptor */ - const dtuple_t* dtuple) /* in: data tuple */ + const dict_index_t* index, /*!< in: record descriptor */ + const dtuple_t* dtuple) /*!< in: data tuple */ { ulint extra_size; ulint status; @@ -1194,20 +1193,19 @@ rec_convert_dtuple_to_rec_new( return(rec); } -/************************************************************* +/*********************************************************//** Builds a physical record out of a data tuple and -stores it beginning from the start of the given buffer. */ +stores it beginning from the start of the given buffer. +@return pointer to the origin of physical record */ UNIV_INTERN rec_t* rec_convert_dtuple_to_rec( /*======================*/ - /* out: pointer to the origin - of physical record */ - byte* buf, /* in: start address of the + byte* buf, /*!< in: start address of the physical record */ - const dict_index_t* index, /* in: record descriptor */ - const dtuple_t* dtuple, /* in: data tuple */ - ulint n_ext) /* in: number of + const dict_index_t* index, /*!< in: record descriptor */ + const dtuple_t* dtuple, /*!< in: data tuple */ + ulint n_ext) /*!< in: number of externally stored columns */ { rec_t* rec; @@ -1240,19 +1238,19 @@ rec_convert_dtuple_to_rec( return(rec); } -/****************************************************************** +/**************************************************************//** Copies the first n fields of a physical record to a data tuple. The fields are copied to the memory heap. */ UNIV_INTERN void rec_copy_prefix_to_dtuple( /*======================*/ - dtuple_t* tuple, /* out: data tuple */ - const rec_t* rec, /* in: physical record */ - const dict_index_t* index, /* in: record descriptor */ - ulint n_fields, /* in: number of fields + dtuple_t* tuple, /*!< out: data tuple */ + const rec_t* rec, /*!< in: physical record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint n_fields, /*!< in: number of fields to copy */ - mem_heap_t* heap) /* in: memory heap */ + mem_heap_t* heap) /*!< in: memory heap */ { ulint i; ulint offsets_[REC_OFFS_NORMAL_SIZE]; @@ -1285,20 +1283,20 @@ rec_copy_prefix_to_dtuple( } } -/****************************************************************** +/**************************************************************//** Copies the first n fields of an old-style physical record -to a new physical record in a buffer. */ +to a new physical record in a buffer. +@return own: copied record */ static rec_t* rec_copy_prefix_to_buf_old( /*=======================*/ - /* out, own: copied record */ - const rec_t* rec, /* in: physical record */ - ulint n_fields, /* in: number of fields to copy */ - ulint area_end, /* in: end of the prefix data */ - byte** buf, /* in/out: memory buffer for + const rec_t* rec, /*!< in: physical record */ + ulint n_fields, /*!< in: number of fields to copy */ + ulint area_end, /*!< in: end of the prefix data */ + byte** buf, /*!< in/out: memory buffer for the copied prefix, or NULL */ - ulint* buf_size) /* in/out: buffer size */ + ulint* buf_size) /*!< in/out: buffer size */ { rec_t* copy_rec; ulint area_start; @@ -1329,22 +1327,22 @@ rec_copy_prefix_to_buf_old( return(copy_rec); } -/****************************************************************** +/**************************************************************//** Copies the first n fields of a physical record to a new physical record in -a buffer. */ +a buffer. +@return own: copied record */ UNIV_INTERN rec_t* rec_copy_prefix_to_buf( /*===================*/ - /* out, own: copied record */ - const rec_t* rec, /* in: physical record */ - const dict_index_t* index, /* in: record descriptor */ - ulint n_fields, /* in: number of fields + const rec_t* rec, /*!< in: physical record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint n_fields, /*!< in: number of fields to copy */ - byte** buf, /* in/out: memory buffer + byte** buf, /*!< in/out: memory buffer for the copied prefix, or NULL */ - ulint* buf_size) /* in/out: buffer size */ + ulint* buf_size) /*!< in/out: buffer size */ { const byte* nulls; const byte* lens; @@ -1444,14 +1442,14 @@ rec_copy_prefix_to_buf( return(*buf + (rec - (lens + 1))); } -/******************************************************************* -Validates the consistency of an old-style physical record. */ +/***************************************************************//** +Validates the consistency of an old-style physical record. +@return TRUE if ok */ static ibool rec_validate_old( /*=============*/ - /* out: TRUE if ok */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { const byte* data; ulint len; @@ -1504,15 +1502,15 @@ rec_validate_old( return(TRUE); } -/******************************************************************* -Validates the consistency of a physical record. */ +/***************************************************************//** +Validates the consistency of a physical record. +@return TRUE if ok */ UNIV_INTERN ibool rec_validate( /*=========*/ - /* out: TRUE if ok */ - const rec_t* rec, /* in: physical record */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const rec_t* rec, /*!< in: physical record */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { const byte* data; ulint len; @@ -1571,14 +1569,14 @@ rec_validate( return(TRUE); } -/******************************************************************* +/***************************************************************//** Prints an old-style physical record. */ UNIV_INTERN void rec_print_old( /*==========*/ - FILE* file, /* in: file where to print */ - const rec_t* rec) /* in: physical record */ + FILE* file, /*!< in: file where to print */ + const rec_t* rec) /*!< in: physical record */ { const byte* data; ulint len; @@ -1623,16 +1621,17 @@ rec_print_old( rec_validate_old(rec); } -/******************************************************************* +#ifndef UNIV_HOTBACKUP +/***************************************************************//** Prints a physical record in ROW_FORMAT=COMPACT. Ignores the record header. */ UNIV_INTERN void rec_print_comp( /*===========*/ - FILE* file, /* in: file where to print */ - const rec_t* rec, /* in: physical record */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + FILE* file, /*!< in: file where to print */ + const rec_t* rec, /*!< in: physical record */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint i; @@ -1662,15 +1661,15 @@ rec_print_comp( } } -/******************************************************************* +/***************************************************************//** Prints a physical record. */ UNIV_INTERN void rec_print_new( /*==========*/ - FILE* file, /* in: file where to print */ - const rec_t* rec, /* in: physical record */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + FILE* file, /*!< in: file where to print */ + const rec_t* rec, /*!< in: physical record */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec); ut_ad(offsets); @@ -1690,15 +1689,15 @@ rec_print_new( rec_validate(rec, offsets); } -/******************************************************************* +/***************************************************************//** Prints a physical record. */ UNIV_INTERN void rec_print( /*======*/ - FILE* file, /* in: file where to print */ - const rec_t* rec, /* in: physical record */ - dict_index_t* index) /* in: record descriptor */ + FILE* file, /*!< in: file where to print */ + const rec_t* rec, /*!< in: physical record */ + dict_index_t* index) /*!< in: record descriptor */ { ut_ad(index); @@ -1718,3 +1717,4 @@ rec_print( } } } +#endif /* !UNIV_HOTBACKUP */ |