diff options
Diffstat (limited to 'storage/innobase/include/rem0rec.h')
-rw-r--r-- | storage/innobase/include/rem0rec.h | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 428503d3c09..197375b6301 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -63,25 +63,25 @@ The status is stored in the low-order bits. */ #ifndef UNIV_INNOCHECKSUM /** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records */ -constexpr offset_t REC_1BYTE_SQL_NULL_MASK= 0x80; +constexpr rec_offs REC_1BYTE_SQL_NULL_MASK= 0x80; /** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records */ -constexpr offset_t REC_2BYTE_SQL_NULL_MASK= 0x8000; +constexpr rec_offs REC_2BYTE_SQL_NULL_MASK= 0x8000; /** In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most significant bit denotes that the tail of a field is stored off-page. */ -constexpr offset_t REC_2BYTE_EXTERN_MASK= 0x4000; +constexpr rec_offs REC_2BYTE_EXTERN_MASK= 0x4000; constexpr size_t RECORD_OFFSET= 2; constexpr size_t INDEX_OFFSET= - RECORD_OFFSET + sizeof(rec_t *) / sizeof(offset_t); + RECORD_OFFSET + sizeof(rec_t *) / sizeof(rec_offs); #endif /* UNIV_INNOCHECKSUM */ /* Length of the rec_get_offsets() header */ constexpr size_t REC_OFFS_HEADER_SIZE= #ifdef UNIV_DEBUG #ifndef UNIV_INNOCHECKSUM - sizeof(rec_t *) / sizeof(offset_t) + - sizeof(dict_index_t *) / sizeof(offset_t) + + sizeof(rec_t *) / sizeof(rec_offs) + + sizeof(dict_index_t *) / sizeof(rec_offs) + #endif /* UNIV_INNOCHECKSUM */ #endif /* UNIV_DEBUG */ 2; @@ -117,30 +117,30 @@ enum field_type_t }; /** without 2 upper bits */ -static constexpr offset_t DATA_MASK= 0x3fff; +static constexpr rec_offs DATA_MASK= 0x3fff; /** 2 upper bits */ -static constexpr offset_t TYPE_MASK= ~DATA_MASK; -inline field_type_t get_type(offset_t n) +static constexpr rec_offs TYPE_MASK= ~DATA_MASK; +inline field_type_t get_type(rec_offs n) { return static_cast<field_type_t>(n & TYPE_MASK); } -inline void set_type(offset_t &n, field_type_t type) +inline void set_type(rec_offs &n, field_type_t type) { - n= static_cast<offset_t>((n & DATA_MASK) | type); + n= static_cast<rec_offs>((n & DATA_MASK) | type); } -inline offset_t get_value(offset_t n) { return n & DATA_MASK; } -inline offset_t combine(offset_t value, field_type_t type) +inline rec_offs get_value(rec_offs n) { return n & DATA_MASK; } +inline rec_offs combine(rec_offs value, field_type_t type) { - return static_cast<offset_t>(get_value(value) | type); + return static_cast<rec_offs>(get_value(value) | type); } /** Compact flag ORed to the extra size returned by rec_get_offsets() */ -constexpr offset_t REC_OFFS_COMPACT= offset_t(~(offset_t(~0) >> 1)); +constexpr rec_offs REC_OFFS_COMPACT= rec_offs(~(rec_offs(~0) >> 1)); /** External flag in offsets returned by rec_get_offsets() */ -constexpr offset_t REC_OFFS_EXTERNAL= REC_OFFS_COMPACT >> 1; +constexpr rec_offs REC_OFFS_EXTERNAL= REC_OFFS_COMPACT >> 1; /** Default value flag in offsets returned by rec_get_offsets() */ -constexpr offset_t REC_OFFS_DEFAULT= REC_OFFS_COMPACT >> 2; -constexpr offset_t REC_OFFS_MASK= REC_OFFS_DEFAULT - 1; +constexpr rec_offs REC_OFFS_DEFAULT= REC_OFFS_COMPACT >> 2; +constexpr rec_offs REC_OFFS_MASK= REC_OFFS_DEFAULT - 1; /******************************************************//** The following function is used to get the pointer of the next chained record on the same page. @@ -471,11 +471,11 @@ rec_get_n_extern_new( (ULINT_UNDEFINED to compute all offsets) @param[in,out] heap memory heap @return the new offsets */ -offset_t* +rec_offs* rec_get_offsets_func( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, bool leaf, ulint n_fields, #ifdef UNIV_DEBUG @@ -510,7 +510,7 @@ rec_get_offsets_reverse( const dict_index_t* index, /*!< in: record descriptor */ ulint node_ptr,/*!< in: nonzero=node pointer, 0=leaf node */ - offset_t* offsets)/*!< in/out: array consisting of + rec_offs* offsets)/*!< in/out: array consisting of offsets[0] allocated elements */ MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG @@ -523,7 +523,7 @@ bool rec_offs_validate( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) MY_ATTRIBUTE((nonnull(3), warn_unused_result)); /** Update debug data in offsets, in order to tame rec_offs_validate(). @param[in] rec record @@ -535,7 +535,7 @@ rec_offs_make_valid( const rec_t* rec, const dict_index_t* index, bool leaf, - offset_t* offsets) + rec_offs* offsets) MY_ATTRIBUTE((nonnull)); #else # define rec_offs_make_valid(rec, index, leaf, offsets) @@ -572,10 +572,10 @@ The following function is used to get an offset to the nth data field in a record. @return offset from the origin of rec */ UNIV_INLINE -offset_t +rec_offs rec_get_nth_field_offs( /*===================*/ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n, /*!< in: index of the field */ ulint* len) /*!< out: length of the field; UNIV_SQL_NULL if SQL null */ @@ -590,7 +590,7 @@ const byte* rec_offs_any_null_extern( /*=====================*/ const rec_t* rec, /*!< in: record */ - const offset_t* offsets) /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */ MY_ATTRIBUTE((warn_unused_result)); /** Mark the nth field as externally stored. @@ -598,7 +598,7 @@ rec_offs_any_null_extern( @param[in] n nth field */ void rec_offs_make_nth_extern( - offset_t* offsets, + rec_offs* offsets, const ulint n); /** Determine the number of allocated elements for an array of offsets. @@ -606,7 +606,7 @@ rec_offs_make_nth_extern( @return number of elements */ inline ulint -rec_offs_get_n_alloc(const offset_t* offsets) +rec_offs_get_n_alloc(const rec_offs* offsets) { ulint n_alloc; ut_ad(offsets); @@ -621,7 +621,7 @@ rec_offs_get_n_alloc(const offset_t* offsets) @return number of fields */ inline ulint -rec_offs_n_fields(const offset_t* offsets) +rec_offs_n_fields(const rec_offs* offsets) { ulint n_fields; ut_ad(offsets); @@ -638,7 +638,7 @@ rec_offs_n_fields(const offset_t* offsets) @param[in] n nth field @param[in] flag flag to extract @return type of the record field */ -inline field_type_t rec_offs_nth_type(const offset_t *offsets, ulint n) +inline field_type_t rec_offs_nth_type(const rec_offs *offsets, ulint n) { ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(n < rec_offs_n_fields(offsets)); @@ -650,7 +650,7 @@ inline field_type_t rec_offs_nth_type(const offset_t *offsets, ulint n) @param[in] offsets rec_get_offsets() @param[in] n nth field @return nonzero if default bit is set */ -inline ulint rec_offs_nth_default(const offset_t *offsets, ulint n) +inline ulint rec_offs_nth_default(const rec_offs *offsets, ulint n) { return rec_offs_nth_type(offsets, n) == DEFAULT; } @@ -660,7 +660,7 @@ inline ulint rec_offs_nth_default(const offset_t *offsets, ulint n) @param[in] offsets rec_get_offsets() @param[in] n nth field @return nonzero if SQL NULL set */ -inline ulint rec_offs_nth_sql_null(const offset_t *offsets, ulint n) +inline ulint rec_offs_nth_sql_null(const rec_offs *offsets, ulint n) { return rec_offs_nth_type(offsets, n) == SQL_NULL; } @@ -670,7 +670,7 @@ inline ulint rec_offs_nth_sql_null(const offset_t *offsets, ulint n) @param[in] n nth field Returns nonzero if the extern bit is set in nth field of rec. @return nonzero if externally stored */ -inline ulint rec_offs_nth_extern(const offset_t *offsets, ulint n) +inline ulint rec_offs_nth_extern(const rec_offs *offsets, ulint n) { return rec_offs_nth_type(offsets, n) == STORED_OFFPAGE; } @@ -679,7 +679,7 @@ inline ulint rec_offs_nth_extern(const offset_t *offsets, ulint n) @param[in] offsets rec_get_offsets() @param[in] flag flag to extract @return the flag of the record field */ -inline ulint rec_offs_any_flag(const offset_t *offsets, ulint flag) +inline ulint rec_offs_any_flag(const rec_offs *offsets, ulint flag) { ut_ad(rec_offs_validate(NULL, NULL, offsets)); return *rec_offs_base(offsets) & flag; @@ -688,7 +688,7 @@ inline ulint rec_offs_any_flag(const offset_t *offsets, ulint flag) /** Determine if the offsets are for a record containing off-page columns. @param[in] offsets rec_get_offsets() @return nonzero if any off-page columns exist */ -inline bool rec_offs_any_extern(const offset_t *offsets) +inline bool rec_offs_any_extern(const rec_offs *offsets) { return rec_offs_any_flag(offsets, REC_OFFS_EXTERNAL); } @@ -697,7 +697,7 @@ inline bool rec_offs_any_extern(const offset_t *offsets) @param[in] offsets rec_get_offsets() @return nonzero if any fields need to be replaced with dict_index_t::instant_field_value() */ -inline ulint rec_offs_any_default(const offset_t *offsets) +inline ulint rec_offs_any_default(const rec_offs *offsets) { return rec_offs_any_flag(offsets, REC_OFFS_DEFAULT); } @@ -706,7 +706,7 @@ inline ulint rec_offs_any_default(const offset_t *offsets) @param[in] offsets rec_get_offsets() @return nonzero if ROW_FORMAT is COMPACT,DYNAMIC or COMPRESSED @retval 0 if ROW_FORMAT=REDUNDANT */ -inline ulint rec_offs_comp(const offset_t *offsets) +inline ulint rec_offs_comp(const rec_offs *offsets) { ut_ad(rec_offs_validate(NULL, NULL, offsets)); return (*rec_offs_base(offsets) & REC_OFFS_COMPACT); @@ -808,7 +808,7 @@ const byte* rec_get_nth_cfield( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, ulint n, ulint* len) { @@ -827,7 +827,7 @@ UNIV_INLINE ulint rec_offs_nth_size( /*==============*/ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n) /*!< in: nth field */ MY_ATTRIBUTE((warn_unused_result)); @@ -838,7 +838,7 @@ UNIV_INLINE ulint rec_offs_n_extern( /*==============*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); /**********************************************************//** The following function returns the data size of an old-style physical @@ -859,7 +859,7 @@ UNIV_INLINE void rec_offs_set_n_alloc( /*=================*/ - offset_t*offsets, /*!< out: array for rec_get_offsets(), + rec_offs*offsets, /*!< out: array for rec_get_offsets(), must be allocated */ ulint n_alloc) /*!< in: number of elements */ MY_ATTRIBUTE((nonnull)); @@ -875,7 +875,7 @@ UNIV_INLINE ulint rec_offs_data_size( /*===============*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); /**********************************************************//** Returns the total size of record minus data size of record. @@ -886,7 +886,7 @@ UNIV_INLINE ulint rec_offs_extra_size( /*================*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); /**********************************************************//** Returns the total size of a physical record. @@ -895,7 +895,7 @@ UNIV_INLINE ulint rec_offs_size( /*==========*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG /**********************************************************//** @@ -906,7 +906,7 @@ byte* rec_get_start( /*==========*/ const rec_t* rec, /*!< in: pointer to record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); /**********************************************************//** Returns a pointer to the end of the record. @@ -916,7 +916,7 @@ byte* rec_get_end( /*========*/ const rec_t* rec, /*!< in: pointer to record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); #else /* UNIV_DEBUG */ # define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets)) @@ -933,7 +933,7 @@ rec_t* rec_copy( void* buf, const rec_t* rec, - const offset_t* offsets); + const rec_offs* offsets); /** Determine the size of a data tuple prefix in a temporary file. @param[in] index clustered or secondary index @@ -962,7 +962,7 @@ void rec_init_offsets_temp( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, ulint n_core, const dict_col_t::def_t*def_val, rec_comp_status_t status = REC_STATUS_ORDINARY) @@ -976,7 +976,7 @@ void rec_init_offsets_temp( const rec_t* rec, const dict_index_t* index, - offset_t* offsets) + rec_offs* offsets) MY_ATTRIBUTE((nonnull)); /** Convert a data tuple prefix to the temporary file format. @@ -1096,7 +1096,7 @@ ibool rec_validate( /*=========*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints an old-style physical record. */ @@ -1113,7 +1113,7 @@ rec_print_mbr_rec( /*==========*/ FILE* file, /*!< in: file where to print */ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints a physical record. */ @@ -1122,7 +1122,7 @@ rec_print_new( /*==========*/ FILE* file, /*!< in: file where to print */ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints a physical record. */ @@ -1144,7 +1144,7 @@ rec_print( std::ostream& o, const rec_t* rec, ulint info, - const offset_t* offsets); + const rec_offs* offsets); /** Wrapper for pretty-printing a record */ struct rec_index_print @@ -1171,14 +1171,14 @@ operator<<(std::ostream& o, const rec_index_print& r); struct rec_offsets_print { /** Constructor */ - rec_offsets_print(const rec_t* rec, const offset_t* offsets) : + rec_offsets_print(const rec_t* rec, const rec_offs* offsets) : m_rec(rec), m_offsets(offsets) {} /** Record */ const rec_t* m_rec; /** Offsets to each field */ - const offset_t* m_offsets; + const rec_offs* m_offsets; }; /** Display a record. @@ -1195,7 +1195,7 @@ public: /** Construct a pretty-printed record. @param rec record with header @param offsets rec_get_offsets(rec, ...) */ - rec_printer(const rec_t* rec, const offset_t* offsets) + rec_printer(const rec_t* rec, const rec_offs* offsets) : std::ostringstream () { @@ -1208,7 +1208,7 @@ public: @param rec record, possibly lacking header @param info rec_get_info_bits(rec) @param offsets rec_get_offsets(rec, ...) */ - rec_printer(const rec_t* rec, ulint info, const offset_t* offsets) + rec_printer(const rec_t* rec, ulint info, const rec_offs* offsets) : std::ostringstream () { |