Skip to content

Commit e14ffd8

Browse files
committed
MDEV-22721 fixup for 32-bit GCC
lock_check_trx_id_sanity(): Because the argument of UNIV_LIKELY or __builtin_expect() can be less than sizeof(trx_id_t) on 32-bit systems, it cannot reliably perform an implicit comparison to 0.
1 parent b9b279e commit e14ffd8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

storage/innobase/lock/lock0lock.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,18 +351,18 @@ lock_check_trx_id_sanity(
351351
dict_index_t* index,/*!< in: index */
352352
const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
353353
{
354-
ut_ad(rec_offs_validate(rec, index, offsets));
355-
ut_ad(!rec_is_metadata(rec, index));
354+
ut_ad(rec_offs_validate(rec, index, offsets));
355+
ut_ad(!rec_is_metadata(rec, index));
356356

357-
trx_id_tmax_trx_id = trx_sys.get_max_trx_id();
358-
ut_ad(max_trx_id || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN);
357+
trx_id_t max_trx_id= trx_sys.get_max_trx_id();
358+
ut_ad(max_trx_id || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN);
359359

360-
if (UNIV_LIKELY(max_trx_id) && UNIV_UNLIKELY(trx_id >= max_trx_id)) {
361-
lock_report_trx_id_insanity(
362-
trx_id, rec, index, offsets, max_trx_id);
363-
return false;
364-
}
365-
return(true);
360+
if (UNIV_LIKELY(max_trx_id != 0) && UNIV_UNLIKELY(trx_id >= max_trx_id))
361+
{
362+
lock_report_trx_id_insanity(trx_id, rec, index, offsets, max_trx_id);
363+
return false;
364+
}
365+
return true;
366366
}
367367

368368
/*********************************************************************//**

0 commit comments

Comments
 (0)