summaryrefslogtreecommitdiff
path: root/storage/innobase/include/rem0rec.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/include/rem0rec.ic')
-rw-r--r--storage/innobase/include/rem0rec.ic97
1 files changed, 63 insertions, 34 deletions
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index dc8ed515c30..6950263fe81 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -103,7 +103,7 @@ and the shift needed to obtain each bit-field of the record. */
#define REC_OLD_HEAP_NO 5
#define REC_HEAP_NO_MASK 0xFFF8UL
-#if 0 /* defined in rem0rec.h for use of page0zip.c */
+#if 0 /* defined in rem0rec.h for use of page0zip.cc */
#define REC_NEW_HEAP_NO 4
#define REC_HEAP_NO_SHIFT 3
#endif
@@ -264,12 +264,12 @@ rec_get_next_ptr_const(
field_value = mach_read_from_2(rec - REC_NEXT);
- if (UNIV_UNLIKELY(field_value == 0)) {
+ if (field_value == 0) {
return(NULL);
}
- if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
+ if (comp) {
#if UNIV_PAGE_SIZE <= 32768
/* Note that for 64 KiB pages, field_value can 'wrap around'
and the debug assertion is not valid */
@@ -337,7 +337,7 @@ rec_get_next_offs(
field_value = mach_read_from_2(rec - REC_NEXT);
- if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
+ if (comp) {
#if UNIV_PAGE_SIZE <= 32768
/* Note that for 64 KiB pages, field_value can 'wrap around'
and the debug assertion is not valid */
@@ -354,7 +354,7 @@ rec_get_next_offs(
+ ut_align_offset(rec, UNIV_PAGE_SIZE)
< UNIV_PAGE_SIZE);
#endif
- if (UNIV_UNLIKELY(field_value == 0)) {
+ if (field_value == 0) {
return(0);
}
@@ -410,7 +410,7 @@ rec_set_next_offs_new(
ut_ad(rec);
ut_ad(UNIV_PAGE_SIZE > next);
- if (UNIV_UNLIKELY(!next)) {
+ if (!next) {
field_value = 0;
} else {
/* The following two statements calculate
@@ -418,7 +418,7 @@ rec_set_next_offs_new(
as a non-negative number */
field_value = (ulint)
- ((lint) next
+ ((lint) next
- (lint) ut_align_offset(rec, UNIV_PAGE_SIZE));
field_value &= REC_NEXT_MASK;
}
@@ -572,9 +572,7 @@ rec_set_n_owned_new(
{
rec_set_bit_field_1(rec, n_owned, REC_NEW_N_OWNED,
REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
- if (UNIV_LIKELY_NULL(page_zip)
- && UNIV_LIKELY(rec_get_status(rec)
- != REC_STATUS_SUPREMUM)) {
+ if (page_zip && rec_get_status(rec) != REC_STATUS_SUPREMUM) {
page_zip_rec_set_owned(page_zip, rec, n_owned);
}
}
@@ -648,7 +646,7 @@ rec_get_info_and_status_bits(
& (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif
- if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
+ if (comp) {
bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec);
} else {
bits = rec_get_info_bits(rec, FALSE);
@@ -684,16 +682,14 @@ rec_get_deleted_flag(
const rec_t* rec, /*!< in: physical record */
ulint comp) /*!< in: nonzero=compact page format */
{
- if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
- return(UNIV_UNLIKELY(
- rec_get_bit_field_1(rec, REC_NEW_INFO_BITS,
- REC_INFO_DELETED_FLAG,
- REC_INFO_BITS_SHIFT)));
+ if (comp) {
+ return(rec_get_bit_field_1(rec, REC_NEW_INFO_BITS,
+ REC_INFO_DELETED_FLAG,
+ REC_INFO_BITS_SHIFT));
} else {
- return(UNIV_UNLIKELY(
- rec_get_bit_field_1(rec, REC_OLD_INFO_BITS,
- REC_INFO_DELETED_FLAG,
- REC_INFO_BITS_SHIFT)));
+ return(rec_get_bit_field_1(rec, REC_OLD_INFO_BITS,
+ REC_INFO_DELETED_FLAG,
+ REC_INFO_BITS_SHIFT));
}
}
@@ -741,7 +737,7 @@ rec_set_deleted_flag_new(
rec_set_info_bits_new(rec, val);
- if (UNIV_LIKELY_NULL(page_zip)) {
+ if (page_zip) {
page_zip_rec_set_deleted(page_zip, rec, flag);
}
}
@@ -1041,7 +1037,7 @@ rec_get_nth_field_offs(
ut_ad(n < rec_offs_n_fields(offsets));
ut_ad(len);
- if (UNIV_UNLIKELY(n == 0)) {
+ if (n == 0) {
offs = 0;
} else {
offs = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
@@ -1085,10 +1081,10 @@ rec_offs_any_extern(
const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
- return(UNIV_UNLIKELY(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL));
+ return(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL);
}
-#ifdef UNIV_BLOB_NULL_DEBUG
+#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
/******************************************************//**
Determine if the offsets are for a record containing null BLOB pointers.
@return first field containing a null BLOB pointer, or NULL if none found */
@@ -1124,7 +1120,7 @@ rec_offs_any_null_extern(
return(NULL);
}
-#endif /* UNIV_BLOB_NULL_DEBUG */
+#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
/******************************************************//**
Returns nonzero if the extern bit is set in nth field of rec.
@@ -1138,8 +1134,7 @@ rec_offs_nth_extern(
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
- return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
- & REC_OFFS_EXTERNAL));
+ return(rec_offs_base(offsets)[1 + n] & REC_OFFS_EXTERNAL);
}
/******************************************************//**
@@ -1154,8 +1149,7 @@ rec_offs_nth_sql_null(
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
- return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
- & REC_OFFS_SQL_NULL));
+ return(rec_offs_base(offsets)[1 + n] & REC_OFFS_SQL_NULL);
}
/******************************************************//**
@@ -1394,7 +1388,7 @@ rec_set_nth_field(
ut_ad(rec);
ut_ad(rec_offs_validate(rec, NULL, offsets));
- if (UNIV_UNLIKELY(len == UNIV_SQL_NULL)) {
+ if (len == UNIV_SQL_NULL) {
if (!rec_offs_nth_sql_null(offsets, n)) {
ut_a(!rec_offs_comp(offsets));
rec_set_nth_field_sql_null(rec, n);
@@ -1554,7 +1548,7 @@ rec_copy(
ut_memcpy(buf, rec - extra_len, extra_len + data_len);
- return((byte*)buf + extra_len);
+ return((byte*) buf + extra_len);
}
/**********************************************************//**
@@ -1596,7 +1590,7 @@ rec_get_converted_size(
ut_ad(dtuple);
ut_ad(dtuple_check_typed(dtuple));
- ut_ad(index->type & DICT_UNIVERSAL
+ ut_ad(dict_index_is_univ(index)
|| dtuple_get_n_fields(dtuple)
== (((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK)
== REC_STATUS_NODE_PTR)
@@ -1616,6 +1610,41 @@ rec_get_converted_size(
extra_size = rec_get_converted_extra_size(
data_size, dtuple_get_n_fields(dtuple), n_ext);
+#if 0
+ /* This code is inactive since it may be the wrong place to add
+ in the size of node pointers used in parent pages AND it is not
+ currently needed since ha_innobase::max_supported_key_length()
+ ensures that the key size limit for each page size is well below
+ the actual limit ((free space on page / 4) - record overhead).
+ But those limits will need to be raised when InnoDB can
+ support multiple page sizes. At that time, we will need
+ to consider the node pointer on these universal btrees. */
+
+ if (dict_index_is_univ(index)) {
+ /* This is for the insert buffer B-tree.
+ All fields in the leaf tuple ascend to the
+ parent node plus the child page pointer. */
+
+ /* ibuf cannot contain externally stored fields */
+ ut_ad(n_ext == 0);
+
+ /* Add the data pointer and recompute extra_size
+ based on one more field. */
+ data_size += REC_NODE_PTR_SIZE;
+ extra_size = rec_get_converted_extra_size(
+ data_size,
+ dtuple_get_n_fields(dtuple) + 1,
+ 0);
+
+ /* Be sure dtuple->n_fields has this node ptr
+ accounted for. This function should correspond to
+ what rec_convert_dtuple_to_rec() needs in storage.
+ In optimistic insert or update-not-in-place, we will
+ have to ensure that if the record is converted to a
+ node pointer, it will not become too large.*/
+ }
+#endif
+
return(data_size + extra_size);
}