mariadb/storage
Alessandro Vetere e151cb583d SAMU-322: avoid spurious AHI params setting
In btr_search_info_update_hash, when hash potential is reset,
make sure that AHI params are properly reset too.

Before this changes, when cmp == 0, this assignment could be done
if cursor.low_match == 0 and cursor.low_bytes == 0:

info.left_bytes_field= 0x80010000;  // 1-byte left prefix

Since the code is not fully thread safe by design, another thread
could have already taken the !n_hash_potential branch before,
and got to where the potential of the hash is increased:

info.n_hash_potential= ++n_hash_potential;

If the reset to 0x80010000 happened right before the hash potential increment,
then an AHI index with 1-byte left prefix could be later (possibly wrongly)
built on the page.

With this change, the assignment in case cmp == 0 becomes the
same that the resetting code applied:

info.left_bytes_field= 0x80000001;  // 1-field left prefix

This is more in-line pre-MDEV-35049 code behavior.

A more coherent albeit possibly more costly solution would be to merge
all the AHI "status" variables into one 64 bits atomic word, so that
by design the above concurrency issues could not be applicable.

Many thanks to Marko Mäkelä <marko.makela@mariadb.com> for spotting the
relevant code and for the collaboration.
2025-09-24 15:39:09 +00:00
..
archive MDEV-36050 DATA/INDEX DIRECTORY handling is inconsistent 2025-04-18 09:41:23 +02:00
blackhole Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
columnstore Merge branch '10.6' into 10.11 2025-01-30 11:55:13 +01:00
connect Merge remote-tracking branch 'github/bb-11.4-release' into bb-11.8-serg 2025-04-27 19:40:00 +02:00
csv MDEV-36050 DATA/INDEX DIRECTORY handling is inconsistent 2025-04-18 09:41:23 +02:00
example Tag push_warning_printf with ATTRIBUTE_FORMAT 2025-02-12 10:17:44 +01:00
federated Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
federatedx Merge remote-tracking branch 'github/bb-11.4-release' into bb-11.8-serg 2025-04-27 19:40:00 +02:00
heap Merge branch '11.7' into 11.8 2025-02-11 20:29:43 +01:00
innobase SAMU-322: avoid spurious AHI params setting 2025-09-24 15:39:09 +00:00
maria MDEV-24 Segmented key cache for Aria 2025-06-25 21:42:50 +03:00
mroonga Merge remote-tracking branch 'github/bb-11.4-release' into bb-11.8-serg 2025-04-27 19:40:00 +02:00
myisam Merge 11.4 into 11.8 2025-04-02 14:07:01 +03:00
myisammrg Merge 11.4 into 11.7 2025-01-09 09:41:38 +02:00
oqgraph Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
perfschema Merge branch '11.4' into 11.7 2025-02-06 16:46:36 +01:00
rocksdb Merge branch '11.4' into 11.8 2025-04-28 19:10:10 +02:00
sequence cleanup: extract transaction-related part of handlerton 2024-11-05 14:00:50 -08:00
sphinx Merge 11.4 into 11.7 2024-12-02 17:51:17 +02:00
spider Merge remote-tracking branch 'github/bb-11.4-release' into bb-11.8-serg 2025-04-27 19:40:00 +02:00
test_sql_discovery MDEV-19123 Change default charset from latin1 to utf8mb4 2024-07-11 10:21:07 +04:00