mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
MDEV-35834 Server crash in FVector::distance_to upon concurrent SELECT
a start node in the shared context must be atomically assigned to a valid and fully initialized node otherwise a concurrent thread might use it before it's safe
This commit is contained in:
parent
8ef37ade17
commit
2c797ffe43
1 changed files with 7 additions and 2 deletions
|
@ -686,8 +686,13 @@ int MHNSW_Share::acquire(MHNSW_Share **ctx, TABLE *table, bool for_update)
|
||||||
|
|
||||||
graph->file->position(graph->record[0]);
|
graph->file->position(graph->record[0]);
|
||||||
(*ctx)->set_lengths(FVector::data_to_value_size(graph->field[FIELD_VEC]->value_length()));
|
(*ctx)->set_lengths(FVector::data_to_value_size(graph->field[FIELD_VEC]->value_length()));
|
||||||
(*ctx)->start= (*ctx)->get_node(graph->file->ref);
|
|
||||||
return (*ctx)->start->load_from_record(graph);
|
auto node= (*ctx)->get_node(graph->file->ref);
|
||||||
|
if ((err= node->load_from_record(graph)))
|
||||||
|
return err;
|
||||||
|
|
||||||
|
(*ctx)->start= node; // set the shared start only when node is fully loaded
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the vector, preprocessed as needed */
|
/* copy the vector, preprocessed as needed */
|
||||||
|
|
Loading…
Reference in a new issue