Commit 9c373d4d authored by Marko Mäkelä's avatar Marko Mäkelä

Fix bogus rec_get_offsets() debug assertion failures for ROW_FORMAT=REDUNDANT

When the debug parameter 'bool leaf' was added to rec_get_offsets(),
also some debug assertions for reading the heap_no of ROW_FORMAT=REDUNDANT
records were added. However, the heap number is uninitialized when
offsets are being computed for to-be-inserted records.

For debug builds, initialize the heap number to a dummy value, so that
the record will be interpreted as 'user record'. The infimum and supremum
pseudo-records are never copied from the page frame and never inserted;
they are part of the page creation.

rec_convert_dtuple_to_rec_old(): Remove a bogus memset() in debug builds.
parent c9c1adc6
...@@ -1176,9 +1176,15 @@ page_cur_parse_insert_rec( ...@@ -1176,9 +1176,15 @@ page_cur_parse_insert_rec(
ut_memcpy(buf + mismatch_index, ptr, end_seg_len); ut_memcpy(buf + mismatch_index, ptr, end_seg_len);
if (page_is_comp(page)) { if (page_is_comp(page)) {
/* Make rec_get_offsets() and rec_offs_make_valid() happy. */
ut_d(rec_set_heap_no_new(buf + origin_offset,
PAGE_HEAP_NO_USER_LOW));
rec_set_info_and_status_bits(buf + origin_offset, rec_set_info_and_status_bits(buf + origin_offset,
info_and_status_bits); info_and_status_bits);
} else { } else {
/* Make rec_get_offsets() and rec_offs_make_valid() happy. */
ut_d(rec_set_heap_no_old(buf + origin_offset,
PAGE_HEAP_NO_USER_LOW));
rec_set_info_bits_old(buf + origin_offset, rec_set_info_bits_old(buf + origin_offset,
info_and_status_bits); info_and_status_bits);
} }
......
...@@ -1130,17 +1130,14 @@ rec_convert_dtuple_to_rec_old( ...@@ -1130,17 +1130,14 @@ rec_convert_dtuple_to_rec_old(
/* Calculate the offset of the origin in the physical record */ /* Calculate the offset of the origin in the physical record */
rec = buf + rec_get_converted_extra_size(data_size, n_fields, n_ext); rec = buf + rec_get_converted_extra_size(data_size, n_fields, n_ext);
#ifdef UNIV_DEBUG
/* Suppress Valgrind warnings of ut_ad()
in mach_write_to_1(), mach_write_to_2() et al. */
memset(buf, 0xff, rec - buf + data_size);
#endif /* UNIV_DEBUG */
/* Store the number of fields */ /* Store the number of fields */
rec_set_n_fields_old(rec, n_fields); rec_set_n_fields_old(rec, n_fields);
/* Set the info bits of the record */ /* Set the info bits of the record */
rec_set_info_bits_old(rec, dtuple_get_info_bits(dtuple) rec_set_info_bits_old(rec, dtuple_get_info_bits(dtuple)
& REC_INFO_BITS_MASK); & REC_INFO_BITS_MASK);
/* Make rec_get_offsets() and rec_offs_make_valid() happy. */
ut_d(rec_set_heap_no_old(rec, PAGE_HEAP_NO_USER_LOW));
/* Store the data and the offsets */ /* Store the data and the offsets */
...@@ -1254,6 +1251,8 @@ rec_convert_dtuple_to_rec_comp( ...@@ -1254,6 +1251,8 @@ rec_convert_dtuple_to_rec_comp(
temp = false; temp = false;
} }
} else { } else {
/* Make rec_get_offsets() and rec_offs_make_valid() happy. */
ut_d(rec_set_heap_no_new(rec, PAGE_HEAP_NO_USER_LOW));
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1); nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) { switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment