From 048ce506e63061b094d0745cb14b561e663a1c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Olchawa?= Date: Thu, 9 Apr 2026 13:05:47 +0200 Subject: [PATCH] PS-11297 [9.7]: Avoid calling validate() in non-debug in rec_offs_*() https://perconadev.atlassian.net/browse/PS-11297 validate_rec_offset() in the rec_offs_*() helpers of rem0wrec was called unconditionally, including in non-debug builds where it does no useful work. Wrap these calls in ut_d() so they are compiled only in debug builds, removing the per-call overhead on release builds. --- storage/innobase/include/rem0wrec.h | 2 +- storage/innobase/rem/rem0wrec.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/include/rem0wrec.h b/storage/innobase/include/rem0wrec.h index 5cb3dabb5a19..4841830ca41b 100644 --- a/storage/innobase/include/rem0wrec.h +++ b/storage/innobase/include/rem0wrec.h @@ -153,7 +153,7 @@ void validate_rec_offset(const dict_index_t *index, const ulint *offsets, n = index->get_field_off_pos(n); } - validate_rec_offset(index, offsets, n, UT_LOCATION_HERE); + ut_d(validate_rec_offset(index, offsets, n, UT_LOCATION_HERE)); /* Returns nonzero if the extern bit is set in nth field of rec. */ return rec_offs_base(offsets)[1 + n] & REC_OFFS_EXTERNAL; } diff --git a/storage/innobase/rem/rem0wrec.cc b/storage/innobase/rem/rem0wrec.cc index e627e2ab27cc..4150fcbf6904 100644 --- a/storage/innobase/rem/rem0wrec.cc +++ b/storage/innobase/rem/rem0wrec.cc @@ -129,7 +129,7 @@ ulint rec_offs_nth_sql_null(const dict_index_t *index, const ulint *offsets, n = index->get_field_off_pos(n); } - validate_rec_offset(index, offsets, n, UT_LOCATION_HERE); + ut_d(validate_rec_offset(index, offsets, n, UT_LOCATION_HERE)); return (rec_offs_nth_sql_null_low(offsets, n)); } @@ -139,7 +139,7 @@ ulint rec_offs_nth_default(const dict_index_t *index, const ulint *offsets, n = index->get_field_off_pos(n); } - validate_rec_offset(index, offsets, n, UT_LOCATION_HERE); + ut_d(validate_rec_offset(index, offsets, n, UT_LOCATION_HERE)); return (rec_offs_nth_default_low(offsets, n)); } @@ -149,7 +149,7 @@ ulint rec_offs_nth_size(const dict_index_t *index, const ulint *offsets, n = index->get_field_off_pos(n); } - validate_rec_offset(index, offsets, n, UT_LOCATION_HERE); + ut_d(validate_rec_offset(index, offsets, n, UT_LOCATION_HERE)); return (rec_offs_nth_size_low(offsets, n)); }