Commit 6053eb1c authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23334 Crash in rec_get_nth_cfield()/rec_offs_validate()

rec_get_nth_cfield(): Remove a bogus debug assertion.
The function may be invoked by innobase_rec_to_mysql()
for reporting a duplicate key error during CREATE UNIQUE INDEX
or ALTER TABLE...ADD UNIQUE KEY, and in that case the record
will be missing the 5-byte or 6-byte fixed header.

It turns out that in every other code path leading to
rec_get_nth_cfield() we either invoked rec_get_offsets()
ourselves or asserted rec_offs_validate(). So, we can
safely remove the assertion and make debug builds
smaller and faster.
parent 0435fcf9
...@@ -829,7 +829,11 @@ rec_get_nth_cfield( ...@@ -829,7 +829,11 @@ rec_get_nth_cfield(
ulint n, ulint n,
ulint* len) ulint* len)
{ {
ut_ad(rec_offs_validate(rec, index, offsets)); /* Because this function may be invoked by innobase_rec_to_mysql()
for reporting a duplicate key during ALTER TABLE or
CREATE UNIQUE INDEX, and in that case the rec omit the fixed-size
header of 5 or 6 bytes, the check
rec_offs_validate(rec, index, offsets) must be avoided here. */
if (!rec_offs_nth_default(offsets, n)) { if (!rec_offs_nth_default(offsets, n)) {
return rec_get_nth_field(rec, offsets, n, len); return rec_get_nth_field(rec, offsets, n, len);
} }
......
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