1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-09 11:41:36 +03:00
Files
mariadb/mysql-test/suite/sql_sequence
Sergei Golubchik 516f68af9e MDEV-37345 sequences and prelocking
if a bunch of tables are prelocked, when a table is actually
needed in the routine, open_tables picks one table out of the
prelocked list with a smallest "distance". Distance is simply
a difference between the actual table lock and the requested
table lock. Say, if the prelocked set contains both t1 write-locked
and t1 read-locked, than an UPDATE will prefer write-locked t1
and SELECT will prefer read-locked. if there's only write-locked
table in the set, both UPDATE and SELECT will use it.

this doesn't distingush between UPDATE and INSERT, but INSERT
marks tables with tables->for_insert_data=1, which causes
prelocking to invoke add_internal_tables() and prepare sequences
for execution.

in this bug there were two prelocked t1's, one for INSERT (with
for_insert_data=1) and one for UPDATE.
INSERT picks the second (they both are write-locked, so the distance is
the same), its sequence is not prepared and crashes.

Let's add for_insert_data as the lowest bit into the distance.
2025-10-28 17:49:51 +01:00
..
2024-10-29 14:20:03 +01:00
2025-07-28 18:06:31 +02:00
2025-07-28 18:06:31 +02:00
2025-04-21 11:23:11 +02:00
2023-08-05 20:34:09 +02:00
2025-10-28 17:49:51 +01:00